fix: MCP validation script stdin handling and timeouts
- Fix bash script to use 'echo |' instead of '<<<' for Docker stdin - Increase default timeout from 5s to 10s - Add explicit timeout parameter to all test function calls - Fix Ghost MCP env variables to use correct names and format - Script was giving false negatives due to incorrect bash syntax
This commit is contained in:
@@ -13,7 +13,7 @@ INIT_MSG='{"jsonrpc":"2.0","method":"initialize","params":{"capabilities":{},"pr
|
|||||||
# Test a container with initialize message
|
# Test a container with initialize message
|
||||||
test_mcp_server() {
|
test_mcp_server() {
|
||||||
local container_name=$1
|
local container_name=$1
|
||||||
local timeout=${2:-5}
|
local timeout=${2:-10}
|
||||||
shift 2
|
shift 2
|
||||||
local env_vars=("$@")
|
local env_vars=("$@")
|
||||||
|
|
||||||
@@ -26,11 +26,8 @@ test_mcp_server() {
|
|||||||
done
|
done
|
||||||
|
|
||||||
# Run container with stdin input and environment variables
|
# Run container with stdin input and environment variables
|
||||||
result=$(timeout $timeout docker run --rm -i --name "$container_name-test" \
|
# Note: Using subshell with timeout for the docker run command
|
||||||
$env_args \
|
result=$( (echo "$INIT_MSG" | timeout $timeout docker run --rm -i --name "$container_name-test" $env_args "$container_name" 2>&1) || true )
|
||||||
"$container_name" \
|
|
||||||
<<<"$INIT_MSG" \
|
|
||||||
2>&1)
|
|
||||||
|
|
||||||
# Check for valid JSON-RPC response
|
# Check for valid JSON-RPC response
|
||||||
if echo "$result" | grep -q '"result"'; then
|
if echo "$result" | grep -q '"result"'; then
|
||||||
@@ -65,32 +62,32 @@ test_mcp_server() {
|
|||||||
echo -e "${YELLOW}=== MCP Server Validation ===${NC}\n"
|
echo -e "${YELLOW}=== MCP Server Validation ===${NC}\n"
|
||||||
|
|
||||||
# Stdio-based MCP servers
|
# Stdio-based MCP servers
|
||||||
test_mcp_server "kneldevstack-aimiddleware-ghost-mcp" \
|
test_mcp_server "kneldevstack-aimiddleware-ghost-mcp" 5 \
|
||||||
"GHOST_URL=https://ghost.example.com" \
|
"GHOST_API_URL=https://ghost.example.com" \
|
||||||
"GHOST_API_KEY=dummy-key"
|
"GHOST_ADMIN_API_KEY=012345678901234567890123:0123456789012345678901234567890123456789012345678901234567890123"
|
||||||
|
|
||||||
test_mcp_server "kneldevstack-aimiddleware-penpot-mcp" \
|
test_mcp_server "kneldevstack-aimiddleware-penpot-mcp" 5 \
|
||||||
"PENPOT_URL=https://design.penpot.app" \
|
"PENPOT_URL=https://design.penpot.app" \
|
||||||
"PENPOT_TOKEN=dummy-token"
|
"PENPOT_TOKEN=dummy-token"
|
||||||
|
|
||||||
test_mcp_server "kneldevstack-aimiddleware-imap-mcp" \
|
test_mcp_server "kneldevstack-aimiddleware-imap-mcp" 5 \
|
||||||
"IMAP_HOST=imap.example.com" \
|
"IMAP_HOST=imap.example.com" \
|
||||||
"IMAP_USERNAME=user@example.com" \
|
"IMAP_USERNAME=user@example.com" \
|
||||||
"IMAP_PASSWORD=dummy-password"
|
"IMAP_PASSWORD=dummy-password"
|
||||||
|
|
||||||
test_mcp_server "kneldevstack-aimiddleware-proxmox-mcp" \
|
test_mcp_server "kneldevstack-aimiddleware-proxmox-mcp" 5 \
|
||||||
"PROXMOX_HOST=https://proxmox.example.com" \
|
"PROXMOX_HOST=https://proxmox.example.com" \
|
||||||
"PROXMOX_USER=root@pam" \
|
"PROXMOX_USER=root@pam" \
|
||||||
"PROXMOX_TOKEN=dummy-token" \
|
"PROXMOX_TOKEN=dummy-token" \
|
||||||
"PROXMOX_NODE=pve"
|
"PROXMOX_NODE=pve"
|
||||||
|
|
||||||
test_mcp_server "kneldevstack-aimiddleware-context7-mcp"
|
test_mcp_server "kneldevstack-aimiddleware-context7-mcp" 5
|
||||||
|
|
||||||
test_mcp_server "kneldevstack-aimiddleware-docker-mcp"
|
test_mcp_server "kneldevstack-aimiddleware-docker-mcp" 5
|
||||||
|
|
||||||
test_mcp_server "kneldevstack-aimiddleware-drawio-mcp"
|
test_mcp_server "kneldevstack-aimiddleware-drawio-mcp" 5
|
||||||
|
|
||||||
test_mcp_server "kneldevstack-aimiddleware-mcp-redmine" \
|
test_mcp_server "kneldevstack-aimiddleware-mcp-redmine" 5 \
|
||||||
"REDMINE_URL=https://redmine.example.com" \
|
"REDMINE_URL=https://redmine.example.com" \
|
||||||
"REDMINE_API_KEY=dummy-key"
|
"REDMINE_API_KEY=dummy-key"
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user