Description
Local MCPs that worked in v1.1.16 fail to connect in v1.1.17 and later (tested with v1.1.19). When attempting to enable a local MCP via /mcp menu, the MCP shows as "failed" instead of "connected".
Environment:
Installation Method: npm (npm install in /srv/ai/open_code/)
Execution Method: Direct invocation of /srv/ai/open_code/node_modules/.bin/opencode
Node Version: v24.13.0 (installed via snap at /snap/bin/node)
Findings:
When starting the MCP server with NODE_DEBUG=* and DEBUG=*, I get the following in the logs:
STREAM 135231: read undefined
STREAM 135231: need readable true
while the command for starting the MCP server exits with code 0.
This leads me to believe that the following is happening with the MCP server:
- Loads successfully
- Starts listening on stdin
- Immediately receives undefined (EOF) when trying to read from stdin
- Exits cleanly with code 0
Probably indicating that OpenCode is closing stdin before the MCP server can read from it, or not properly piping stdin to the MCP server process.
Analyzing the code changes between v1.1.16 and v1.1.17:
- In v1.1.16:
The postinstall.mjs script called symlinkBinary() which created a direct symlink from .bin/opencode to the native Bun binary at node_modules/opencode-linux-x64/bin/opencode
- In v1.1.17:
The symlinkBinary() call was removed
The Node.js wrapper script at node_modules/opencode-ai/bin/opencode is now used instead
This wrapper uses child_process.spawnSync() with stdio: "inherit"
When executed via the wrapper script:
- Node.js wrapper spawns the native Bun binary with spawnSync(..., { stdio: "inherit" })
- The Bun binary attempts to spawn MCP subprocesses via StdioClientTransport
- The MCP subprocess receives EOF on stdin immediately and exits
The stdio inheritance chain appears to break somewhere between:
- Node.js wrapper → Bun binary → MCP subprocess
The MCPs can be enabled correctly when:
- Running the native Bun opencode binary directly (bypassing the Node.js wrapper) -
/srv/ai/open_code/node_modules/opencode-linux-x64/bin/opencode
- Running the MCP command manually from a terminal (terminal keeps stdin open)
Plugins
No response
OpenCode version
v1.1.17
Steps to reproduce
- Install opencode v1.1.17 with npm: npm install opencode-ai@1.1.17
- Configure a local MCP in ~/.config/opencode/opencode.json:
{
"mcp": {
"playwright-cdp": {
"type": "local",
"command": [
"node",
"/srv/ai/mcp/playwright/node_modules/@playwright/mcp/cli.js",
"--cdp-endpoint=http://localhost:9222"
],
"enabled": false
}
}
}
- Start opencode: /srv/ai/open_code/node_modules/.bin/opencode
- Type /mcp to open the MCP management menu
- Toggle the status of playwright-cdp from disabled to enabled
Screenshot and/or share link
Operating System
Ubuntu 24.04
Terminal
Gnome Terminal
Description
Local MCPs that worked in v1.1.16 fail to connect in v1.1.17 and later (tested with v1.1.19). When attempting to enable a local MCP via /mcp menu, the MCP shows as "failed" instead of "connected".
Environment:
Installation Method: npm (npm install in /srv/ai/open_code/)
Execution Method: Direct invocation of /srv/ai/open_code/node_modules/.bin/opencode
Node Version: v24.13.0 (installed via snap at /snap/bin/node)
Findings:
When starting the MCP server with NODE_DEBUG=* and DEBUG=*, I get the following in the logs:
while the command for starting the MCP server exits with code 0.
This leads me to believe that the following is happening with the MCP server:
Probably indicating that OpenCode is closing stdin before the MCP server can read from it, or not properly piping stdin to the MCP server process.
Analyzing the code changes between v1.1.16 and v1.1.17:
The postinstall.mjs script called symlinkBinary() which created a direct symlink from .bin/opencode to the native Bun binary at node_modules/opencode-linux-x64/bin/opencode
The symlinkBinary() call was removed
The Node.js wrapper script at node_modules/opencode-ai/bin/opencode is now used instead
This wrapper uses child_process.spawnSync() with stdio: "inherit"
When executed via the wrapper script:
The stdio inheritance chain appears to break somewhere between:
The MCPs can be enabled correctly when:
/srv/ai/open_code/node_modules/opencode-linux-x64/bin/opencodePlugins
No response
OpenCode version
v1.1.17
Steps to reproduce
Screenshot and/or share link
Operating System
Ubuntu 24.04
Terminal
Gnome Terminal