Skip to content

Workspaces do not load MCP config from project opencode.jsonc #19098

@fs-bmedkouri

Description

@fs-bmedkouri

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

  1. Create opencode.jsonc in a project root with MCP server definitions
  2. Commit it to the repository
  3. Start OpenCode and let it create a new workspace (which creates a git worktree)
  4. Open the MCP panel in the workspace GUI
  5. 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.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions