Per-session MCP server spawn multiplies RAM use — lazy spawn or per-session MCP scoping needed
Summary
Every Claude Code session — desktop app or scheduled task — boots the full set of user-scope MCP servers on startup, regardless of whether that session ever calls any of their tools. On a machine running several sessions at once, this multiplies into serious, avoidable RAM pressure.
Measured impact
Live measurement (31 Jul 2026, 32GB Windows laptop): 5 concurrent Claude Code sessions (identified by --model in the command line, to exclude Electron helper processes sharing the claude.exe binary name) were responsible for:
claude.exe: 27 processes / 7.86GBnode.exe(MCP server helpers): 46 processes / 4.86GBmsedgewebview2.exe(browser-automation MCP servers): 35 processes / 3.0GBpythonw.exe(a home-automation MCP server): 57 processes / 1.4GB
That's roughly 17GB consumed by MCP fan-out alone, out of 31GB total — for 5 sessions, several of which never touched a browser or the home-automation tool at all. Per-session cost works out to roughly 850MB-3GB depending on session type, and it scales linearly with open session count. This repeatedly starves other running apps (WhatsApp Desktop, Spotify) of memory, causing them to hang or become unresponsive.
Deferred tool loading already exists for tool schemas (a tool is listed by name but its full definition isn't fetched until requested via ToolSearch) — this request is asking for the same laziness to extend to the underlying MCP server process, not just its schema.
Requests (either would help; (1) is the bigger win)
- Lazy MCP server spawn. Don't start a configured stdio MCP server process until its first tool call is actually made in that session, rather than spawning every configured server unconditionally at session start.
- Expose per-session/per-task MCP scoping in the desktop app and its scheduled-task launcher, mirroring what the CLI already supports via
--mcp-config <file>and--strict-mcp-config. Today there's no way to tell the desktop app "this session/task only needs servers X and Y" — it always loads the full configured set.
Environment
- Claude Code desktop app, Windows 11
- ~30-60 user-scope MCP servers configured (mix of always-needed and rarely-needed)
- Reproducible on any machine running several concurrent sessions/scheduled tasks against the same MCP config