Skip to content

OpenCode MCP install: use official opencode.json + mcp schema (not .opencode.json / mcpServers) #388

@JuanSebastianGB

Description

@JuanSebastianGB

Problem

code-review-graph install --platform opencode currently writes {repo_root}/.opencode.json using a Cursor-shaped payload:

  • Top-level key: mcpServers
  • Server entry shape: command + args + type: "stdio"

OpenCode’s documented configuration (Config | OpenCode) uses a different filename and schema:

  • Project: opencode.json at the repo root (resolved from cwd / nearest git root)
  • User-wide: ~/.config/opencode/opencode.json
  • MCP servers live under mcp, not mcpServers
  • Local servers use "type": "local" and command as one string array [executable, ...args] (per https://opencode.ai/config.jsonMcpLocalConfig; no separate args key)

Users who only run install may therefore get a file OpenCode never loads, while hand-editing global config often leads to hard-coding --repo, which breaks the intended per-workspace / cwd model.

Desired behavior

  1. install --platform opencode: merge the server into {repo_root}/opencode.json using the official mcp object, e.g.:

    {
      "$schema": "https://opencode.ai/config.json",
      "mcp": {
        "code-review-graph": {
          "type": "local",
          "command": ["uvx", "code-review-graph", "serve"]
        }
      }
    }

    Reuse existing _build_server_entry logic for uvx vs bare code-review-graph, but emit OpenCode’s array-command shape (and omit --repo so resolution follows serve / cwd as today).

  2. Migration / compat: if an older {repo_root}/.opencode.json exists only for this MCP, warn once, migrate, or document removal—avoid leaving two conflicting stories.

  3. Docs: README / docs/INDEX.md — clarify project opencode.json vs global ~/.config/opencode/opencode.json.

Related

  • Umbrella “native OpenCode” / hooks: opencode native support #317 (this issue is narrowly about install-time MCP config path + JSON shape).

Environment

  • code-review-graph 2.3.2 (PyPI)
  • OpenCode config schema as of 2026-04 (local MCP command: string array)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions