Skip to content

MCP servers are per-Controller, causing N× process duplication when multiple tabs are open #3818

@ttmouse

Description

@ttmouse

Problem

When a user opens multiple conversation tabs (desktop) or switches between topics without closing previous ones, each tab gets its own control.Controller → own plugin.Host → own copy of every MCP server (codegraph, Nowledge Mem, user-configured plugins).

This means:

Tab 1 → Controller 1 → Host 1 → codegraph + Nowledge + other MCP
Tab 2 → Controller 2 → Host 2 → codegraph + Nowledge + other MCP
Tab 3 → Controller 3 → Host 3 → codegraph + Nowledge + other MCP

With 10 tabs and 3 MCP servers, that is 30 long-lived processes running simultaneously, each consuming memory, CPU, and potentially API connections.

Industry comparison

Tool MCP / LSP process model
Cursor (VS Code fork) Shared globally — single extension host, all Composer tabs share one set of MCP connections
Windsurf (VS Code fork) Shared globally — all Cascade conversations share one MCP client
Copilot Chat (VS Code) Shared globally — single extension host per window
Claude Code CLI One per CLI process (each claude invocation is independent by nature)
Reasonix (current) ❌ One per Controller — N× duplication

The industry standard for tabbed/multi-conversation tools is a shared MCP host — per-tab process isolation is not done by any major tool in this space.

Scope

Most MCP servers are read-only (codegraph, Nowledge Mem, database readers, etc.) — they serve the same data regardless of which conversation is asking. There is no correctness reason to duplicate them. The exception would be stateful MCP servers, but those are rare.

Possible approaches

  1. Elevate plugin.Host to application level — one shared host for all Controllers, each Controller gets a lightweight MCP client handle. Requires significant refactoring because boot.Build() currently owns the Host lifecycle.

  2. Lazy per-Controller MCP — only connect MCP servers on the active tab; suspend/disconnect when the tab loses focus, reconnect on focus. Smaller scope, solves the resource problem without a full architecture change.

  3. Configuration flag — let users decide: global_mcp = true (default) or per_session_mcp = false for cases where full isolation is needed.

Related

Performance impact

Each codegraph process uses ~100-300MB RSS (Node.js runtime). With 10 tabs that is 1-3GB just for code intelligence processes. Shared MCP host would bring this back to ~100-300MB total.

Metadata

Metadata

Assignees

No one assigned

    Labels

    mcpMCP servers / plugins (internal/plugin, codegraph)

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions