PRODUCTION SCENARIO
A developer wraps an internal script as a stdio MCP server. The client reports parse errors on connection, and the script's startup banner and debug messages are printed with print statements.
What must change?
Answering here is anonymous. Nothing is saved unless you sign in.
Show answer and explanation
Answer: Send logs to stderr, since stdout must carry only valid MCP messages
The stdio transport spec says the server may write UTF-8 strings to stderr for any logging purpose but must not write anything to stdout that is not a valid MCP message. Messages are newline-delimited JSON-RPC, so a banner on stdout corrupts the stream.