Move utility scripts to dedicated scripts/ directory for better project organization: - BuildAll.sh - CleanVendor.sh - CloneVendorRepos.sh - StatusCheck.sh - validate-mcp.sh Remove temporary build-nextcloud-mcp.sh as nextcloud-mcp is now built.
104 lines
3.7 KiB
Bash
Executable File
104 lines
3.7 KiB
Bash
Executable File
#!/bin/bash
|
|
# MCP Server Validation Script
|
|
# Tests each MCP server with actual protocol messages
|
|
|
|
GREEN='\033[0;32m'
|
|
RED='\033[0;31m'
|
|
YELLOW='\033[1;33m'
|
|
NC='\033[0m' # No Color
|
|
|
|
# Initialize JSON message
|
|
INIT_MSG='{"jsonrpc":"2.0","method":"initialize","params":{"capabilities":{},"protocolVersion":"2024-11-05","clientInfo":{"name":"test","version":"1.0.0"}},"id":1}'
|
|
|
|
# Test a container with initialize message
|
|
test_mcp_server() {
|
|
local container_name=$1
|
|
local timeout=${2:-10}
|
|
shift 2
|
|
local env_vars=("$@")
|
|
|
|
echo -e "${YELLOW}Testing $container_name...${NC}"
|
|
|
|
# Build environment arguments
|
|
local env_args=""
|
|
for env_var in "${env_vars[@]}"; do
|
|
env_args="$env_args -e $env_var"
|
|
done
|
|
|
|
# Run container with stdin input and environment variables
|
|
# Note: Using subshell with timeout for the docker run command
|
|
result=$( (echo "$INIT_MSG" | timeout $timeout docker run --rm -i --name "$container_name-test" $env_args "$container_name" 2>&1) || true )
|
|
|
|
# Check for valid JSON-RPC response
|
|
if echo "$result" | grep -q '"result"'; then
|
|
# Check if it has server info
|
|
if echo "$result" | grep -q '"serverInfo"'; then
|
|
server_name=$(echo "$result" | grep -o '"name":"[^"]*"' | head -1 | cut -d'"' -f4)
|
|
version=$(echo "$result" | grep -o '"version":"[^"]*"' | head -1 | cut -d'"' -f4)
|
|
echo -e "${GREEN}✓ $container_name: Working ($server_name v${version})${NC}"
|
|
return 0
|
|
fi
|
|
fi
|
|
|
|
# Check if server requires environment variables
|
|
if echo "$result" | grep -qi "environment variable"; then
|
|
echo -e "${YELLOW}⚠ $container_name: Needs environment variables${NC}"
|
|
return 1
|
|
fi
|
|
|
|
# Check if server needs external service
|
|
if echo "$result" | grep -qi "connection refused\|not connected"; then
|
|
echo -e "${YELLOW}⚠ $container_name: Needs external service (expected)${NC}"
|
|
return 1
|
|
fi
|
|
|
|
# Check other errors
|
|
echo -e "${RED}✗ $container_name: Failed${NC}"
|
|
echo -e "${RED} Error: $(echo "$result" | head -3 | tail -1)${NC}"
|
|
return 1
|
|
}
|
|
|
|
# Test all built containers
|
|
echo -e "${YELLOW}=== MCP Server Validation ===${NC}\n"
|
|
|
|
# Stdio-based MCP servers
|
|
test_mcp_server "kneldevstack-aimiddleware-ghost-mcp" 5 \
|
|
"GHOST_API_URL=https://ghost.example.com" \
|
|
"GHOST_ADMIN_API_KEY=012345678901234567890123:0123456789012345678901234567890123456789012345678901234567890123"
|
|
|
|
test_mcp_server "kneldevstack-aimiddleware-penpot-mcp" 5 \
|
|
"PENPOT_URL=https://design.penpot.app" \
|
|
"PENPOT_TOKEN=dummy-token"
|
|
|
|
test_mcp_server "kneldevstack-aimiddleware-imap-mcp" 5 \
|
|
"IMAP_HOST=imap.example.com" \
|
|
"IMAP_USERNAME=user@example.com" \
|
|
"IMAP_PASSWORD=dummy-password"
|
|
|
|
test_mcp_server "kneldevstack-aimiddleware-proxmox-mcp" 5 \
|
|
"PROXMOX_HOST=https://proxmox.example.com" \
|
|
"PROXMOX_USER=root@pam" \
|
|
"PROXMOX_TOKEN=dummy-token" \
|
|
"PROXMOX_NODE=pve"
|
|
|
|
test_mcp_server "kneldevstack-aimiddleware-context7-mcp" 5
|
|
|
|
test_mcp_server "kneldevstack-aimiddleware-docker-mcp" 5
|
|
|
|
test_mcp_server "kneldevstack-aimiddleware-drawio-mcp" 5
|
|
|
|
test_mcp_server "kneldevstack-aimiddleware-mcp-redmine" 5 \
|
|
"REDMINE_URL=https://redmine.example.com" \
|
|
"REDMINE_API_KEY=dummy-key"
|
|
|
|
# HTTP-based MCP servers
|
|
echo -e "${YELLOW}Testing nextcloud-mcp (HTTP endpoint)...${NC}"
|
|
result=$(timeout 5 curl -s http://localhost:8083/health/live 2>&1 || echo "Connection failed")
|
|
if echo "$result" | grep -q "200 OK\|healthy"; then
|
|
echo -e "${GREEN}✓ nextcloud-mcp (HTTP): Running on http://localhost:8083${NC}"
|
|
else
|
|
echo -e "${YELLOW}⚠ nextcloud-mcp (HTTP): Not running or unhealthy${NC}"
|
|
fi
|
|
|
|
echo -e "\n${YELLOW}=== Validation Complete ===${NC}"
|