Description
New workspaces created by OpenCode do not pick up MCP server configurations from the project's opencode.jsonc file. The MCP panel in the workspace GUI shows "No MCPs configured" despite the config file being present in the worktree directory.
Steps to Reproduce
- Create
opencode.jsonc in a project root with MCP server definitions
- Commit it to the repository
- Start OpenCode and let it create a new workspace (which creates a git worktree)
- Open the MCP panel in the workspace GUI
- Observe "No MCPs configured"
Expected Behavior
The workspace should discover and load opencode.jsonc from the worktree directory, including all MCP server configurations. Per the docs, project config is found by looking in the current directory or traversing up to the nearest git directory.
Actual Behavior
The MCP panel shows "No MCPs configured" in the workspace, even though:
opencode.jsonc exists in the worktree directory
git rev-parse --show-toplevel correctly resolves to the worktree root
- The file is tracked in git and checked out
Environment
- OpenCode version: 1.3.0
- Platform: Windows (native, not WSL)
- Config file:
opencode.jsonc (JSONC format) in project root
Workaround
Placing the MCP config in the global config (~/.config/opencode/opencode.jsonc) makes MCP servers available in all workspaces.
Analysis
The workspace runs as a sub-instance via Instance.provide() with the worktree directory. Config loading uses Instance.state() which should lazily load config for the worktree directory. MCP also uses Instance.state() and reads from Config.get(). The gap appears to be that the workspace server's config/MCP state initialization does not properly resolve the project config file in the worktree context.
Description
New workspaces created by OpenCode do not pick up MCP server configurations from the project's
opencode.jsoncfile. The MCP panel in the workspace GUI shows "No MCPs configured" despite the config file being present in the worktree directory.Steps to Reproduce
opencode.jsoncin a project root with MCP server definitionsExpected Behavior
The workspace should discover and load
opencode.jsoncfrom the worktree directory, including all MCP server configurations. Per the docs, project config is found by looking in the current directory or traversing up to the nearest git directory.Actual Behavior
The MCP panel shows "No MCPs configured" in the workspace, even though:
opencode.jsoncexists in the worktree directorygit rev-parse --show-toplevelcorrectly resolves to the worktree rootEnvironment
opencode.jsonc(JSONC format) in project rootWorkaround
Placing the MCP config in the global config (
~/.config/opencode/opencode.jsonc) makes MCP servers available in all workspaces.Analysis
The workspace runs as a sub-instance via
Instance.provide()with the worktree directory. Config loading usesInstance.state()which should lazily load config for the worktree directory. MCP also usesInstance.state()and reads fromConfig.get(). The gap appears to be that the workspace server's config/MCP state initialization does not properly resolve the project config file in the worktree context.