stdio MCP servers are killed mid-session with no error output; all servers drop simultaneously
Environment: Claude Code 2.1.220 (native install), Windows 11, Node-based stdio MCP servers.
What happens
Every few tool calls, all configured stdio MCP servers disconnect at once. Their tools disappear from the session and come back only after running /mcp. This repeats indefinitely — it happened 8+ times over a single working session, several times in the middle of a tool call (MCP error -32000: Connection closed).
Evidence that the server itself is not at fault
I wrapped the server launch so its stderr is appended to a file, bypassing Claude Code entirely:
"command": "cmd",
"args": ["/c", "node <path-to-server>/dist/index.js 2>> <logfile>"]
After a disconnect the log contains only the two startup lines the server prints and nothing else:
NanoBanana MCP: Using model gemini-3.1-flash-image-preview
Gemini MCP server running on stdio
No exception, no stack trace, no API error — the server has nothing to say before it dies.
Additional observations:
- After a disconnect there is no server process left:
Get-Process nodereturns 0. So this is not a hung pipe with a live process — the process is gone. - The Windows Application event log has no error records for
node.exeover the same period, so it is not an abnormal termination either. It looks like a clean external kill. - Both configured MCP servers die at the same moment. They are unrelated packages and share nothing except being spawned by Claude Code, which points at the client tearing the connections down rather than at either server.
Ruled out
- Corrupt npx cache — one cache entry was genuinely broken (missing
package.json, causing-32000on reconnect); cleared, and startup failures stopped. The mid-session deaths continued. @latestresolution on every start — pinned to an exact version, then npx removed from the chain entirely by installing the package globally and launchingnode <entry>.jsdirectly. Deaths continued.- Duplicate Claude Code installations —
claude updatewarned about a leftover npm-global copy alongside the native one; removed on its own advice. Deaths continued. - Outdated version — 2.1.220 is current;
claude updatereports up to date. --debugproduced nothing about the death either.
Impact
Any long-running task that depends on an MCP tool has to be resumed by hand every few calls, and a call that is interrupted loses its work.
Expected
stdio MCP servers stay connected for the life of the session; if the client does terminate them, it says why.