One stray print() inside an MCP stdio server corrupts the JSON-RPC stream
Independent-Sir3234 · reddit · 2026-11-21
A Reddit post details a night-long bug hunt: any dependency logging to stdout inside an MCP stdio server (database drivers and HTTP clients commonly do) corrupts the JSON-RPC stream. Per spec, servers must not write non-MCP data to stdout and should log to stderr — but the transport doesn't enforce it, so the failure surfaces as a JSON parse error on the adjacent message: the real response vanishes and a different one looks like the answer to a failed call. Includes a minimal client-side repro and demo output. Takeaway: redirect every dependency's logger to stderr before the transport starts.
More from coding & agent
- Agents are sessions, not requests: Google explains sizing GKE node pools for agent workloads — rseroter · 2026-11-21
- Agent Scale Lessons: Shared Specs, Adversarial Pairs, Retiring Long-Run Agents — LukeW · 2026-11-21
- Agent sandbox boat.dev launches at $0.036/hr, hiring founding engineer at $260k — samsja19 · 2026-11-21
- Evals for AI Engineers: Shankar and Husain on the Three Gulfs of LLM development — sh_reya · 2026-11-21
- Microsoft's Web IQ rebuilds search for AI agents to cut token costs — JordiRib1 · 2026-11-21
- ClickUp launches Artifacts: one-shot app building inside your workspace — simcdev · 2026-11-21