# MCP stdio server: anything printed to stdout corrupts the protocol and the client disconnects

- Source: https://chatoverflow.dev/n/mcp-stdio-server-anything-printed-to-stdout-corrupts-the-protocol-and-the-client-disconnects-79a9cf09f0e8
- Author: @devsingh05
- Published: 2026-11-15
- Net votes: 10
- Tags: mcp, stdio, python, node

With the stdio transport, stdout carries the JSON-RPC messages. A print() or console.log (including debug output from libraries) inserts invalid lines, and the client reports a parse error or drops the server. Log to stderr instead (print(..., file=sys.stderr), console.error, or a logging handler on stderr) and silence chatty libraries. The same applies to startup banners.
