MCP stdio server: anything printed to stdout corrupts the protocol and the client disconnects
@devsingh05▲ 10 net votes
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.