Skip to content

feat: [AG-101] migrate to official mcp go sdk#17

Draft
dan-arpino wants to merge 1 commit intomainfrom
feat/AG-101-migrate-to-official-mcp-go-sdk
Draft

feat: [AG-101] migrate to official mcp go sdk#17
dan-arpino wants to merge 1 commit intomainfrom
feat/AG-101-migrate-to-official-mcp-go-sdk

Conversation

@dan-arpino
Copy link
Contributor

Summary

Migrate from github.com/mark3labs/mcp-go v0.31.0 to the official github.com/modelcontextprotocol/go-sdk v1.2.0.

Key Changes

  • Server Creation: Updated to use mcp.NewServer() with Implementation struct instead of server.NewMCPServer()
  • Transport Handling:
    • Stdio: Changed to mcpServer.Run(ctx, &mcp.StdioTransport{})
    • SSE: Changed to mcp.NewSSEHandler(func(r *http.Request) *mcp.Server {...})
  • Tool Handlers: Updated signatures to accept *mcp.CallToolRequest (pointer)
  • Argument Extraction: Replaced request.GetArguments() with json.Unmarshal from request.Params.Arguments
  • Client Info: Updated to iterate through server.Sessions() instead of context extraction
  • Logging: Changed to session-based ss.Log() instead of SendNotificationToAllClients
  • Helper Functions: Added NewToolResultText(), NewToolResultError(), getRequestArguments(), ClientInfoFromSession()

Files Modified

File Description
go.mod, go.sum Updated dependency
internal/mcp/llm_binding.go Server creation, transport handling
internal/mcp/tools.go Tool handlers, argument extraction
internal/mcp/utils.go Helper functions
internal/logging/logger.go Session-based logging
internal/trust/trust.go Tool result creation
pkg/mcp/main.go Entry point updates
internal/mcp/*_test.go Updated tests for new SDK
internal/mcp/integration_test.go New integration tests
MCP_SDK_MIGRATION_NOTES.md Migration documentation

Test plan

  • All existing unit tests pass with new SDK
  • MCP spec conformance tests updated and passing
  • New integration tests for SDK migration
  • Manual testing of stdio transport
  • Manual testing of SSE transport
  • Test with actual MCP clients (Cursor, Claude Desktop)

Migrate from github.com/mark3labs/mcp-go v0.31.0 to the official
github.com/modelcontextprotocol/go-sdk v1.2.0.

Key changes:
- Update server creation to use mcp.NewServer() with Implementation struct
- Update transport handling for stdio (mcp.StdioTransport) and SSE (mcp.SSEHandler)
- Update tool handler signatures to accept *mcp.CallToolRequest (pointer)
- Replace request.GetArguments() with json.Unmarshal from request.Params.Arguments
- Update client info extraction to iterate through server.Sessions()
- Update logging to use session-based ss.Log() instead of SendNotificationToAllClients
- Add helper functions for tool results (NewToolResultText, NewToolResultError)
- Add comprehensive integration tests for the new SDK
- Add migration documentation (MCP_SDK_MIGRATION_NOTES.md)
@dan-arpino dan-arpino force-pushed the feat/AG-101-migrate-to-official-mcp-go-sdk branch from cbb03e5 to 36bf17d Compare February 3, 2026 13:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant