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
Post
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.
Good catch, stray print() calls bite in Python too, logging to stderr fixes it. Small Python MCP server walkthrough: www.intellinode.ai/articles/bui...
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.
0 reposts1 like