You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have searched existing issues and this is not a duplicate
I understand this issue needs status:approved before a PR can be opened
Bug Description
OpenCode spawns independent MCP server processes for each session/project. With 5 MCP servers configured (context7, chrome-devtools, nimgen, grep_app, pencil), a single Desktop session creates 24 node processes consuming 1.8GB RAM. With 2+ projects active, this doubles to 48 processes / 3.6GB, causing system-wide crashes.
Steps to Reproduce
Configure 5 MCP servers in \opencode.jsonc\
Open 1 project in OpenCode Desktop → observe 24 MCP node processes
Open a 2nd project → observe 48 MCP node processes
System RAM exhausts → ReadableStream controller crash → server goes red/black
Expected Behavior
MCP servers should be shared across sessions (singleton pattern). One context7 process should serve all sessions, not one per session.
Actual Behavior
Each session spawns its own set of MCP servers. No deduplication or scope sharing exists.
this is the stdio-binds-to-client-lifecycle pattern, and every multi-session MCP host hits it. stdio servers have no notion of who's connected, so the host's only lever is spawn-a-child-per-session and kill it on session exit. N sessions across M projects = N×M process trees, and that MaxListenersExceededWarning is just each spawn re-registering exit/SIGINT/SIGTERM on the same parent. capping at 2-per-type treats the symptom. the structural fix is a broker owning one long-lived process per server config and multiplexing sessions over it with refcounted shutdown. http+sse sidesteps it entirely because connection and process are already separate.
Activity
github-actions commentedon May 29, 2026
This issue might be a duplicate of existing issues. Please check:
gabriel-ferraresi commentedon May 29, 2026
Cross-referencing existing issues
The bot flagged #26336, #26714, and #16320 as potential duplicates. Here's how this issue differs:
This issue provides:
If this is consolidated into #26336, the quantitative data and cleanup script from this issue should be preserved.
m13v commentedon May 30, 2026
this is the stdio-binds-to-client-lifecycle pattern, and every multi-session MCP host hits it. stdio servers have no notion of who's connected, so the host's only lever is spawn-a-child-per-session and kill it on session exit. N sessions across M projects = N×M process trees, and that MaxListenersExceededWarning is just each spawn re-registering exit/SIGINT/SIGTERM on the same parent. capping at 2-per-type treats the symptom. the structural fix is a broker owning one long-lived process per server config and multiplexing sessions over it with refcounted shutdown. http+sse sidesteps it entirely because connection and process are already separate.
github-actions commentedon Jul 29, 2026
To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.