Conversation
Addresses #3633. Five log.Printf calls in internal/mcp/connection.go were either duplicating adjacent logger.LogInfo structured-log calls or writing to stderr with no structured counterpart: - Remove log.Printf at line 144 (duplicate of logger.LogInfo line 143) - Remove log.Printf "Connecting to MCP server..." (logConn.Print at line 149 already covers this at debug level) - Replace log.Printf "Started MCP server" (line 178) with logger.LogInfo so the event is captured in mcp-gateway.log - Remove log.Printf "Configured HTTP MCP server with streamable transport" (duplicate of logger.LogInfo line 240) - Remove log.Printf "Configured HTTP MCP server with plain JSON-RPC transport" (duplicate of logger.LogInfo line 263) Remove the now-unused "log" standard-library import from connection.go. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR removes redundant log.Printf calls in internal/mcp/connection.go to ensure MCP connection lifecycle events are logged consistently through the structured logger (and to drop the now-unused stdlib log import).
Changes:
- Removed duplicated
log.Printfmessages that mirrored adjacentlogger.LogInfocalls. - Replaced the stderr-only “Started MCP server …” message with a structured
logger.LogInfo. - Removed the unused
"log"import fromconnection.go.
Show a summary per file
| File | Description |
|---|---|
| internal/mcp/connection.go | Removes redundant stderr logging in favor of structured logging for MCP connection setup events. |
Copilot's findings
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 1/1 changed files
- Comments generated: 1
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This was referenced Apr 12, 2026
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.
🤖 This PR was created by Repo Assist, an automated AI assistant.
Addresses #3633.
Problem
internal/mcp/connection.gohad fivelog.Printfcalls that either duplicated adjacentlogger.LogInfostructured-log calls or wrote to stderr with no structured counterpart. This meant:mcp-gateway.logwould miss some events (e.g. "Started MCP server")"log"standard-library import persisted only to serve these callsChanges
log.Printf("Starting MCP server command: ...")logger.LogInfoon line 143 already covers thislog.Printf("Connecting to MCP server...")logConn.Print("Initiating MCP server connection and handshake")on the next line already covers this at debug levellog.Printf("Started MCP server: ...")logger.LogInfo("backend", "Started MCP server: ...")— now written tomcp-gateway.loglog.Printf("Configured HTTP MCP server with streamable transport: ...")logger.LogInfoon line 240 already covers thislog.Printf("Configured HTTP MCP server with plain JSON-RPC transport: ...")logger.LogInfoon line 263 already covers thisThe now-unused
"log"standard-library import is also removed.Test Status
go.modis unavailable in this environment (blocked by network firewall). All changes are mechanical deletions oflog.Printfcalls with no logic changes.go vetandmake testwill run in the GitHub Actions CI environment where Go 1.25.0 is available.Trade-offs
mcp-gateway.log. This is strictly better — it was a gap in structured logging.DEBUG=mcp:*throughlogConn.Closes #3633