Repository navigation
Description
Description
opencode mcp list prints No MCP servers configured when the requested location has not finished booting, even though an MCP server is configured and connects a moment later. The command always queries the current directory (GET /api/mcp?location[directory]=<cwd>, no --directory flag) and treats an empty data array as "no servers configured". For a location the service has not loaded yet, that array is empty instead of reporting the configured server as starting, so the CLI reports the opposite of reality.
Plugins
Local plugin file: ~/.config/opencode/plugins/nono-sandbox.ts (no published plugins)
OpenCode version
v2.2.6 (Homebrew, latest channel)
Steps to reproduce
- Configure at least one MCP server in
~/.config/opencode/opencode.json(here: a localchrome-devtoolsserver). - Create a directory the background service has never seen and enter it:
mkdir /tmp/oc-cold && cd /tmp/oc-cold - Run
opencode mcp list->No MCP servers configured - Run it again immediately ->
○ chrome-devtools pending - Run it again ->
✓ chrome-devtools connected
The same cold-state race is visible directly on the API: GET /api/mcp?location[directory]=/tmp returned data: [] on the first call and the connected server on the next.
Expected Behavior
mcp list should distinguish "location still starting" from "no servers configured", either by waiting for MCP startup (Mcp.awaitStartup already exists in the core service) or by printing the configured servers with a pending/starting status.
Actual Behavior
Prints No MCP servers configured, exits 0, and reports the correct server only on subsequent runs.
Operating System
macOS 27.2.0 (Darwin arm64)
Terminal
Ghostty (TERM=xterm-256color, COLORTERM=truecolor), zsh
Additional Context
- Source of the message:
packages/cli/src/commands/handlers/mcp/list.tswrites it whenresponse.data.length === 0. - Source of the empty array:
GET /api/mcpis served from the per-location MCP runtime state inpackages/core/src/mcp/index.ts. On a location's first boot, entries are created asynchronously and initial connections are forked, so the route can answer[]before any server entry exists. - Observed in a normal session: the first
opencode mcp listprinted the empty message and the server log showedmcp connected server=chrome-devtools tools=32about one second later. - Related per-location behavior (not part of this bug, but adds confusion): the same config reports
disabledfor$HOMEandconnectedfor the project directory, becausedisconnect()sets a runtime status per location. - Reproduction is deterministic on a cold location, then stops reproducing once the location is warm.
Activity
opencodejr commentedon Nov 10, 2026
Thanks for the detailed report and for tracing it to
list.tsand the MCP state in core. I think this is a duplicate of #54192. It describes the same problem: on a directory the service hasn't loaded yet, the firstopencode mcp listgets an empty list from/api/mcpand printsNo MCP servers configured, and the next call lists the configured servers. That issue is still open, and #54191 proposes a fix that makes the request wait until the servers are registered.Possible duplicates and related issues, ordered from most to least likely:
mcp list(empty on the first call in a new directory, correct afterwards); still open, with a proposed fix in fix(server): wait for MCP handler readiness #54191opencode plugin listprints "No plugins found" on the first call per cold location #54654: the same startup problem, but inopencode plugin listmcp listnever shows the configured servers, even on later runs; related but not the samemcp list; related but it doesn't go away on a second callThe bot will close this issue as a duplicate in 1 day unless you reply explaining how your problem is different. If it's the same, a comment on #54192 that it still happens on v2.2.6 on macOS would help. Your separate point about
disabledvsconnectedper location may deserve its own issue if nothing covers it yet.neriousy commentedon Nov 10, 2026
Thanks for the report. This is the same issue as #54192, so we're tracking it there. Closing as a duplicate. Please add any extra details on #54192.
opencodejr commentedon Nov 11, 2026
Closing this as a duplicate of #54192, since there's been no reply in the past day saying how it's different. Both describe the same problem: in a directory the service hasn't loaded yet, the first
opencode mcp listprintsNo MCP servers configured, and later calls list the servers. #54192 is still open, and #54191 proposes a fix that makes the request wait until the servers are registered.Please follow #54192 for updates. A comment there that it still happens on v2.2.6 on macOS would help. If your case turns out to be different, reply here and we can reopen. The separate
disabledvsconnectedper-location behavior you mentioned may be worth its own issue. Thanks again for the detailed report.