Skip to content

cli: mcp list prints "No MCP servers configured" when a location's MCP catalog is not ready #55074

Closed as duplicate

Description

@sequico

Description

opencode mcp list prints No MCP servers configured even though MCP servers are
configured and connected. At the same moment, GET /api/mcp on the same running
service returns those servers as connected, so the message is wrong, not the
configuration:

$ opencode mcp list
No MCP servers configured

$ curl -s http://127.0.0.1:49374/api/mcp
{"location":{"directory":"<dir>"},"data":[{"name":"...","status":{"status":"connected"}}, ...]}

It looks like the catalog is resolved per location (the directory the command is run
from) and per service instance, and the CLI gives up before the catalog is ready: the
first mcp list for a directory that has never been used as a location prints the
empty message, and the call right after prints the full list. The same happens right
after opencode service restart (first call empty, second call complete), and a second
opencode serve instance that has not served a session yet answers /api/mcp with an
empty list while using the same global configuration.

Expected: list the configured servers with their current state (connected, pending,
failed), or say the catalog is still loading. Reporting that no servers are configured
when several are is misleading and leads to a wrong diagnosis.

Plugins

None configured (~/.config/opencode/plugins/ is empty; no plugin entry in the config).

OpenCode version

2.0.28 (install channel: latest). The same behaviour was observed on 2.0.27.

Steps to reproduce

  1. Configure MCP servers in the global ~/.config/opencode/opencode.jsonc (six here:
    remote HTTP and local stdio, one of them a local server started with npx -y).
  2. In a directory already used as a location, opencode mcp list returns all of them
    with their state (all connected) — this is the normal, working case.
  3. Run opencode mcp list from a directory that has never been used as a location, or
    right after opencode service restart.
  4. Observe No MCP servers configured.
  5. Run the same command again (roughly a minute later, once the catalog is built): the
    full list appears.
  6. With a local server that has to index the project on its first connection, the first
    call shows it as pending and a later call as connected, so the state is available:
    it is only reported late as "no servers configured".

Screenshot and/or share link

Not applicable — the CLI output is included in the description above.

Operating System

Linux 7.2.6+deb13-amd64 (Debian 13 / trixie base), x86_64; shell /bin/bash.

Terminal

GNOME Terminal on X11, TERM=xterm-256color, COLORTERM=truecolor.

Activity

  1. opencode-agent commented on Oct 13, 2026

    @opencode-agent
    Contributor

    Thanks for the detailed report! I think this is a duplicate of #54192. It describes the same problem: the MCP HTTP handlers read the registry before the config plugins have registered the servers for a location that hasn't been used yet. The first opencode mcp list (and GET /api/mcp) then comes back empty, and a later call lists the servers. Your cases (a new directory, right after opencode service restart, a fresh opencode serve instance) all start from that same cold state.

    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.

  2. Genic-ai commented on Oct 14, 2026

    @Genic-ai

    Additional data point: in our setup the empty output is not transient and does not recover on a second call.

    Environment: 2.0.28, Linux. The background/shared service is disabled systemwide (opencode service set disabled true); one private server per invocation (no opencode pair). Version observed on 2.0.28 only.

    Clean-room repro (no existing config, no location history, single local stdio server):

    // /tmp/mcptest/opencode.json
    {
      "$schema": "https://opencode.ai/config.json",
      "mcp": {
        "servers": {
          "dummy_test_server": {
            "type": "local",
            "command": ["/bin/echo", "hello"],
            "disabled": false
          }
        }
      }
    }
    $ cd /tmp/mcptest && opencode mcp list
    No MCP servers configured
    
    $ cd /tmp/mcptest && opencode debug config | grep dummy_test_server
    "dummy_test_server": {
    
    $ cd <repo-root> && opencode mcp list          # 6 servers configured here
    No MCP servers configured

    Notes from our runs:

    • Repeating the command from the same directory keeps returning the empty message. Three
      independent sessions spread over roughly two hours all saw the empty output, so the
      "first call empty, second call complete" behaviour described above does not apply here.
    • A sub-directory CWD behaves the same as the repo root.
    • Overriding XDG_CONFIG_HOME to an isolated directory does not change the output.
    • opencode mcp list --help offers no --standalone/--server, which matches cli: mcp/plugin/debug subcommands reject --standalone and spawn a detached service #53878
      (mcp/plugin/debug handlers resolve the server connection without args and spawn a
      detached service). Combined with a disabled shared service, the per-location MCP catalog
      appears to never become ready, so this may be the same root cause as cli: mcp/plugin/debug subcommands reject --standalone and spawn a detached service #53878 rather than a
      separate defect.

    Impact is diagnostic only: MCP tools are available in-session (e.g. graphify,
    scrapling tool calls succeed) and opencode debug config resolves the servers. mcp list
    is simply unusable as a verification path in this configuration - any MCP filter check has
    to fall back to debug config plus a real tool call.

  3. opencode-agent commented on Oct 14, 2026

    @opencode-agent
    Contributor

    We haven't heard back, so I'm closing this as a duplicate of #54192. Both report the same thing: on a location that hasn't been used yet, the first opencode mcp list / GET /api/mcp returns an empty list because it runs before the servers are registered. Please follow #54192 for updates. PR #54191 proposes a fix and is still under review.

    Thanks again for the detailed report. If you find that your problem is different from #54192, reply here with the details and we can reopen this.

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