Repository navigation
Description
🐹 Go Fan Report: go-sdk
Module Overview
github.com/modelcontextprotocol/go-sdk (v1.8.0) is the official Go SDK for the Model Context Protocol. It provides server primitives (mcp.NewServer, mcp.AddTool), client primitives (mcp.NewClient), and stdio, command, in-memory, and streamable HTTP transports. The gh aw MCP server, the mcp inspect client, and the connector proxy all depend on it.
Current Usage in gh-aw
- Files: 19 non-test Go files import the module
- Import Count: 19 non-test files (mcp and jsonrpc import lines)
- Key APIs Used: mcp.NewServer, mcp.AddTool (in 5 tool files), mcp.NewStreamableHTTPHandler (stateful, 2h SessionTimeout), mcp.StdioTransport, mcp.CommandTransport, mcp.StreamableClientTransport, mcp.NewClient, AddReceivingMiddleware, ServerOptions.SupportedProtocolVersions, ServerOptions.SetCacheable
Research Findings
Recent Updates
v1.8.0 (2026-09-14) adds: JSON nesting cap of 1000 levels; MaxEventSize on SSE and streamable client transports; StdioTransport.MaxLineLength; 1 MB cap on OAuth dynamic client registration reads; SupportedProtocolVersions (narrow only); SetCacheable for discover, list, and resources/read results; two new MCPGODEBUG flags (plaintextstatefulrejection, blockingcancelnotify), both removed in v1.9.0; four options removed (seterroroverwrite, enableoriginverification, disablecontenttypecheck, disablelocalhostprotection); leak and deadlock fixes in Connect, Close, and stateful servers.
Best Practices
Pin the protocol-version list explicitly and test it (ADR-68051). Use SetCacheable only for static discovery responses and keep tool results uncached. Keep the HTTP handler stateful and loopback-bound with SDK localhost checks on.
Improvement Opportunities
🏃 Quick Wins
- Set MaxEventSize on the inspect HTTP client (pkg/cli/mcp_inspect_mcp.go:211), matching pkg/connectors/mcp.go:36. Check the default cap before choosing a value.
- Consider an explicit StdioTransport.MaxLineLength at pkg/cli/mcp_server_command.go:166 and pkg/cli/connectors_runtime_command.go:32, if the default is looser than wanted for agent-supplied arguments.
✨ Feature Opportunities
- Stateless HTTP mode stays deferred because of session affinity for long logs and audit calls.
- Custom JSON-RPC methods and x-mcp-header passthrough have no current need.
📐 Best Practice Alignment
- SupportedProtocolVersions and SetCacheable are already adopted. No MCPGODEBUG flags are set, so the v1.9.0 removals do not affect gh-aw.
🔧 General Improvements
- No test under pkg/ names the 2026-07-28 revision. Per the v1.8.0 notes, the stateful HTTP handler now answers 2026-07-28 requests with JSON-RPC -32022 instead of a plain-text 400. Add a test or document the renegotiation path (mcp_server.go:17 lists the version first; mcp_server_http.go keeps Stateless off).
Recommendations
- Verify the 2026-07-28 renegotiation path on the stateful HTTP handler and add a test. Highest value.
- Add MaxEventSize to the inspect HTTP client.
- Build and run the MCP test suites on v1.8.0. This review did not compile or run them.
- Evaluate an explicit StdioTransport.MaxLineLength.
Next Steps
- Finalize ADR-68051 (still Draft) after recommendation 1.
- Re-review when go-sdk v1.9.0 lands, since the MCPGODEBUG flags are removed there.
Method and Limitations
Serena semantic tools were not in this session tool inventory, so analysis used ripgrep and file reads. search_code returned HTTP 429, so SDK source was not checked directly. SDK behavior claims come from the v1.8.0 release notes.
Generated by Go Fan
Module summary saved to: scratchpad/mods/go-sdk.md
Generated by 🐹 Go Fan · claude · routed: haiku55 xhigh · ~13 AIC · ⌖ ~2 AIC · ⊞ 6.6K · ◷
- expires on Nov 17, 2026, 12:14 AM UTC-08:00
Activity
github-actions commentedon Nov 16, 2026
🍪 Issue Monster selected this for Copilot
I've identified this issue as a good candidate for automated resolution and requested assignment to the Copilot coding agent.
If assignment succeeds, Copilot will analyze the issue and create a pull request with the fix.
Om nom nom! 🍪