Skip to content

cli: mcp list ignores opencode.json in parent directories (debug config and sessions see it) #65522

Duplicate

Description

@apu357320-sudo

Summary

opencode mcp list only resolves servers from an opencode.json in the current
directory. When the config lives in a parent directory, mcp list prints
No MCP servers configured, even though opencode debug config in the same
directory shows that file as a loaded source and the server is fully usable in
the session.

Environment

  • opencode version: 2.3.2
  • OS: Windows 10.0.19045.6466 (win32 x64)
  • Terminal: xterm-256color (TERM_PROGRAM unset)
  • Shell: C:\Windows\system32\cmd.exe (launched from PowerShell 7)
  • Install/channel: latest, npm install of @opencode/cli
  • Active plugins: none found in config

Reproduction

Layout: a project root with a config file, and a nested working directory with no
config of its own.

C:\work\project\opencode.json          <- mcp.servers.<name> defined here
C:\work\project\sub\dir\               <- no opencode.json anywhere inside
  1. From the project root:

    > cd C:\work\project
    > opencode mcp list
    ✓ <name>  connected
    
  2. From the nested directory (still inside the project):

    > cd C:\work\project\sub\dir
    > opencode mcp list
    No MCP servers configured
    
  3. In that same nested directory, the config is resolved:

    > opencode debug config
    [
      { "type": "directory", "path": "C:\\Users\\<user>\\.config\\opencode" },
      {
        "type": "document",
        "path": "C:\\work\\project\\opencode.json",
        "info": { "mcp": { "servers": { "<name>": { "type": "local", "command": [ ... ] } } } }
      }
    ]
    
  4. Starting a session in C:\work\project\sub\dir works normally: the MCP
    server is connected and its tools are available. Only mcp list disagrees.

Expected Behavior

mcp list should report the servers from the same resolved configuration the
session uses, so it lists <name> (and its connection status) from any directory
under the project root.

Actual Behavior

From C:\work\project\sub\dir:

No MCP servers configured

while opencode debug config in the same directory lists
C:\work\project\opencode.json as a loaded document containing that exact
server. Reproducible every time; no service restart involved, and the result
does not change after opencode service restart.

Additional Context

Activity

  1. added
    area/mcp
    type/bug
    version/v2
    on Nov 22, 2026
  2. opencodejr commented on Nov 22, 2026

    @opencodejr
    Contributor

    Thanks for the detailed report. I tried this on Linux with the released v2.3.2: a project with an opencode.json at its root defining one local MCP server, and opencode mcp list run from a nested sub/dir with no config of its own.

    On Linux the subfolder did pick up the parent config. The first opencode mcp list in sub/dir printed No MCP servers configured, and every call after that listed the server (○ demo pending). The project root behaved the same way: empty on the first call, listed afterwards. That empty first call is the known startup race tracked in #54192. opencode debug config in sub/dir showed the parent opencode.json, as in your output.

    So the empty list on every call from a subfolder doesn't happen on Linux, and is probably specific to Windows. A maintainer with a Windows machine will need to look at it. One thing that may help them: from C:\work\project\sub\dir, run opencode mcp list a few times about 10 seconds apart and say whether it ever lists the server. It would also help to know whether the drive letter in your prompt is upper- or lower-case (C: vs c:).

    Related issues, ordered by likelihood:

  3. neriousy commented on Dec 2, 2026

    @neriousy
    Member

    Thanks for the report! This looks like the same bug as #64941, so I'm closing this one to keep the discussion in one place. If yours turns out to be different, leave a comment and we'll reopen it.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/mcpplatform/windowstype/bugversion/v2

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions