Skip to content

Commit 1802447

Browse files
fix: update get-me script for go-SDK MCP protocol
The go-SDK migration changed MCP protocol handling to require proper initialization before tool calls. This updates the script to: - Add initialize request with protocol version and client info - Add notifications/initialized notification - Add arguments field to tools/call params - Keep stdin open with sleep for response - Gracefully handle missing jq dependency
1 parent 82c4930 commit 1802447

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

script/get-me

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,17 @@
11
#!/bin/bash
22

3-
echo '{"jsonrpc":"2.0","id":3,"params":{"name":"get_me"},"method":"tools/call"}' | go run cmd/github-mcp-server/main.go stdio | jq .
3+
# MCP requires initialize -> notifications/initialized -> tools/call
4+
output=$(
5+
(
6+
echo '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2024-11-05","capabilities":{},"clientInfo":{"name":"get-me-script","version":"1.0.0"}}}'
7+
echo '{"jsonrpc":"2.0","method":"notifications/initialized","params":{}}'
8+
echo '{"jsonrpc":"2.0","id":2,"method":"tools/call","params":{"name":"get_me","arguments":{}}}'
9+
sleep 1
10+
) | go run cmd/github-mcp-server/main.go stdio 2>/dev/null | tail -1
11+
)
12+
13+
if command -v jq &> /dev/null; then
14+
echo "$output" | jq '.result.content[0].text | fromjson'
15+
else
16+
echo "$output"
17+
fi

0 commit comments

Comments
 (0)