forked from czlonkowski/n8n-mcp
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest-reinit-fix.sh
More file actions
executable file
·114 lines (101 loc) · 2.88 KB
/
test-reinit-fix.sh
File metadata and controls
executable file
·114 lines (101 loc) · 2.88 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
#!/bin/bash
# Test script to verify re-initialization fix works
echo "Starting n8n MCP server..."
AUTH_TOKEN=test123456789012345678901234567890 npm run start:http &
SERVER_PID=$!
# Wait for server to start
sleep 3
echo "Testing multiple initialize requests..."
# First initialize request
echo "1. First initialize request:"
RESPONSE1=$(curl -s -X POST http://localhost:3000/mcp \
-H "Content-Type: application/json" \
-H "Accept: application/json, text/event-stream" \
-H "Authorization: Bearer test123456789012345678901234567890" \
-d '{
"jsonrpc": "2.0",
"id": 1,
"method": "initialize",
"params": {
"protocolVersion": "2024-11-05",
"capabilities": {
"roots": {
"listChanged": false
}
},
"clientInfo": {
"name": "test-client-1",
"version": "1.0.0"
}
}
}')
if echo "$RESPONSE1" | grep -q '"result"'; then
echo "✅ First initialize request succeeded"
else
echo "❌ First initialize request failed: $RESPONSE1"
fi
# Second initialize request (this was failing before)
echo "2. Second initialize request (this was failing before the fix):"
RESPONSE2=$(curl -s -X POST http://localhost:3000/mcp \
-H "Content-Type: application/json" \
-H "Accept: application/json, text/event-stream" \
-H "Authorization: Bearer test123456789012345678901234567890" \
-d '{
"jsonrpc": "2.0",
"id": 2,
"method": "initialize",
"params": {
"protocolVersion": "2024-11-05",
"capabilities": {
"roots": {
"listChanged": false
}
},
"clientInfo": {
"name": "test-client-2",
"version": "1.0.0"
}
}
}')
if echo "$RESPONSE2" | grep -q '"result"'; then
echo "✅ Second initialize request succeeded - FIX WORKING!"
else
echo "❌ Second initialize request failed: $RESPONSE2"
fi
# Third initialize request to be sure
echo "3. Third initialize request:"
RESPONSE3=$(curl -s -X POST http://localhost:3000/mcp \
-H "Content-Type: application/json" \
-H "Accept: application/json, text/event-stream" \
-H "Authorization: Bearer test123456789012345678901234567890" \
-d '{
"jsonrpc": "2.0",
"id": 3,
"method": "initialize",
"params": {
"protocolVersion": "2024-11-05",
"capabilities": {
"roots": {
"listChanged": false
}
},
"clientInfo": {
"name": "test-client-3",
"version": "1.0.0"
}
}
}')
if echo "$RESPONSE3" | grep -q '"result"'; then
echo "✅ Third initialize request succeeded"
else
echo "❌ Third initialize request failed: $RESPONSE3"
fi
# Check health to see active transports
echo "4. Checking server health for active transports:"
HEALTH=$(curl -s -X GET http://localhost:3000/health)
echo "$HEALTH" | python3 -m json.tool
# Cleanup
echo "Stopping server..."
kill $SERVER_PID
wait $SERVER_PID 2>/dev/null
echo "Test completed!"