Orphaned MCP server processes not cleaned up when sessions end
Resolved 💬 6 comments Opened Feb 2, 2026 by johannesdb Closed Mar 10, 2026
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-mcpPython processes consuming ~74% CPU combined - 49 orphaned
claudenative 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:
pkill -f "conport-mcp"
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)"
This issue has 6 comments on GitHub. Read the full discussion on GitHub ↗