Description
When Claude Code sessions end (either by closing VSCode, switching workspaces, or the extension crashing), MCP server child processes are not terminated. This leads to accumulation of orphaned processes that consume significant CPU and RAM over time.
Observed behavior
After a day of normal Claude Code usage:
- 96 orphaned
conport-mcp Python processes consuming ~74% CPU combined
- 49 orphaned
claude native binary processes
Each MCP server process uses ~1-2% CPU continuously even when idle.
Expected behavior
When a Claude Code session ends, all spawned child processes (MCP servers) should be terminated.
Environment
- OS: macOS (Darwin 25.2.0, arm64)
- Claude Code version: 2.1.29 (VSCode extension)
- MCP server: ConPort (Python-based)
Suggested fixes
- Process groups: Spawn MCP servers in the same process group so they can be terminated together with the parent
- Signal handling: Ensure proper SIGTERM propagation to child processes on shutdown
- Watchdog: MCP servers could periodically check if their parent process is still alive
- Cleanup on startup: Detect and offer to kill orphaned processes from previous sessions
Workaround
Manual cleanup:
Reproduction
- Start Claude Code in VSCode
- Use features that spawn MCP servers (e.g., ConPort)
- Close VSCode window or switch workspace
- Check for orphaned processes:
ps aux | grep -E "(conport-mcp|claude.*native-binary)"
Description
When Claude Code sessions end (either by closing VSCode, switching workspaces, or the extension crashing), MCP server child processes are not terminated. This leads to accumulation of orphaned processes that consume significant CPU and RAM over time.
Observed behavior
After a day of normal Claude Code usage:
conport-mcpPython processes consuming ~74% CPU combinedclaudenative binary processesEach MCP server process uses ~1-2% CPU continuously even when idle.
Expected behavior
When a Claude Code session ends, all spawned child processes (MCP servers) should be terminated.
Environment
Suggested fixes
Workaround
Manual cleanup:
pkill -f "conport-mcp"Reproduction
ps aux | grep -E "(conport-mcp|claude.*native-binary)"