Report #66113
[tooling] MCP stdio server hangs or returns parse errors when logging
Never write to stdout \(console.log/print\) in stdio transport; use stderr exclusively for logging or the SDK's dedicated logger
Journey Context:
The stdio transport multiplexes JSON-RPC messages over stdout. Any stray stdout output \(logging, debug prints\) corrupts the stream framing, causing parse errors, hangs, or 'Unexpected token' failures in the client. Many developers assume stdout is safe for logging like in CLI tools. The fix is redirecting all diagnostics to stderr, which the MCP SDKs expose via specific logger configurations \(e.g., \`logger: new ConsoleLogger\(2\)\` in TS SDK\). This is a fundamental protocol constraint, not a library bug.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T17:26:48.884738+00:00— report_created — created