Skip to content

[Bug]: MCP servers from global config (~/.config/opencode/opencode.json) are ignored #622

@nguyenngothuong

Description

@nguyenngothuong

Bug Description

The listMcp() function in packages/server/src/mcp.ts only reads MCP configurations from the workspace-level opencode.json(c), completely ignoring global MCP servers configured in ~/.config/opencode/opencode.json.

This forces users to duplicate their global MCP configurations in every workspace, which is error-prone and inconvenient.

Steps to Reproduce

  1. Configure MCP servers in the global config:

    // ~/.config/opencode/opencode.json
    {
      "mcp": {
        "my-server": {
          "type": "local",
          "command": "npx",
          "args": ["-y", "@modelcontextprotocol/server-filesystem", "/tmp"]
        }
      }
    }
  2. Open a workspace that has no workspace-level opencode.json

  3. Open the MCP panel in OpenWork

Expected: my-server appears in the MCP list
Actual: MCP panel is empty

Root Cause

listMcp() in packages/server/src/mcp.ts reads only:

const { data: config } = await readJsoncFile(opencodeConfigPath(workspaceRoot), ...);

There is no fallback to the global config at ~/.config/opencode/opencode.json.

Expected Behaviour

Global MCPs should be merged with project MCPs. Project-level entries take precedence over global ones (same name → project wins). Each item should carry the correct source field ("config.global" vs "config.project") so the UI can distinguish them.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions