Upgrade go-sdk to v1.2.0 with enhanced observability and resource management#590
Merged
Upgrade go-sdk to v1.2.0 with enhanced observability and resource management#590
Conversation
- Upgraded modelcontextprotocol/go-sdk from v1.1.0 to v1.2.0 * Security fixes, bug fixes, MCP spec 2025-11-25 support * Session hijacking prevention, streamable transport improvements - Added Logger to StreamableHTTPOptions using slog adapter * Integrates SDK logging with project's logger framework - Added SessionTimeout (30 minutes) to StreamableHTTPOptions * Prevents resource leaks from idle connections - Updated Implementation.Version to use actual project version * Added SetClientGatewayVersion function in mcp package * Called from cmd.SetVersion to sync version across components Co-authored-by: lpcox <15877973+lpcox@users.noreply.github.com>
- Use strings.TrimSpace in SetClientGatewayVersion to prevent whitespace-only versions - Addresses code review feedback Co-authored-by: lpcox <15877973+lpcox@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Review Go module modelcontextprotocol/go-sdk
Upgrade go-sdk to v1.2.0 with enhanced observability and resource management
Feb 2, 2026
Collaborator
|
@copilot fix "make lint" errors |
- Removed unused 'strings' import from jsonl_logger_test.go - Fixed duplicate assert.New(t) call in TestLogRPCMessageJSONLDirectionTypes The parent function already creates the assert binding, so the subtest was attempting to call .New() on *assert.Assertions instead of the package - Applied gofmt formatting fixes Co-authored-by: lpcox <15877973+lpcox@users.noreply.github.com>
Contributor
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Go SDK v1.2.0 Upgrade and Configuration Enhancements ✅
Based on the Go Fan report for modelcontextprotocol/go-sdk, successfully implemented the following improvements:
✅ Priority 1 (Immediate) - Security & Observability
internal/server/transport.go)logTransportlogger instance for consistencyinternal/server/transport.go)✅ Priority 2 (Short-term) - Better Diagnostics
internal/mcp/connection.go)SetClientGatewayVersionfunction with whitespace validationcmd.SetVersionto sync version across componentsℹ️ Priority 3 (Optional Optimization)
✅ Code Quality & Security
📊 Changes Summary
📝 Notes
Original prompt
This section details on the original issue you should resolve
<issue_title>[go-fan] Go Module Review: modelcontextprotocol/go-sdk</issue_title>
<issue_description># 🐹 Go Fan Report: modelcontextprotocol/go-sdk
Module Overview
The official Go SDK for Model Context Protocol (MCP) servers and clients, maintained in collaboration with Google. This is the core dependency that enables gh-aw-mcpg to function as an MCP gateway, providing protocol implementation for stdio, HTTP, SSE, and streamable transports.
Repository: https://github.com/modelcontextprotocol/go-sdk
Stars: 3,745+ ⭐
Last Updated: 2026-02-02T07:05:15Z (Updated TODAY! 🎉)
Current Usage in gh-aw-mcpg
Version: v1.1.0 (from go.mod)
Files Using Module: 20 files across the codebase
Key APIs Used:
sdk.NewClient(),sdk.ClientSessionCommandTransport,StreamableClientTransport,SSEClientTransportNewStreamableHTTPHandler(),StreamableHTTPOptionsListTools(),CallTool(),ListResources(),ReadResource(),ListPrompts(),GetPrompt()Usage Breakdown
internal/mcp/connection.go): Client, session, transport managementinternal/server/transport.go): Streamable HTTP handler for MCP protocolinternal/server/routed.go,unified.go): Server initializationinternal/middleware/jqschema.go): Tool result processingResearch Findings
Recent Updates (Repository Updated TODAY!)
v1.2.0 (Latest Stable - 2025-12-22)
Major Features:
jsonrpc.Errorsentinel valuesUserIDinTokenInfofor session hijacking preventionv1.3.0-pre.1 (Latest Pre-release - 2026-01-27)
Performance Breakthrough 🚀:
New Features:
DisableListeningoption forStreamableClientTransport(reduce resource usage)GetErrorandSetErrormethods for error manipulationBest Practices from Maintainers
ServerOptions.LoggerandClientOptions.Loggerfor integrated loggingStreamableHTTPOptions.SessionTimeoutto prevent resource leaksDisableListening: trueif server notifications aren't neededjsonrpc.Errorcodes for interoperabilityImplementation.Versionfor debuggingUserIDinTokenInfoto prevent session hijacking (v1.2.0+)Improvement Opportunities
🏃 Quick Wins
1. Upgrade to v1.2.0 (Stable Release) ⚡
Location:
go.modBenefit: Security fixes, bug fixes, MCP spec 2025-11-25 support
Risk: Low (mostly additive changes, well-tested in production)
Action:
go get -u github.com/modelcontextprotocol/go-sdk@v1.2.0Impact: HIGH - Security and stability improvements
Why Now: v1.2.0 includes session hijacking prevention, streamable transport bug fixes, and better error handling - all critical for a production gateway.
2. Add Logger to StreamableHTTPOptions ⚡
Location:
internal/server/transport.go:99Current:
Suggested:
Benefit: Integrate SDK logging with project's logger framework for better debugging
Impact: MEDIUM - Improved observability and debugging
3. Add SessionTimeout to StreamableHTTPOptions ⚡
Location:
internal/server/transport.go:99Suggested:
Benefit: Prevent resource leaks from idle connections
Impact: MEDIUM - Resource management and stability
4. Add DisableListening to StreamableClientTransport 💡
Location:
internal/mcp/connection.go:362Suggested:
Benefit: Reduce resource usage if server notifications aren't needed
...
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.