-
Notifications
You must be signed in to change notification settings - Fork 14.6k
Local (stdio) MCP processes leak — new processes spawned per session, never cleaned up #19168
Copy link
Copy link
Closed
Labels
coreAnything pertaining to core functionality of the application (opencode server stuff)Anything pertaining to core functionality of the application (opencode server stuff)perfIndicates a performance issue or need for optimizationIndicates a performance issue or need for optimization
Description
Description
Local MCP servers configured with "type": "local" (stdio transport) spawn a new process for every session opened, but the processes are never terminated when the session ends. Over time this leads to a large number of orphaned processes consuming significant memory.
Steps to reproduce
- Configure a local MCP in
opencode.json, e.g.:"firefox-devtools": { "type": "local", "command": ["npx", "@padenot/firefox-devtools-mcp", "--firefox-path", "..."] }
- Open and close several sessions in OpenCode Desktop or the web UI
- Check running processes:
ps aux | grep firefox-devtools-mcp
Expected behaviour
When a session ends, the stdio MCP child process it spawned should be terminated.
Observed behaviour
Each session spawns a new npm exec + node process pair. After ~12 sessions, 24 orphaned processes were running consuming ~1.2GB RSS combined. They are never cleaned up until the host process is restarted or they are killed manually.
Plugins
opencode-pty, opencode-wakatime
OpenCode version
v1.3.0
Operating System
macOS (Apple Silicon)
Terminal
Ghostty
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
coreAnything pertaining to core functionality of the application (opencode server stuff)Anything pertaining to core functionality of the application (opencode server stuff)perfIndicates a performance issue or need for optimizationIndicates a performance issue or need for optimization