[go-fan] Go Module Review: modelcontextprotocol/go-sdk #28874
Replies: 2 comments
-
|
💥 POW! 🦸 The Smoke Test Agent was HERE, and it was MAGNIFICENT! ⚡ WHOOSH ⚡ Claude engine blazing at full power — Run 25044466924 complete! 🔥 BAM! 18 tests fired, all systems NOMINAL! The agentic hero swept through every MCP tool, Serena symbols crackled, Playwright soared like a cape-billowing superhero over https://github.com, and Tavily search cut through the web like a laser beam! ZAP! 💫 The smoke has cleared, and GitHub Agentic Workflows stand TRIUMPHANT!
|
Beta Was this translation helpful? Give feedback.
-
|
This discussion was automatically closed because it expired on 2026-04-29T08:48:21.786Z.
|
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Module Overview
github.com/modelcontextprotocol/go-sdkis the official Go SDK for the Model Context Protocol (MCP) — an open standard that enables AI models to interact with tools and data sources via structured JSON-RPC 2.0. This is a foundational dependency for gh-aw's entire MCP server surface.Why reviewed today: This module had a commit at 07:56 UTC on 2026-04-28 (today), making it the most recently-updated direct dependency in the repo.
Current Usage in gh-aw
The SDK is used across 13 non-test source files spanning both server and client roles:
mcppackage: 20,jsonrpcpackage: 6)mcp.NewServer,mcp.AddTool(generic),mcp.StdioTransport,mcp.NewStreamableHTTPHandler,mcp.NewClient,mcp.CommandTransport,mcp.StreamableClientTransport,jsonrpc.ErrorServer-side (
pkg/cli/mcp_server*.go,mcp_tools_*.go): Exposes 9 gh-aw commands as MCP tools with fullToolAnnotations(ReadOnly, Idempotent, Destructive, OpenWorld hints), emoji icons, and typed input structs.Client-side (
pkg/cli/mcp_inspect_mcp.go): Connects to external MCP servers (stdio and HTTP) declared in workflow files to inspect their tool/resource/root inventory.Parser (
pkg/parser/mcp.go): Usesmcp.Tool,mcp.Resource,mcp.Rootas data types in server inspection results.Research Findings
The module is under active daily development (10 commits in the last 7 days). v1.5.0 was released 2026-04-07.
Recent Updates (v1.5.0)
mcp_go_client_oauthbuild tag; standard backward compatibility now appliesCallToolResult(not JSON-RPC protocol errors), giving callers consistent structured outputmcp.Tool.OutputSchema— tools can now document their return shapeauth/extauthpackagehttp.ResponseControllerflush — ensures SSE writes are properly flushedBest Practices from SDK Maintainers
mcp.AddToolgeneric form (project already does this correctly)ToolAnnotationshints to help clients make safe decisions (project does this correctly)CallToolResult(notjsonrpc.Error) so LLMs receive consistent JSONListTools/ListResourcesviaNextCursorImprovement Opportunities
🏃 Quick Wins
Dead code:
http.DefaultTransport == nilguard (mcp_inspect_mcp.go:249)http.DefaultTransportis nevernilin the standard library. The nil-guard around creating a fallbackhttp.Transport{}is unreachable and can be removed.Add
Annotations.Titleto tool registrationsThe
mcp.ToolAnnotations.Titlefield provides a human-readable display name separate fromtool.Name. None of the 9 registered tools set this. MCP client UIs (e.g., Claude Desktop) use this for cleaner display. Example:Title: "Compile Workflows"for thecompiletool.OutputSchemafor JSON-returning toolsstatus,compile,checks,audit, andlogsall return well-defined JSON structures. Addingmcp.Tool{OutputSchema: ...}documents the response shape for MCP client tooling and enables validation. The project already usesGenerateSchema[T]()for inputs — the same mechanism applies to outputs.✨ Feature Opportunities
Progress reporting for
logsandaudittoolsThese tools can run for minutes (up to the configured timeout). The SDK supports emitting progress notifications via
req.Params.Meta.ProgressToken. Callers that pass a progress token (like Claude Desktop) would see live download progress instead of a hung tool call.Expose workflow status as an MCP Resource
The
statustool returns a list of workflow states — a natural fit for an MCP Resource that clients can subscribe to for updates. Resources support URI-based access and change notifications, enabling richer integration with AI agents.📐 Best Practice Alignment
Error protocol consistency
Post-v1.5.0, input validation errors should be tool results (not JSON-RPC errors). The project is partially consistent:
validateMCPWorkflowNamereturns aCallToolResult, but missing required params like emptypr_numberorrun_ids_or_urlsreturnjsonrpc.Error. The distinction: protocol errors (malformed JSON-RPC) vs. domain errors (user provided bad input). Domain errors should always beCallToolResultfor consistent LLM consumption.createMCPServersilent failureWhen
registerCompileToolorregisterLogsToolfail (schema generation error),createMCPServerreturns a partially-registered server. The caller (runMCPServer) gets a server with zero tools silently. Returning an error would let the process exit clearly rather than start an empty server.Inspector deduplication
connectStdioMCPServerandconnectHTTPMCPServershare ~80% logic: connect →ListTools→ListResources→extractRoots. Extracting a sharedqueryServerCapabilities(ctx, session)helper would reduce copy-paste and make pagination fixes apply to both transports.Pagination in
ListTools/ListResourcesBoth inspector functions call
ListTools/ListResourcesonce without followingNextCursor. Servers with more tools than the default page size will appear truncated with no warning. A simple loop untilNextCursor == ""would fix this.Recommendations (Prioritized)
http.DefaultTransport == nilOutputSchemato JSON-returning toolsAnnotations.Titleto all 9 toolsListTools/ListResourcesin inspectorlogs/auditqueryServerCapabilitiesshared helperNext Steps
http.DefaultTransport == nilguard inconnectHTTPMCPServernewMCPErrorcall sites — categorize as protocol vs. domain errors and convert domain ones to tool resultsTool.OutputSchemafor compile, checks, audit toolsAnnotations.Titleto all tool registrationsconnectStdioMCPServer/connectHTTPMCPServerModule summary saved to:
scratchpad/mods/go-sdk.mdWorkflow run: §25042851927
References:
Beta Was this translation helpful? Give feedback.
All reactions