Integrate project logger with MCP SDK ClientOptions and ServerOptions#1067
Merged
Integrate project logger with MCP SDK ClientOptions and ServerOptions#1067
Conversation
Co-authored-by: lpcox <15877973+lpcox@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Review Go Module modelcontextprotocol/go-sdk
Integrate project logger with MCP SDK ClientOptions and ServerOptions
Feb 19, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
This PR integrates the project's logger with the MCP SDK v1.3.0's ClientOptions and ServerOptions, enabling visibility into SDK internal operations through the gateway's debug logging system. Previously, empty options were passed, leaving SDK operations invisible in logs.
Changes:
- Added logger parameter to
newMCPClient()function with nil-safety check for test environments - Integrated logger with SDK
ClientOptionsfor all client connections - Integrated logger with SDK
ServerOptionsfor unified and routed mode servers
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| internal/mcp/connection.go | Modified newMCPClient() to accept logger parameter and pass it to SDK ClientOptions; updated all call sites to pass logConn |
| internal/mcp/connection_test.go | Updated test calls to pass nil logger and added new test TestNewMCPClientWithLogger to verify logger acceptance |
| internal/server/unified.go | Updated unified server creation to pass logger via ServerOptions |
| internal/server/routed.go | Updated filtered server creation to pass logger via ServerOptions |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
The MCP SDK v1.3.0 supports logger injection through
ClientOptionsandServerOptions, but the gateway was passing empty options (&sdk.ClientOptions{}) ornil, leaving SDK operations invisible in logs.Changes
Client creation (
internal/mcp/connection.go)newMCPClient()now accepts*logger.Loggerparameter*slog.Loggervialogger.NewSlogLoggerWithHandler()sdk.ClientOptions.LoggerServer creation (
internal/server/unified.go,internal/server/routed.go)sdk.ServerOptionsin unified modesdk.ServerOptionsin routed/filtered serversTests
nilto disable SDK logging in test environmentsTestNewMCPClientWithLoggerfor validationExample
Before:
After:
SDK internal operations now flow through the project's debug logging system (
DEBUG=*shows SDK activity).Warning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
example.com/tmp/go-build1436996487/b275/launcher.test /tmp/go-build1436996487/b275/launcher.test -test.testlogfile=/tmp/go-build1436996487/b275/testlog.txt -test.paniconexit0 -test.timeout=10m0s -test.v=true o s.go 64/pkg/tool/linu_x004.c credential.helpe/opt/hostedtoolcache/go/1.25.7/x64/pkg/tool/linux_amd64/vet(dns block)invalid-host-that-does-not-exist-12345.com/tmp/go-build1436996487/b260/config.test /tmp/go-build1436996487/b260/config.test -test.testlogfile=/tmp/go-build1436996487/b260/testlog.txt -test.paniconexit0 -test.timeout=10m0s -test.v=true go ac/hmac.go x_amd64/asm --depth 2 REDACTED x_amd64/asm conf�� g_.a HEHYCbGHr 64/pkg/tool/linux_amd64/compile user.name(dns block)nonexistent.local/tmp/go-build1436996487/b275/launcher.test /tmp/go-build1436996487/b275/launcher.test -test.testlogfile=/tmp/go-build1436996487/b275/testlog.txt -test.paniconexit0 -test.timeout=10m0s -test.v=true o s.go 64/pkg/tool/linu_x004.c credential.helpe/opt/hostedtoolcache/go/1.25.7/x64/pkg/tool/linux_amd64/vet(dns block)slow.example.com/tmp/go-build1436996487/b275/launcher.test /tmp/go-build1436996487/b275/launcher.test -test.testlogfile=/tmp/go-build1436996487/b275/testlog.txt -test.paniconexit0 -test.timeout=10m0s -test.v=true o s.go 64/pkg/tool/linu_x004.c credential.helpe/opt/hostedtoolcache/go/1.25.7/x64/pkg/tool/linux_amd64/vet(dns block)this-host-does-not-exist-12345.com/tmp/go-build1436996487/b284/mcp.test /tmp/go-build1436996487/b284/mcp.test -test.testlogfile=/tmp/go-build1436996487/b284/testlog.txt -test.paniconexit0 -test.timeout=10m0s -test.v=true -c=4 -nolocalimports -importcfg /tmp/go-build180286792/b223/importcfg -pack /home/REDACTED/work/gh-aw-mcpg/gh-aw-mcpg/internal/middleware/jqschema.go 64/pkg/include 64/s�� 64/src/runtime/cgo --global ache/go/1.25.7/x64/pkg/tool/linu--64 pull.rebase(dns block)/tmp/go-build2197604316/b284/mcp.test /tmp/go-build2197604316/b284/mcp.test -test.testlogfile=/tmp/go-build2197604316/b284/testlog.txt -test.paniconexit0 -test.timeout=10m0s -test.v=true ache/go/1.25.7/x64/src/runtime/c-p v5H2/gdzdyx1nTJ_thj3Av5H2 8085717/b189/(dns block)/tmp/go-build1032557839/b284/mcp.test /tmp/go-build1032557839/b284/mcp.test -test.testlogfile=/tmp/go-build1032557839/b284/testlog.txt -test.paniconexit0 -test.timeout=10m0s -test.v=true s mn4I/VW84qF8_Uqs9FMGXmn4I x_amd64/compile(dns block)If you need me to access, download, or install something from one of these locations, you can either:
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 modelcontextprotocol/go-sdk is the official Go SDK for Model Context Protocol servers and clients, maintained in collaboration with Google. This SDK provides comprehensive support for building MCP servers and clients in Go, including HTTP/SSE transport, stdio transport, tool/resource/prompt registration, and session management.
Repository: https://github.com/modelcontextprotocol/go-sdk
Version Used: v1.3.0 ✅ (Latest)
Last Updated: 2026-02-18 (Today!)
Stars: 3,875 ⭐
Current Usage in gh-aw-mcpg
Files & Import Statistics
NewServer(),AddTool(),NewStreamableHTTPHandler(),StreamableHTTPOptionsNewClient(),Connect(),ListTools(),CallTool()NewInMemoryTransports(), StreamableHTTP with session supportProduction Files
internal/server/transport.go- StreamableHTTP handler creationinternal/server/unified.go- Unified mode server implementationinternal/server/routed.go- Routed mode server implementationinternal/mcp/connection.go- Client connections to backend MCP serversinternal/testutil/mcptest/- Test infrastructure (3 files)Current Patterns
Server Creation:
Client Creation:
StreamableHTTP (Good!):
Research Findings
Recent Updates (v1.3.0 - Released 2026-02-09)
The project is using the latest version of the SDK! v1.3.0 includes significant improvements:
ClientOptionsBest Practices from SDK Maintainers
ClientOptionsandServerOptionsfor complete visibilityGetError/SetErrormethods for structured error contextStreamableHTTPwith timeouts (✅ already doing this!)SDK Features We're NOT Using
Improvement Opportunities
🏃 Quick Wins
1. Add Logger to ClientOptions ⭐ HIGH PRIORITY
&sdk.ClientOptions{}(empty)internal/mcp/connection.go:1652. Add Logger to ServerOptions ⭐ HIGH PRIORITY
sdk.NewServer(..., nil)(no options)internal/server/unified.go:136,internal/server/routed.go:1873. Validate Schema Caching Performance
✨ Feature Opportunities
1. Implement Resources API (Medium Complexity)
Opportunity: Expose gateway state as MCP resources
Potential Resources:
/config- Current gateway configuration/health- Gateway health status/metrics- Performance metrics/backends- Backend server status/sessions- Active session informationBenefit: Clients can query gateway state using ...
🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.