[BUG] VS Code extension: deleting a conversation from history does not terminate its stdio MCP server (process orphans until full window restart)
Preflight Checklist
- [x] I have searched existing issues. This is related to but distinct from #45880 (concurrent CLI sessions multiplying servers), #61564 (Claude Desktop Local Agent Mode duplicate pool), and #66280 (Task-subagent-spawned servers). None covers the VS Code extension's delete-a-history-conversation path.
- [x] This is a single bug report.
What's wrong?
In the Claude Code VS Code extension, each session spawns its own stdio MCP server process. When a conversation is deleted from the history list (trashcan icon), its stdio MCP server is not terminated — the process orphans and keeps running (holding memory, plus a DB connection pool for any server that opens one). It persists for the entire lifetime of the VS Code window; only a full window restart reaps it.
Over a long-lived window where sessions are created and deleted across days, these orphaned servers accumulate. Observed: ~18 idle stdio server processes spanning many old/deleted sessions in a single never-restarted window; a full window restart dropped the count to 1 (the freshly-spawned session).
Scope — what is NOT being reported: switching away from a session without deleting it correctly keeps that session's server alive. That is desirable — users legitimately work across multiple sessions in parallel and switch back, and (per the docs) stdio servers are not reconnected automatically, so reaping on switch would break a session you return to. The defect is specifically that deletion — an unambiguous "this conversation is gone" signal — does not reap the server.
Steps to reproduce
- Configure any stdio MCP server in the VS Code extension.
- Open a Claude Code session; confirm one stdio server spawns:
ps -Ao pid,ppid,etime,command | grep <server-cmd>. - Delete that conversation from the history list (trashcan icon).
- Re-check — the stdio server process is still running (count unchanged).
- Repeat over time; orphaned servers accumulate monotonically.
- Fully restart the VS Code window — all orphaned servers are reaped (count drops to the freshly-spawned one).
Expected behavior
Deleting a conversation should terminate that conversation's stdio MCP server. A deleted conversation can never be reopened, so its server is pure garbage. (Switching away without deleting may keep it alive — that is fine.)
Note on a server-side workaround
Self-exit on stdin EOF would be the natural server-side mitigation, but because stdio servers are not reconnected automatically, a server that exits while a still-existing (merely switched-away) session might return would break that session. That is a further reason the reap belongs on the delete event specifically, client-side.
Environment
- Claude Code VS Code extension:
anthropic.claude-code2.1.168 (darwin-arm64) - Claude Code CLI: 2.1.84
- macOS 26.5 (25F71), Apple Silicon
This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗