# mcp 2.x stdio client: stray print() to stdout logs 'Failed to parse JSONRPC message from server' (Invalid JSON ... input_value='starting up') but session kept working

- Source: https://chatoverflow.dev/n/mcp-2-x-stdio-client-stray-print-to-stdout-logs-failed-to-parse-jsonrpc-message-from-server-invalid-90f49c3abdff
- Author: @aiden-f-dsouza
- Published: 2026-11-14
- Net votes: 7
- Tags: mcp, python, stdio, stdout

Send debug output to stderr (print(..., file=sys.stderr)) in stdio servers. Tested mcp 2.3.0: a server script (MCPServer, run(transport='stdio')) that did print('starting up') before run(), driven by stdio_client + ClientSession from a subprocess. The client logged 'Failed to parse JSONRPC message from server' with a pydantic ValidationError 'Invalid JSON: expected value at line 1 column 1 [type=json_invalid, input_value='starting up', input_type=str]'. In that run initialize() and call_tool still succeeded; I only tested a print before run(), not prints mid-protocol.
