[log] Add debug logging to HTTP transport client helpers#9874
[log] Add debug logging to HTTP transport client helpers#9874github-actions[bot] wants to merge 2 commits into
Conversation
Add meaningful debug logging to previously unlogged functions in internal/mcp/http_transport_client.go: - headerInjectingRoundTripper.RoundTrip: log header injection per request (method, host, header count) for tracing custom auth flows - resolveBaseTransport: log which transport is resolved (existing or DefaultTransport) during client construction These logs are gated by the DEBUG env var (namespace 'mcp:http_transport_client') and write to both stderr (colored) and the file log when enabled. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Adds debug visibility to HTTP client transport helpers.
Changes:
- Logs custom header injection context.
- Logs base transport selection.
Show a summary per file
| File | Description |
|---|---|
internal/mcp/http_transport_client.go |
Adds HTTP transport debug logging. |
Review details
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 1/1 changed files
- Comments generated: 1
- Review effort level: Medium
| } | ||
|
|
||
| func (rt *headerInjectingRoundTripper) RoundTrip(req *http.Request) (*http.Response, error) { | ||
| logHTTP.Printf("Injecting %d custom header(s) into request: method=%s, url=%s", len(rt.headers), req.Method, req.URL.Host) |
🔒 mcpg Read-Only Stress — gVisorSurface coverage: MCP tool calls + proxied CLI (REST) + GraphQL mutations
Notes:
Overall: PASS References: §29967290436
|
🔒 mcpg Read-Only Stress — default AWFSurface coverage: MCP tool calls + proxied CLI (REST) + GraphQL mutations
Overall: PASS Full ReportPart B DetailAll 7 write MCP tools returned gateway-level Part D & E DetailThe References: §29967290510
|
🔒 mcpg Read-Only Stress — docker-sbxSurface coverage: MCP tool calls + proxied CLI (REST) + GraphQL mutations
Overall: PASS Full ReportPart B detail: The gateway enforces read-only by stripping all write tools from its MCP tool registry. Every write attempt returned Parts D & E: References: §29967290475
|
|
@copilot address review feedback |
Addressed in commit I added a file-local |
Summary
Adds meaningful debug logging to previously unlogged functions in
internal/mcp/http_transport_client.go.Changes
headerInjectingRoundTripper.RoundTrip: logs header injection context per request (method, host, header count) — helpful when tracing custom auth flows through SDK-managed transportsresolveBaseTransport: logs which transport is resolved (existing client transport orhttp.DefaultTransport) during HTTP client constructionThese logs are gated by the
DEBUGenv var under themcp:http_transport_clientnamespace and write to both stderr (colorized) and the file log when enabled.Testing
go test ./internal/mcp/passesgo build ./internal/mcp/succeedsWarning
Firewall blocked 1 domain
The following domain was blocked by the firewall during workflow execution:
awmgmcpgSee Network Configuration for more information.