Repository navigation
Conversation
OpenCode 2.x reads its servers from mcp.servers in ~/.config/opencode/opencode.json (or opencode.jsonc). loom install merges a remote entry with the bearer header and oauth: false there, keeping the file's comments and trailing commas, and the token dialog offers OpenCode too. The JSONC editor now places a key under a nested path. Signed-off-by: Rahul <132360698+rahulsjha@users.noreply.github.com>
No oauth: false. A run with OpenCode 2.3.0 showed no difference with or without it, and the entry now matches opencode mcp add --url … --header … key for key. Signed-off-by: Rahul <132360698+rahulsjha@users.noreply.github.com>
zlareb1
left a comment
There was a problem hiding this comment.
No blocking findings. Checked nested configuration writes, JSONC preservation, client detection, token setup and dashboard parity against the documented V2 configuration. All 141 focused client, installer, token and CLI snapshot tests pass.
zlareb1
left a comment
There was a problem hiding this comment.
The JSONC editor retains a compatibility entry point with only a unit-test caller. Remove it and exercise the nested editor directly in that test.
The installer calls upsert_nested_key directly. The one test that still used the wrapper now calls upsert_nested_key with a one-section path, and the nested editor's docstring carries the contract on its own. Signed-off-by: Rahul <132360698+rahulsjha@users.noreply.github.com>
zlareb1
left a comment
There was a problem hiding this comment.
The unused JSONC wrapper is removed, and its rejection test calls the nested editor directly. No further blocking findings after checking configuration paths, nested writes, token setup and dashboard parity. All 141 focused installer, client, token and CLI snapshot tests pass.
Closes #722.
loom install --client opencodewrites Loom's entry into OpenCode's global config, merging with what is there, and the dashboard's token dialog offers OpenCode too.What it writes
{ "mcp": { "servers": { "loom": { "type": "remote", "url": "https://loom.example.com/mcp?toolset=coding", "headers": { "Authorization": "Bearer <token>" } } } } }$XDG_CONFIG_HOME, else~/.config, on every platform, Windows included (packages/util/src/global-roots.ts).$OPENCODE_CONFIG_DIRoverrides the directory.opencode mcp add --global(packages/cli/src/commands/handlers/mcp/add.ts) writes the first ofopencode.json,opencode.jsonc,.opencode/opencode.jsonand.opencode/opencode.jsoncthat exists there, and createsopencode.jsonwhen none does.loom installfollows the same order, so with onlyopencode.jsoncpresent it merges into that file and creates noopencode.json.server/cli/jsonc_edit.py). It now takes a path of sections (upsert_nested_key(text, ("mcp", "servers"), name, entry)), insertingmcporserverswhen either is missing. Comments and trailing commas stay, and an entry already equal leaves the file byte for byte. A file it cannot merge is left as it is, and the entry to paste is printed.mcp.servers, the shape written here. The npmopencode-ai1.x package reads them frommcpdirectly and does not see this entry. The docs say so.oauthkey. The issue asked whether to set"oauth": false. The entry leaves it out, so it is exactly whatopencode mcp add loom --url URL --header "Authorization=Bearer <JWT>"writes (compared below), and OpenCode's OAuth setting stays at its default. I tried both against a server withLOOM_OAUTH_ENABLED=trueand saw no difference inopencode mcp list. The caveat below explains why that run doesn't settle it either way.CODING_CLIENTS/CODING_TOOLSET_CLIENTSand its URL carries?toolset=coding.loom installwith no--clientwires OpenCode when its config directory exists.Files
server/identity/app/token_clients.py: theopencodeCONFIG_PATHSrow,config_path_keys()(("mcp", "servers")for OpenCode, one key for the rest), the entry, andclient_config()nesting the block.config_key()still returns the top-level key.server/cli/install.py:_opencode_config_path()._install_zedis now_install_jsonc(client, …, sections)and serves Zed and OpenCode.server/cli/jsonc_edit.py:upsert_nested_key.upsert_object_keycalls it with one section, so Zed's behaviour is unchanged.frontend/src/lib/clients.tsandclientSetups.fixture.json: OpenCode inClientId,CLIENTSandCODING_TOOLSET_CLIENTS, and the nestedmcp.serversblock with atype: "remote"entry informatMcpConfig(). The fixture rows come fromclient_config().test_cli_install.py: 6 OpenCode tests covering a write and rewrite that keep other servers and top-level keys, creating the nesting, a.jsonc-only config merged with its comments and trailing commas and noopencode.jsoncreated, the refusal message, path lookup and env vars, andloom installwith no--client.test_token_mint.py: OpenCode added to the client set.cli_tree.jsonandcli_help.json: regenerated withLOOM_UPDATE_CLI_SNAPSHOT=1.mcp-clients.md: the--clientand--toolsetrows, "Plugin or plain MCP", "What it writes per client", the merge note, and the OpenCode row under other editors.connect-a-coding-agent.md,integrations/index.mdandquickstart.md.Checks (Linux containers)
pytest tests/unit/test_token_clients.py test_cli_install.py test_token_mint.py test_cli_surface_snapshot.py: 141 passed, on the final head too.ruff check,ruff format --check, the function-length gate (54, at its baseline) and the mypy gate (0 new errors): pass.pytest tests/unit/test_doc_links.py tests/unit/test_public_copy.py: 267 passed.scripts.codegen.docs_reference --check: current.npm test(vitest, node 24): 317 files and 3687 tests passed, including the fixture parity test foropencode.npm run build: built. On the final head,clients.test.ts(47 tests) andtsc -bpass again. Biome format and lint: clean.npm run e2e(Playwright). This machine was short on memory, so I'm leaving it to CI'sfrontend-e2ejob.Real OpenCode 2.3.0 against a local Loom
Local Loom from source on this branch (ClickHouse 26.10 with the repo's
deploy/clickhouse-config, auth on, thelocalembedder), with a minted writer token and OpenCode 2.3.0 (opencode-linux-x64).Same file as
opencode mcp add. Each command wrote to its own empty$XDG_CONFIG_HOME:Both files hold the
mcp.servers.loomentry shown above. At the time of that run,loom installalso added"oauth": false, which this PR no longer writes.Auto-detection.
loom installwith no--client, in a home where only~/.config/opencode/exists:opencode mcp list(caveat).LOOM_OAUTH_ENABLED=true, it printed✓ loom connectedfor the written entry, both with and without"oauth": false.No MCP servers configuredfor the entry OpenCode's ownmcp addhad just written, andconnectedfor an entry with a rejected token.mcp listasks a background OpenCode server (ServerConnection.resolve()) rather than reading the file, so I think one server was reused across my calls, each with a differentXDG_CONFIG_HOME.opencode mcp listthere is the check that counts.