Skip to content

Add structured logging to MCP transport - #1772

Open
gearnode wants to merge 3 commits into
mainfrom
cursor/add-mcp-logger-388c
Open

Add structured logging to MCP transport#1772
gearnode wants to merge 3 commits into
mainfrom
cursor/add-mcp-logger-388c

Conversation

@gearnode

@gearnode gearnode commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

Summary

  • adapt the application logger to the standard slog API used by the MCP SDK
  • wire a named transport logger into the streamable HTTP handler
  • preserve log levels, attributes, nested groups, and request contexts through the adapter
  • cover the transport logging behavior with a focused unit test

Testing

  • go test ./pkg/server/api/mcp/mcputils ./pkg/server/api/mcp/v1
  • go vet ./pkg/server/api/mcp/mcputils ./pkg/server/api/mcp/v1

Linear Issue: ENG-772

Open in Web Open in Cursor 

Summary by cubic

Adds structured logging to the MCP transport so SDK logs flow through our standard logger instead of being dropped. Old behavior: nil logger; new behavior: a named transport logger using slog preserves levels, attrs, and nested groups; no change to request handling. Addresses ENG-772.

MCP +117 -1

  • Adds mcputils.NewSlogLogger, adapting go.gearno.de/kit/log to slog with WithAttrs and nested WithGroup.
  • Wires logger.Named("transport") into the MCP v1 streamable HTTP handler.
  • Preserves context, attributes, and group structure when forwarding records.

Tests +70 -0

  • Adds a unit test that asserts level, message, logger name, attributes, and nested groups are preserved and encoded.
  • Focuses the adapter test on MCP behavior and drops testing/slogtest usage.

Written for commit 1b6dbf7. Summary will update on new commits.

Review in cubic

cursoragent and others added 3 commits August 25, 2026 07:42
Signed-off-by: Cursor Agent <cursoragent@cursor.com>

Co-authored-by: Bryan FRIMIN <bryan@frimin.fr>
Signed-off-by: Cursor Agent <cursoragent@cursor.com>

Co-authored-by: Bryan FRIMIN <bryan@frimin.fr>
Signed-off-by: Cursor Agent <cursoragent@cursor.com>

Co-authored-by: Bryan FRIMIN <bryan@frimin.fr>
@gearnode
gearnode marked this pull request as ready for review August 25, 2026 07:45
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.

2 participants