Skip to content

cli: mcp list says "No MCP servers configured" before a location boots #63053

Closed as duplicate

Description

@brownjedi

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

  1. Configure at least one MCP server in ~/.config/opencode/opencode.json (here: a local chrome-devtools server).
  2. Create a directory the background service has never seen and enter it: mkdir /tmp/oc-cold && cd /tmp/oc-cold
  3. Run opencode mcp list -> No MCP servers configured
  4. Run it again immediately -> ○ chrome-devtools pending
  5. 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.ts writes it when response.data.length === 0.
  • Source of the empty array: GET /api/mcp is served from the per-location MCP runtime state in packages/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 list printed the empty message and the server log showed mcp connected server=chrome-devtools tools=32 about one second later.
  • Related per-location behavior (not part of this bug, but adds confusion): the same config reports disabled for $HOME and connected for the project directory, because disconnect() sets a runtime status per location.
  • Reproduction is deterministic on a cold location, then stops reproducing once the location is warm.

Activity

  1. opencodejr commented on Nov 10, 2026

    @opencodejr
    Contributor

    Thanks for the detailed report and for tracing it to list.ts and 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 first opencode mcp list gets an empty list from /api/mcp and prints No 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:

    The 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 disabled vs connected per location may deserve its own issue if nothing covers it yet.

  2. neriousy commented on Nov 10, 2026

    @neriousy
    Member

    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.

  3. opencodejr commented on Nov 11, 2026

    @opencodejr
    Contributor

    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 list prints No 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 disabled vs connected per-location behavior you mentioned may be worth its own issue. Thanks again for the detailed report.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions