Skip to content

MCP SDK v1.3.0: Add client logging and document schema caching#15127

Merged
pelikhan merged 3 commits intomainfrom
copilot/review-go-module-sdk
Feb 12, 2026
Merged

MCP SDK v1.3.0: Add client logging and document schema caching#15127
pelikhan merged 3 commits intomainfrom
copilot/review-go-module-sdk

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Feb 12, 2026

Implements Priority 1 improvements from Go Fan module review of modelcontextprotocol/go-sdk v1.3.0.

Changes

  • Add logger to MCP clients: Both stdio and HTTP inspection clients now configure ClientOptions.Logger using the existing mcpInspectServerLog instance. Enables DEBUG=cli:mcp_inspect_server observability for connection and protocol operations.

  • Document automatic schema caching: Added inline comment noting v1.3.0+ includes automatic schema caching (eliminates reflection overhead per SDK PR Hello from Claude #685). No code change needed; feature already active.

// Before
client := mcp.NewClient(&mcp.Implementation{Name: "gh-aw-inspector", Version: "1.0.0"}, nil)

// After
client := mcp.NewClient(&mcp.Implementation{Name: "gh-aw-inspector", Version: "1.0.0"}, &mcp.ClientOptions{
    Logger: logger.NewSlogLoggerWithHandler(mcpInspectServerLog),
})

Note: Investigated ErrSessionMissing sentinel (mentioned in Go Fan report) - not exported in v1.3.0, no string-based error checks requiring replacement found.

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: Model Context Protocol Go SDK

Module Overview

The Model Context Protocol (MCP) Go SDK is the official Go implementation for building MCP servers and clients. Maintained in collaboration with Google, it provides comprehensive support for creating AI agent tool interfaces with multiple transport options (stdio, HTTP/SSE, WebSocket).

Current Usage in gh-aw

Implementation Scale

  • 15+ files actively using the SDK
  • Primary server: 1023-line MCP server exposing 6+ tools
  • Client usage: Server inspection and management
  • Transport modes: Both stdio and HTTP/SSE supported

Key Integration Points

Server Implementation (pkg/cli/mcp_server.go):

server := mcp.NewServer(&mcp.Implementation{
    Name: "gh-aw",
    Version: GetVersion(),
}, &mcp.ServerOptions{
    Capabilities: &mcp.ServerCapabilities{
        Tools: &mcp.ToolCapabilities{
            ListChanged: false,
        },
    },
    Logger: logger.NewSlogLoggerWithHandler(mcpLog),
})

Tools Exposed:

  • status - Workflow status monitoring
  • compile - Workflow compilation with security scanning
  • fix - Automatic codemod application
  • inspect - Workflow/schema inspection
  • mcp-server-add - MCP server configuration
  • mcp-server-operations - Server management

Client Implementation (pkg/cli/mcp_inspect_mcp.go):

  • Stdio transport for command-based servers
  • HTTP/SSE transport with custom header support
  • Context-based timeout management (30s connect, 10s operations)
View Transport Details

Stdio Transport

client := mcp.NewClient(&mcp.Implementation{
    Name: "gh-aw-inspector",
    Version: "1.0.0"
}, nil)
transport := &mcp.CommandTransport{Command: cmd}
session, err := client.Connect(ctx, transport, nil)

HTTP/SSE Transport

transport := &mcp.StreamableClientTransport{
    Endpoint: config.URL,
}
// Custom headers via headerRoundTripper
session, err := client.Connect(ctx, transport, nil)

Research Findings

Recent SDK Updates (v1.3.0 - Feb 2026)

The latest release brings significant performance and reliability improvements:

🚀 Performance Enhancements

🔌 Transport Improvements

📝 Logger Modernization

🔒 Security & Quality

  • Localhost binding: Auth middleware now defaults to localhost (2026-02-11)
  • Go 1.25 synctest: Deterministic timing tests
  • JSON fix: ElicitationCapabilities field names corrected
  • Error export: ErrSessionMissing now accessible

Best Practices from Upstream

  1. Version Support Matrix: SDK tracks MCP spec version compatibility
  2. Conformance Testing: New test suite for spec compliance
  3. Structured Concurrency: Proper context cancellation patterns
  4. Schema-Driven: jsonschema tags for automatic schema generation
  5. Session Lifecycle: Always defer session.Close()

Improvement Opportunities

🏃 Quick Wins

1. Add Logger to Client Connections

Current State: Both client instantiations pass nil for options

// pkg/cli/mcp_inspect_mcp.go:162, 250
client := mcp.NewClient(&mcp.Implementation{...}, nil)

Recommended:

client := mcp.NewClient(&mcp.Implementation{...}, &mcp.ClientOptions{
    Logger: logger.NewSlogLoggerWithHandler(mcpInspectServerLog),
})

Impact: Better debugging and observability when inspecting MCP servers
SDK Feature: v1.3.0 modernized logger configuration

2. Verify Schema Caching is Active

Current: May be generating schemas repeatedly for the same types
SDK Feature: v1.3.0 adds automatic schema caching (PR #685)
Action: Verify the optimization is in effect (should be automatic)
Impact: Performance improvement, especially with multiple tool calls

3. Use Exported Error Sentinels

SDK Feature: v1.3.0 now exports ErrSessionMissing
...


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI and others added 2 commits February 12, 2026 11:15
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
- Add logger to stdio MCP client (connectStdioMCPServer)
- Add logger to HTTP MCP client (connectHTTPMCPServer)
- Add comment documenting automatic schema caching in v1.3.0+
- Improves debugging and observability when inspecting MCP servers

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title [WIP] Review Model Context Protocol Go SDK MCP SDK v1.3.0: Add client logging and document schema caching Feb 12, 2026
Copilot AI requested a review from pelikhan February 12, 2026 11:21
@pelikhan pelikhan marked this pull request as ready for review February 12, 2026 11:22
Copilot AI review requested due to automatic review settings February 12, 2026 11:22
@pelikhan pelikhan merged commit 855fefb into main Feb 12, 2026
@pelikhan pelikhan deleted the copilot/review-go-module-sdk branch February 12, 2026 11:22
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates the MCP inspection CLI clients to use the MCP SDK v1.3.0 logging hooks for better observability, and adds an inline note about go-sdk’s automatic schema caching behavior.

Changes:

  • Configure mcp.ClientOptions.Logger for both stdio and HTTP MCP inspection clients using the existing mcpInspectServerLog.
  • Add an inline comment in the MCP server noting go-sdk v1.3.0+ automatic schema caching.
  • Regenerate workflow compilation artifacts (action pin + workflow lock safe-outputs config changes).

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
pkg/cli/mcp_inspect_mcp.go Adds ClientOptions.Logger to stdio + HTTP MCP clients for debug/trace visibility.
pkg/cli/mcp_server.go Documents schema caching behavior in go-sdk v1.3.0+.
pkg/workflow/data/action_pins.json Adds a new action pin for actions/setup-go@v5.
.github/workflows/workflow-health-manager.lock.yml Updates generated safe-outputs handler config to include update_issue.allow_body:true.
.github/workflows/sub-issue-closer.lock.yml Updates generated safe-outputs handler config to include update_issue.allow_body:true.
.github/workflows/ci-doctor.lock.yml Updates generated safe-outputs handler config to include update_issue.allow_body:true.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 1099 to 1101
GH_AW_AGENT_OUTPUT: ${{ env.GH_AW_AGENT_OUTPUT }}
GH_AW_SAFE_OUTPUTS_HANDLER_CONFIG: "{\"add_comment\":{\"max\":20,\"target\":\"*\"},\"missing_data\":{},\"missing_tool\":{},\"update_issue\":{\"allow_status\":true,\"max\":20,\"target\":\"*\"}}"
GH_AW_SAFE_OUTPUTS_HANDLER_CONFIG: "{\"add_comment\":{\"max\":20,\"target\":\"*\"},\"missing_data\":{},\"missing_tool\":{},\"update_issue\":{\"allow_body\":true,\"allow_status\":true,\"max\":20,\"target\":\"*\"}}"
with:
Copy link

Copilot AI Feb 12, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This lockfile changes GH_AW_SAFE_OUTPUTS_HANDLER_CONFIG to include update_issue.allow_body:true, which is not described in the PR summary. Please confirm this generated safe-outputs config change is intended and either document it in the PR description or move workflow-compilation outputs into a separate PR.

Copilot uses AI. Check for mistakes.
Comment on lines 1288 to 1291
env:
GH_AW_AGENT_OUTPUT: ${{ env.GH_AW_AGENT_OUTPUT }}
GH_AW_SAFE_OUTPUTS_HANDLER_CONFIG: "{\"add_comment\":{\"max\":1},\"create_issue\":{\"close_older_issues\":true,\"expires\":24,\"labels\":[\"cookie\"],\"max\":1,\"title_prefix\":\"[CI Failure Doctor] \"},\"missing_data\":{},\"missing_tool\":{},\"update_issue\":{\"max\":1}}"
GH_AW_SAFE_OUTPUTS_HANDLER_CONFIG: "{\"add_comment\":{\"max\":1},\"create_issue\":{\"close_older_issues\":true,\"expires\":24,\"labels\":[\"cookie\"],\"max\":1,\"title_prefix\":\"[CI Failure Doctor] \"},\"missing_data\":{},\"missing_tool\":{},\"update_issue\":{\"allow_body\":true,\"max\":1}}"
with:
Copy link

Copilot AI Feb 12, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This lockfile now emits update_issue.allow_body:true in GH_AW_SAFE_OUTPUTS_HANDLER_CONFIG, which isn’t part of the MCP SDK logging/schema caching changes described in the PR. Please confirm this is an expected regeneration artifact and update the PR description (or split it out) so reviewers understand the intent.

Copilot uses AI. Check for mistakes.
Comment on lines +68 to +72
"actions/setup-go@v5": {
"repo": "actions/setup-go",
"version": "v5",
"sha": "40f1582b2485089dde7abd97c1529aa768e1baff"
},
Copy link

Copilot AI Feb 12, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR changes action_pins.json by adding a new pin for actions/setup-go@v5, but the PR description focuses on MCP SDK logging/schema caching. If this is an intended side-effect of running workflow recompilation (e.g., needed by daily-syntax-error-quality.md), please call it out in the PR description or split these workflow-compilation artifacts into a separate PR to keep the change set focused.

Copilot uses AI. Check for mistakes.
Comment on lines 1314 to 1316
GH_AW_AGENT_OUTPUT: ${{ env.GH_AW_AGENT_OUTPUT }}
GH_AW_SAFE_OUTPUTS_HANDLER_CONFIG: "{\"add_comment\":{\"max\":15},\"create_issue\":{\"expires\":24,\"group\":true,\"labels\":[\"cookie\"],\"max\":10},\"missing_data\":{},\"missing_tool\":{},\"update_issue\":{\"max\":5}}"
GH_AW_SAFE_OUTPUTS_HANDLER_CONFIG: "{\"add_comment\":{\"max\":15},\"create_issue\":{\"expires\":24,\"group\":true,\"labels\":[\"cookie\"],\"max\":10},\"missing_data\":{},\"missing_tool\":{},\"update_issue\":{\"allow_body\":true,\"max\":5}}"
with:
Copy link

Copilot AI Feb 12, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The generated workflow lock now includes update_issue.allow_body:true in GH_AW_SAFE_OUTPUTS_HANDLER_CONFIG. This is a behavior/permissions change (or at least a change to the emitted config) that isn’t mentioned in the PR description. Please confirm it’s intentional and document why it changed (or separate it from the MCP logging/schema-caching PR).

Copilot uses AI. Check for mistakes.
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.

[go-fan] Go Module Review: modelcontextprotocol/go-sdk

3 participants