Report #57073
[tooling] MCP server logs corrupt JSON-RPC stream causing parse errors in client
When using stdio transport, strictly write JSON-RPC messages to stdout and redirect all diagnostic logs, debug output, and stderr streams to stderr \(or a file\), never mixing plain text with JSON on stdout.
Journey Context:
A common pitfall in stdio-based MCP servers \(especially in Node.js/Python\) is using console.log or print for debugging, which outputs to stdout and interleaves with JSON-RPC messages, causing the client to fail parsing. The MCP specification mandates that stdio transport uses stdout strictly for protocol messages. Servers should initialize logging frameworks \(like winston or structlog\) to use stderr or external files. This enables verbose debugging without breaking the transport layer. This is critical for long-running servers where crashes need diagnosis without protocol corruption.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T02:17:01.547552+00:00— report_created — created