-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest-server.sh
More file actions
executable file
·34 lines (27 loc) · 1.52 KB
/
test-server.sh
File metadata and controls
executable file
·34 lines (27 loc) · 1.52 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
#!/bin/bash
# Simple test script for MCP server
echo "Testing Modular MCP Server"
echo "=========================="
echo ""
# Test 1: Initialize
echo "Test 1: Initialize"
echo '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{}}' | node server.js 2>/dev/null | head -1
echo ""
# Test 2: List tools
echo "Test 2: List tools"
(echo '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{}}'; echo '{"jsonrpc":"2.0","id":2,"method":"tools/list","params":{}}') | node server.js 2>/dev/null | tail -1 | jq '.result.tools[] | {name, description}' 2>/dev/null || echo "Install jq for formatted output"
echo ""
# Test 3: Call echo tool
echo "Test 3: Call echo tool"
(echo '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{}}'; echo '{"jsonrpc":"2.0","id":2,"method":"tools/call","params":{"name":"echo","arguments":{"message":"Hello MCP!"}}}') | node server.js 2>/dev/null | tail -1
echo ""
# Test 4: Call calculate tool
echo "Test 4: Call calculate tool"
(echo '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{}}'; echo '{"jsonrpc":"2.0","id":2,"method":"tools/call","params":{"name":"calculate","arguments":{"expression":"2 + 2 * 3"}}}') | node server.js 2>/dev/null | tail -1
echo ""
# Test 5: Call timestamp tool
echo "Test 5: Call timestamp tool"
(echo '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{}}'; echo '{"jsonrpc":"2.0","id":2,"method":"tools/call","params":{"name":"timestamp","arguments":{}}}') | node server.js 2>/dev/null | tail -1
echo ""
echo "=========================="
echo "All tests completed!"