Skip to content

loom install --client opencode writes OpenCode's MCP entry #722

Closed

Description

@zlareb1

Company or project name

No response

Component

CLI

Use case

OpenCode users add Loom by hand today (opencode mcp add … or editing opencode.json), while loom install --client writes the entry for Claude Code, Codex, Cursor, VS Code, Cline, Windsurf, Zed and Claude Desktop.

Describe the solution you'd like

Goal. loom install --client opencode writes Loom's entry into ~/.config/opencode/opencode.json, merging with the servers already there, and the token dialog in the dashboard offers OpenCode too.

Files to change

  • server/identity/app/token_clients.py:
    • a CONFIG_PATHS row for opencode: OpenCode reads its global config from ~/.config/opencode/opencode.json on Linux and macOS; its config docs (https://opencode.ai/docs/config/) name no per-user path for Windows, so check where your build reads it and say so in the PR;
    • the entry nests under mcp.servers, while config_key() returns a single top-level key today, so the nesting needs its own handling in the config built by client_config();
    • mcp_entry() returns {"type": "remote", "url": …, "headers": {"Authorization": "Bearer …"}} for OpenCode;
    • opencode in CODING_CLIENTS, so the URL carries ?toolset=coding.
  • server/cli/install.py: _install_one merges into one top-level section and refuses a file that is not valid JSON. Make it write under mcp.servers. OpenCode reads opencode.json or opencode.jsonc (its config docs write opencode.json(c) and their examples use opencode.jsonc), and JSONC may hold comments and trailing commas that json.load cannot read. When opencode.jsonc is the file there, merge the entry into it and keep its comments and trailing commas; never write a second config beside it. Only when the file cannot be merged safely, refuse with a message that names it and prints the entry to paste. Say in the PR which file opencode mcp add --global creates on a machine with no global config, and write that one in that case.
  • frontend/src/lib/clients.ts: opencode in ClientId, CLIENTS and CODING_TOOLSET_CLIENTS, and in formatMcpConfig() the mcp.servers nesting and the type: "remote" entry, kept equal to the server's through clientSetups.fixture.json; frontend/src/lib/clients.test.ts.
  • tests/unit/test_token_clients.py, tests/unit/test_cli_install.py and tests/unit/test_token_mint.py (the set of clients a new token comes with).
  • tests/unit/snapshots/cli_tree.json and cli_help.json: the --client choices are pinned there.
  • docs/features/integrations/mcp-clients.md, each spot that names the loom install or coding-toolset clients:
    • the --client row of the flag table (its list of client names);
    • the --toolset row, whose default reads "coding for Claude Code, Codex and Cursor";
    • the sentence under "Plugin or plain MCP" that ends "the default only for Claude Code, Codex and Cursor";
    • the "Plugin or plain MCP" row that lists the loom install --client <name> clients (Claude Desktop, VS Code, Cline, Windsurf, Zed);
    • the "What it writes per client" table, and the OpenCode row under "Other editors and agents".
  • docs/getting-started/connect-a-coding-agent.md: the token dialog's client list under Connect ("Cursor, VS Code, Cline, Windsurf, Zed or Claude Desktop", around line 81) and the "--client also takes …" list after the command.
  • docs/features/integrations/index.md: the row that lists the loom install clients ("Claude Desktop, Cursor, VS Code, Cline, Windsurf, Zed | … loom install --client …", around line 19), and docs/getting-started/quickstart.md: the sentence that lists the clients loom install writes an MCP entry for (around lines 528–529). The MCP clients page has checked entries for nine more agents and the hosted builders' routes #695 and Google ADK memory services use Loom in both SDKs #696 also edit index.md (Google ADK memory services use Loom in both SDKs #696 re-pads its Map table), and The MCP clients page has checked entries for nine more agents and the hosted builders' routes #695 edits mcp-clients.md: rebase onto whichever is still open.

OpenCode 2.x nests the entry under mcp.servers, while the npm opencode-ai 1.x releases write {"mcp": {"loom": {...}}}. Say in the PR which versions the written entry supports.

Acceptance criteria

  • A unit test writes the file, then rewrites it, without losing the other servers under mcp.servers or other top-level keys.
  • When only ~/.config/opencode/opencode.jsonc exists, loom install --client opencode merges the entry into it, keeps its comments and trailing commas, and creates no opencode.json; a unit test covers it.
  • loom install with no --client wires OpenCode when ~/.config/opencode/ exists, and a unit test covers it.
  • OpenCode enables OAuth for a remote server unless its entry sets "oauth": false (https://opencode.ai/docs/mcp-servers/). Decide whether the written entry sets "oauth": false and say why in the PR; then check opencode mcp list against a server that takes the bearer token only and against one with LOOM_OAUTH_ENABLED=true, and report what each shows.
  • opencode mcp list shows loom connected (OpenCode 2.3.0 is the version the MCP clients page checked; say which version you used).
  • make format-check lint typecheck, npm --prefix frontend test and npm --prefix frontend run build (tsc -b && vite build, as CI runs it) pass.
  • npx --prefix frontend playwright install chromium && npm --prefix frontend run e2e passes (the specs in frontend/e2e/, as CI's frontend-e2e job runs them).
  • The docs checks pass:
.venv/bin/python -m pytest tests/unit/test_doc_links.py tests/unit/test_public_copy.py -q
.venv/bin/python -m scripts.codegen.docs_reference --check
  • LOOM_UPDATE_CLI_SNAPSHOT=1 .venv/bin/python -m pytest tests/unit/test_cli_surface_snapshot.py regenerates cli_tree.json and cli_help.json (the command tests/unit/snapshots/README.md gives), and .venv/bin/python -m pytest tests/unit/test_token_clients.py tests/unit/test_cli_install.py tests/unit/test_token_mint.py tests/unit/test_cli_surface_snapshot.py -q passes.

Describe alternatives you've considered

opencode mcp add loom --url URL --header "Authorization=Bearer <JWT>" works today, as the MCP clients page shows; this makes loom install cover OpenCode like the other clients and puts it in the dashboard's token dialog.

Where the need comes from

The need is mine, an AI tool helped shape the proposal

Additional context

the Gemini CLI install issue (loom install --client gemini) and #709 (Zed) change the same files: server/identity/app/token_clients.py, server/cli/install.py, frontend/src/lib/clients.ts, frontend/src/lib/clientSetups.fixture.json and the CLI snapshots. Taken in parallel, expect to rebase onto whichever merges first.

Size: L (several days). Read CONTRIBUTING.md first (signed-off commits), and comment here to say you are working on it.

Activity

  1. added
    enhancement
    help wanted
    on Nov 16, 2026
  2. rahulsjha commented on Nov 16, 2026

    @rahulsjha
    Contributor

    Hi @zlareb1, I'd also like to take the OpenCode entry, right after #724 since they touch the same files. Plan: an opencode row in CONFIG_PATHS (its opencode.json location per platform) with the mcp key and entry shape OpenCode expects (type: "remote", url, headers), opencode in CODING_CLIENTS, the frontend clients.ts entries and formatMcpConfig() branch, the matching unit and snapshot tests, and the MCP clients docs; I'll verify it against a running OpenCode and put the version and result in the PR. Could you assign it to me?

  3. added
    up-for-grabs
    on Nov 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

enhancementhelp wantedup-for-grabs

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions