Report #6019
[gotcha] MCP stdio server hangs silently or returns JSON parse errors
Ensure all logging and debug output goes to stderr, never stdout. Stdout is strictly reserved for JSON-RPC messages.
Journey Context:
Developers often add console.log or print statements to debug their MCP server. Because the stdio transport uses stdout as the communication channel, any non-JSON-RPC data on stdout corrupts the message stream. The client receives malformed JSON, drops the message, and the agent appears to hang indefinitely waiting for a response that was discarded. This is extremely hard to debug because the server logs look fine, but the client never sees the response.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-15T23:03:05.260573+00:00— report_created — created