diff --git a/script/get-me b/script/get-me index 46339ae53..954f57cec 100755 --- a/script/get-me +++ b/script/get-me @@ -1,3 +1,17 @@ #!/bin/bash -echo '{"jsonrpc":"2.0","id":3,"params":{"name":"get_me"},"method":"tools/call"}' | go run cmd/github-mcp-server/main.go stdio | jq . +# MCP requires initialize -> notifications/initialized -> tools/call +output=$( + ( + echo '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2024-11-05","capabilities":{},"clientInfo":{"name":"get-me-script","version":"1.0.0"}}}' + echo '{"jsonrpc":"2.0","method":"notifications/initialized","params":{}}' + echo '{"jsonrpc":"2.0","id":2,"method":"tools/call","params":{"name":"get_me","arguments":{}}}' + sleep 1 + ) | go run cmd/github-mcp-server/main.go stdio 2>/dev/null | tail -1 +) + +if command -v jq &> /dev/null; then + echo "$output" | jq '.result.content[0].text | fromjson' +else + echo "$output" +fi