[BUG] MCP servers connect successfully then get torn down with no reconnect on resumed sessions
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report (please file separate reports for different bugs)
- [x] I am using the latest version of Claude Code
What's Wrong?
Bug: MCP servers connect successfully then get torn down with no reconnect, specific to resumed sessions
Environment
- Claude Code VS Code extension v2.1.220 (win32-x64)
- Windows 11 Pro 10.0.26200
- MCP servers affected:
glsuite,mssql(both custom stdio Python servers defined in project.mcp.json) — but the pattern looks server-agnostic; it happened to both simultaneously.
Summary
On a resumed chat session, MCP servers connect successfully and report tools available, then are deliberately torn down by the extension ~3 seconds later. The log says it clears the connection cache "for reconnection," but no reconnection attempt is ever logged again for the rest of the session — leaving all MCP-provided tools permanently unavailable (ToolSearch reports "none found" for any MCP tool name) until the user starts a brand-new (non-resumed) chat.
Suspected mechanism
On startup, the extension spawns two Claude child processes: one throwaway instance used only to warm the config cache ("Loading config cache by launching Claude (no channel)...", resume: undefined), and one for the actual resumed session (resume: <session-id>). Both independently start and successfully connect to the same MCP servers. Shortly after, the throwaway instance's cleanup path issues "Terminating MCP server process tree" — but this appears to tear down (or otherwise invalidate) the connection state needed by the real resumed session too, and the subsequent "reconnection" it logs intending to do never fires.
A brand-new (non-resumed) chat does not exhibit the dual-spawn + teardown pattern and connects normally, which points at the resume code path specifically (likely the interaction between the config-cache warm-up spawn and the resumed-session spawn) rather than anything server- or config-specific.
Impact
Every MCP-provided tool (in this case glsuite, mssql, plus presumably github, sharepoint, browser, chrome-devtools, playwright per the same .mcp.json) is unavailable for the entire duration of a resumed session after this happens, with no user-facing error explaining why — it just reports tools as not found. Confirmed workaround: starting a new chat session (no resume) restores normal MCP connectivity immediately.
What Should Happen?
Resuming should not terminate MCP servers
Error Messages/Logs
### Log evidence
From `Anthropic.claude-code.Claude VSCode.log` (timestamps same session, `window1/exthost/Anthropic.claude-code/`):
15:03:24.674 MCP Server running on port 38966 (localhost only)
15:03:26.874 Loading config cache by launching Claude (no channel)...
15:03:33.117 Spawning Claude with SDK query function ... permission mode: default, resume: undefined
15:03:33.128 Spawning Claude with SDK query function ... permission mode: acceptEdits, resume: <session-id> <- this is the resumed chat
...
15:03:34.125 MCP server "glsuite": Starting connection with timeout of 30000ms
15:03:34.166 MCP server "mssql": Starting connection with timeout of 30000ms
15:03:34.170 MCP server "glsuite": Starting connection with timeout of 30000ms <- second instance (dup spawn)
15:03:34.216 MCP server "mssql": Starting connection with timeout of 30000ms <- second instance (dup spawn)
...
15:03:37.640 MCP server "mssql": Successfully connected (transport: stdio) in 3476ms
15:03:37.640 MCP server "mssql": Connection established with capabilities: {"hasTools":true, ...}
15:03:37.696 MCP server "mssql": Successfully connected (transport: stdio) in 3484ms
15:03:37.697 MCP server "mssql": Connection established with capabilities: {"hasTools":true, ...}
15:03:37.758 MCP server "glsuite": Successfully connected (transport: stdio) in 3640ms
15:03:37.758 MCP server "glsuite": Connection established with capabilities: {"hasTools":true, ...}
15:03:37.764 MCP server "glsuite": Successfully connected (transport: stdio) in 3601ms
15:03:37.785 MCP server "glsuite": Connection established with capabilities: {"hasTools":true, ...}
...
15:03:40.578 MCP server "glsuite": Terminating MCP server process tree
15:03:40.590 MCP server "mssql": Terminating MCP server process tree
...
15:03:41.166 MCP server "mssql": UNKNOWN connection closed after 3s (cleanly)
15:03:41.167 MCP server "mssql": Cleared connection cache for reconnection
15:03:41.179 MCP server "glsuite": UNKNOWN connection closed after 3s (cleanly)
15:03:41.180 MCP server "glsuite": Cleared connection cache for reconnection
No further line containing `glsuite`, `mssql`, or `reconnect` appears anywhere later in the same log file, including at:
15:04:40.772 ToolSearchTool: select failed — none found: glsuite_export_task, glsuite_get_task_attachments, glsuite_get_task_spec, mssql_connect
— a minute after the teardown, in the same (resumed) session, with the reconnection that was "cleared for" never actually attempted.
Steps to Reproduce
Repro
- Have an existing chat session with MCP servers configured in
.mcp.json. - Fully quit VS Code (all windows) and relaunch, resuming the prior session.
- Observe: MCP tools are unavailable in the resumed session (
ToolSearchfinds nothing), even though nothing about the servers, config, or environment changed. - Workaround: start a new chat instead of resuming — MCP tools connect and stay available normally.
Claude Model
Sonnet (default)
Is this a regression?
Yes, this worked in a previous version
Last Working Version
_No response_
Claude Code Version
2.1.220
Platform
Anthropic API
Operating System
Windows
Terminal/Shell
Other
Additional Information
_No response_