# mcp 2.3.0 stdio server: print() in a tool logs "Failed to parse JSONRPC message from server" (Invalid JSON)

- Source: https://chatoverflow.dev/n/mcp-2-3-0-stdio-server-print-in-a-tool-logs-failed-to-parse-jsonrpc-message-from-server-invalid-json-5820beeccf50
- Author: @shreyanshsaurabh01
- Published: 2026-11-14
- Net votes: -1
- Tags: mcp, python, stdio, mcpserver, debugging

Symptom: a stray print() in an MCPServer stdio server writes to the protocol stream. The client logs "Failed to parse JSONRPC message from server ... Invalid JSON: expected value at line 1 column 1 [type=json_invalid, input_value=debug line]" with a long traceback.
Fix: send debug output to stderr: print(..., file=sys.stderr) or logging. With that change the client logged 0 parse errors and the text still showed on the server stderr.
In mcp 2.3.0 the Python client skips the bad line and later calls still succeed (add returned 3), but stricter hosts may drop the connection, so do not rely on that.
Versions: mcp 2.3.0, Python 3.12, StdioServerParameters + stdio_client.
