MCP processes are never torn down when Code sessions are idle — runaway process accumulation

Status Open
Reported on v2.1.218
Maintainer reply None cached
Activity 1 comment · opened Aug 4, 2026

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?

Every open Claude Code session spawns and holds a full set of MCP server processes for its entire lifetime, regardless of whether the session is actively being used. There is no teardown when a session goes idle or is backgrounded.

Combined with bug #75574 (double-init on launch spawning duplicate process generations), this causes rapid accumulation. On a machine with 16 open sessions and ~8 MCP servers each, we observed 130+ simultaneous MCP processes running continuously. The user has no in-product indication this is happening and no automatic mitigation.

What Should Happen?

MCP processes for idle/backgrounded sessions should be suspended or torn down automatically, and restarted on demand when the session becomes active again. At minimum, users should be warned in-product when open session count is causing excessive resource usage.

Error Messages/Logs

$ pgrep -fl 'mcp' | grep -v 'Claude Helper|Claude.app|monitor.sh' | wc -l
     136

Breakdown:
- 34 mcp-wordpress-remote processes
- 16 mcp-remote (anthemwild/rocket-net)
- 8 twilio-mcp
- 8 podio-mcp
- 8 n8n-mcp
- remainder: npm exec wrapper processes

Source: 16 open Code sessions × ~8 MCP servers each, compounded by #75574 double-init on every session load.

Steps to Reproduce

  1. Open Claude Code with 8+ MCP servers configured in ~/.claude.json
  2. Start multiple Code sessions (or leave sessions open over time without archiving)
  3. Run: pgrep -fl 'mcp' | grep -v 'Claude Helper|Claude.app' | wc -l
  4. Observe process count = (sessions × MCP server count × 2 due to #75574 double-init)

With 16 open sessions and 8 MCP servers: 130+ node processes running simultaneously, none ever cleaned up.

Claude Model

None

Is this a regression?

Yes, this worked in a previous version

Last Working Version

_No response_

Claude Code Version

2.1.218 (Claude Code)

Platform

Anthropic API

Operating System

macOS

Terminal/Shell

Terminal.app (macOS)

Additional Information

_No response_

View original on GitHub ↗

This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗