Skip to content

fix(serve-mcp): TelemetryRecorder migration, McpToolCallLogger, stdio tracing#67

Merged
deer merged 1 commit into
mainfrom
mcp_observability
Jun 22, 2026
Merged

fix(serve-mcp): TelemetryRecorder migration, McpToolCallLogger, stdio tracing#67
deer merged 1 commit into
mainfrom
mcp_observability

Conversation

@deer

@deer deer commented Jun 22, 2026

Copy link
Copy Markdown
Owner
  • JUL → TelemetryRecorder. McpServer drops java.util.logging entirely and routes all server-level output through a TelemetryRecorder injected via Builder.recorder(...).

  • Stdout pollution fix. The default recorder previously split output between System.out (info/diagnostic) and System.err (warn/error). In stdio mode System.out is the NDJSON protocol channel, so info and diagnostic output silently corrupted the stream. The default is now PrintStreamTelemetryRecorder.of(..., System.err, System.err). A new test reproduces the bug by redirecting System.out before building the server and asserting that every byte on the protocol stream is valid JSON.

  • Request/response tracing. dispatch() records a diagnostic before and after every handled method, giving stdio and HTTP callers a trace of what the server saw and responded to.

  • Clean EOF vs broken pipe. stdioLoop previously swallowed all IOExceptions silently. It now records an info event on clean EOF and a warn event (with the exception message) on any unexpected IOException.

  • McpToolCallLogger. New Subscriber<ToolCallEvent> that logs STARTED at diagnostic level, SUCCEEDED at info (or warn when the call exceeds the slow-call threshold, default 5 s), and FAILED at warn with the thrown exception. Attach manually via mcpServer.toolCallEvents().subscribe(McpToolCallLogger.of(recorder)) or enable at build time via Builder.logToolCalls(), which wires the logger to the server's own recorder automatically.

@deer deer changed the title feat(serve-mcp): TelemetryRecorder migration, McpToolCallLogger, stdio tracing fix(serve-mcp): TelemetryRecorder migration, McpToolCallLogger, stdio tracing Jun 22, 2026
@deer deer merged commit be0b75f into main Jun 22, 2026
2 checks passed
@deer deer deleted the mcp_observability branch June 22, 2026 03:34
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.

1 participant