Skip to content

MCP config resolution ignores opencode.jsonc and uses strict JSON.parse — all generic sources fail for JSONC users #162

Description

@dommonkhouse

Summary

getMcpConfig() in service/poller.js hard-codes the config path to ~/.config/opencode/opencode.json and parses it with strict JSON.parse. OpenCode officially supports opencode.jsonc (JSONC, with comments) as an equal alternative — for users whose global config is the .jsonc variant, every generic/Linear source fails at poll time.

Reproduction

  1. Global OpenCode config at ~/.config/opencode/opencode.jsonc (JSONC, contains comments). No opencode.json present.
  2. Configure a Linear source (preset linear/my-issues) with a valid mcp: linear server defined in that config.
  3. opencode-pilot test-source <name>

Result

Error fetching items: MCP config not found: /Users/<user>/.config/opencode/opencode.json
    at getMcpConfig (file:///.../opencode-pilot/service/poller.js:205:11)
    at pollGenericSource (file:///.../opencode-pilot/service/poller.js:335:21)

Expected

Pilot resolves the MCP config the same way OpenCode itself does: try opencode.json, fall back to opencode.jsonc, and parse with a comment-tolerant parser (e.g. strip-json-comments or a small JSONC parser) rather than strict JSON.parse (poller.js:208).

Note options.opencodeConfigPath exists internally (poller.js:318) but doesn't appear to be settable from config.yaml, so there's no user-side workaround short of maintaining a duplicate plain-JSON config — which OpenCode may itself read, with unclear precedence against the jsonc file.

Version

opencode-pilot 0.29.1 (npm), OpenCode 1.18.18, macOS.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions