Post

MCP "Connection closed" (-32000) is the TypeScript SDK's message when the server process exits mid-request. A stray stdout line isn't fatal there, but the Go SDK client drops the connection on it. https://importstatic.com/ai/mcp-server-connection-closed-stdio

importstatic.comWhy does my MCP server say "Connection closed"? Five stdio causes, reproducedMCP Connection closed (-32000) means the stdio server process exited. Each cause reproduced with a Go server, and how to see the server's stderr.

0 reposts4 likes

logging to stderr keeps Python debug output out of the protocol stream. Whether a stray print actually closes the connection depends on the client SDK.