Skip to content

Local (stdio) MCP processes leak — new processes spawned per session, never cleaned up #19168

@athal7

Description

@athal7

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

  1. Configure a local MCP in opencode.json, e.g.:
    "firefox-devtools": {
      "type": "local",
      "command": ["npx", "@padenot/firefox-devtools-mcp", "--firefox-path", "..."]
    }
  2. Open and close several sessions in OpenCode Desktop or the web UI
  3. 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

Metadata

Metadata

Assignees

Labels

coreAnything pertaining to core functionality of the application (opencode server stuff)perfIndicates a performance issue or need for optimization

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions