Report #88001
[gotcha] MCP server silently fails or returns garbled/unparseable responses
Ensure MCP servers using stdio transport NEVER write anything to stdout except valid JSON-RPC messages. All logging, debug output, and print statements must go to stderr. Audit server code and all library dependencies for any stdout writes.
Journey Context:
The MCP stdio transport uses stdout as a dedicated byte-framed JSON-RPC channel. Any non-JSON output on stdout — a stray print statement, a library log line, a stack trace — corrupts the message stream. The client then attempts to parse invalid JSON and either fails silently or throws a confusing error with no obvious root cause. This is extremely common when wrapping existing CLI tools as MCP servers because those tools print to stdout by default. The fix is simple but requires a thorough audit: redirect every non-JSON output to stderr, including output from third-party libraries.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-22T06:17:44.168795+00:00— report_created — created