Skip to content

loom install --client gemini writes Gemini CLI's MCP entry - #744

Merged
zlareb1 merged 2 commits into
ClickHouse:mainfrom
rahulsjha:feat/install-client-gemini
Nov 18, 2026
Merged

zlareb1 merged 2 commits into
ClickHouse:mainfrom
rahulsjha:feat/install-client-gemini

Conversation

@rahulsjha

Copy link
Copy Markdown
Contributor

Closes: #724

Changelog category (leave one):

  • Improvement

Changelog entry (one or two sentences a user of Loom can read without the diff; the release pull request collects these into the release notes):

loom install --client gemini writes Loom's MCP entry into Gemini CLI's ~/.gemini/settings.json, and the token dialog offers Gemini CLI.

Why

Gemini CLI users installed Loom through the Gemini extension or by editing settings.json by hand; loom install --client had no Gemini entry.

Scope and risk

  • server/identity/app/token_clients.py: a gemini row in CONFIG_PATHS (~/.gemini/settings.json; %USERPROFILE%\\.gemini\\settings.json on Windows), gemini in CODING_CLIENTS (the URL carries ?toolset=coding), and an httpUrl branch in mcp_entry(): {"httpUrl": …, "headers": {"Authorization": "Bearer …"}}. config_key()'s mcpServers default fits.
  • server/cli/install.py:
    • the merge in _install_one is unchanged, and a test shows a settings.json holding other settings and other servers keeps them across a write and a rewrite;
    • comments: a config file that fails to parse and holds // or /* */ comments outside strings is refused: nothing is written, and the message names the file and prints the entry to paste. The token is printed as <token>, as --dry-run already does. A file that is invalid JSON without comments gets the existing message. This applies to every JSON client, since a rewrite would drop comments in any of them; tell me if you'd rather keep it to gemini;
    • Antigravity: with no --client, Gemini CLI counts as installed when ~/.gemini/settings.json exists or gemini is on PATH, not when ~/.gemini/ alone exists, because Google Antigravity also creates that directory. Tested both ways.
  • frontend/src/lib/clients.ts: gemini in ClientId, CLIENTS ("Gemini CLI") and CODING_TOOLSET_CLIENTS, and the httpUrl key in formatMcpConfig(); clientSetups.fixture.json gains the gemini setups (generated from client_config), which clients.test.ts and test_token_clients.py both check.
  • Tests: test_cli_install.py (write + rewrite keeping settings; refusal with comments; detection; _has_json_comments ignoring slashes inside strings), test_token_mint.py (the mint's client list), and cli_tree.json / cli_help.json regenerated with LOOM_UPDATE_CLI_SNAPSHOT=1 under Python 3.12 (CI's version; 3.14 also reflows the sql-access grant usage, which I left out). test_detect_installed_clients now pins shutil.which so a machine with gemini installed does not change its result.
  • Docs: mcp-clients.md (the --client and --toolset rows, the coding-toolset sentence, the "Plugin or plain MCP" row, a gemini row in "What it writes per client", and the comments refusal), connect-a-coding-agent.md, integrations/index.md and quickstart.md.

Not changed: pluginInstallLines returns nothing for gemini, though gemini extensions install https://github.com/ClickHouse/loom exists. Happy to add it here or separately.

Compatibility, rollout and rollback

  • Wire: me_service_accounts.create's clients gains a gemini entry; nothing removed or renamed.
  • Operator steps: none.
  • Rollback: reverting removes the client; a loom entry already written stays in the user's settings.json.

Tests

Against a real Gemini CLI. Loom 1.2.0 (released image, LOOM_AUTH_REQUIRED=true, a writer token from mint_token), this branch's CLI, Gemini CLI 0.68.0 from npm, all under a throwaway HOME:

$ loom install --client gemini --server-url http://localhost:7777 --token "$LOOM_API_KEY"
✓ gemini: wrote loom → …/.gemini/settings.json
   (the file keeps its "ui" theme and its "other" server; loom is {"httpUrl": "http://localhost:7777/mcp?toolset=coding", "headers": …})

$ gemini mcp list   (in a trusted folder)
✗ other: echo hi (stdio) - Disconnected        <- a placeholder server, kept to show the merge
✓ loom: http://localhost:7777/mcp?toolset=coding (http) - Connected

# settings.json with a // comment
ERROR (gemini): …/.gemini/settings.json holds comments, which `loom install` cannot keep when it rewrites the file; nothing was written. Add this under 'mcpServers' yourself (replace <token> with your Loom token):
{ "loom": { "httpUrl": "http://localhost:7777/mcp?toolset=coding", "headers": { "Authorization": "Bearer <token>" } } }
loom exit code: 1, file unchanged

full run log

Gates (Python 3.12, as CI):

pytest test_token_clients test_cli_install test_token_mint test_cli_surface_snapshot test_doc_links test_public_copy   325 passed
ruff format --check . / ruff check                                                                                all clean
make lint codegen checks (sdk_py_gen, sdk_py_client_gen, sdk_py_admin_gen, sdk_ts_gen, agent_plugin_sync,
  settings_reference, settings_schema, settings_example, docs_reference --check), function length, no secrets       pass
make typecheck: mypy --strict sdk/python/loom; mypy_gate                                                           no issues; 0 new
npx prettier --check docs, biome format/lint frontend                                                             clean
Frontend, in a Linux Playwright container (node from mcr.microsoft.com/playwright:v1.63.0-noble), main and this branch back to back:
  vitest src/lib/clients.test.ts                     43 passed
  npm run build (tsc -b && vite build)               built
  npx vitest run (full)        main: 3530 passed, 9 failed   branch: 3533 passed, 9 failed
                               (the failures are timing flakes in unrelated files and differ from run to run on both)
  playwright e2e (full, branch)                      577 passed; the 2 route-budget failures were CPU contention:
  playwright e2e/route-budget.spec.ts, re-run quiet  main: 20 passed   branch: 20 passed

AI assistance in the code (leave one; writing this description with AI is fine):

  • AI-generated (an agent wrote most of the diff): Claude Code. I reviewed each change against the issue's file list and acceptance criteria, ran the tests above, and ran loom install and gemini mcp list myself against a live server.

  • I can explain every line of this diff and how it interacts with the rest of Loom.

Checklist

  • make format-check, make lint, make typecheck and make test-unit pass; the integration suite passes if server behaviour changed. (format, lint and typecheck as listed above; for make test-unit the files this change touches and the snapshot, docs and public-copy tests were run, not the whole unit suite)
  • Generated files are regenerated in this PR, not by hand: the SDK op tables, docs/reference/configuration.md and the docs/reference/ tables (python scripts/codegen/docs_reference.py), the reach manifest, schemas/schema.sql (make schema-dump) and the Codex plugin copies (python3 scripts/codegen/agent_plugin_sync.py). (the CLI snapshots were regenerated; every --check passes)
  • A new migration is additive and numbered after the latest on main; no merged migration is edited. (n/a)
  • A behaviour change to any file a plugin ships (hooks/, lib/, bin/, skills/, .mcp.json, the Codex plugin-defaults.json) bumps both plugin manifests' version, and no other open PR uses that version. (n/a)
  • The frontend builds (npm --prefix frontend run build) and its tests pass, if frontend/ changed.
  • Docs under docs/ describe the system as it now is, and this description names any operator steps and wire changes.
  • Repository text has no dates, people, host names, internal namespaces, ticket or decision numbers; the history goes in this description (tests/unit/test_public_copy.py).
  • Commits are signed off (git commit -s), as CONTRIBUTING.md asks.

Copilot AI balanced review requested due to automatic review settings November 16, 2026 20:06

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

@zlareb1 zlareb1 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verdict: needs verification. No code findings in the client registration, URL shape, configuration merge/refusal, detection or token redaction. The 325 focused Python tests, 43 frontend client-configuration tests, generated reference check and function-length gate pass locally.

The branch conflicts with main in docs/features/integrations/mcp-clients.md, so CI has not started. Rebase and retain the current table content while adding the client, then run CI before merge. The local full frontend build hits the same filename-casing error on main; native Windows and a live client were not exercised locally.

@zlareb1 zlareb1 self-assigned this Nov 17, 2026
@rahulsjha

Copy link
Copy Markdown
Contributor Author

Hi @zlareb1, this one is ready for review: loom install --client gemini for #724, checked against a running Gemini CLI 0.68.0 (loom listed as connected). Two choices are open to your call: a settings.json with comments is refused for every JSON client (not only Gemini), and auto-detect needs settings.json or the gemini binary rather than ~/.gemini/ alone, because of Antigravity.

Gemini CLI users had to use the extension or edit settings.json by hand. `loom install --client gemini` now merges `mcpServers.loom` into ~/.gemini/settings.json (%USERPROFILE%\.gemini\settings.json on Windows) as `httpUrl` + `headers`, the key Gemini CLI reads for streamable HTTP, on the coding toolset like the other coding agents. The token dialog offers Gemini CLI too, from the same table.

Gemini CLI reads settings.json with comments allowed. A file that holds comments is refused rather than rewritten without them, and the entry to paste is printed with the token as <token>. With no --client, Gemini CLI counts as installed when its settings file or the `gemini` binary exists, not when ~/.gemini/ alone does, since Google Antigravity also creates that directory.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Rahul <[email protected]>
@rahulsjha
rahulsjha force-pushed the feat/install-client-gemini branch from a94ae21 to 82bcea5 Compare November 17, 2026 23:59
@rahulsjha

Copy link
Copy Markdown
Contributor Author

@zlareb1 rebased onto main (82bcea5). The conflicts were in install.py (main's Zed JSONC merge and the Gemini comment check now sit side by side), and in index.md / mcp-clients.md, where I kept main's tables and added the Gemini rows (prettier-formatted). test_cli_install.py 79 passed; ruff, mypy, the function-length gate and docs_reference.py --check are clean. CI should run now.

@zlareb1 zlareb1 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No further findings in client registration, MCP URL shape, config preservation/refusal, detection or token redaction. All 133 focused install, token and CLI snapshot tests pass locally. The earlier merge conflict is gone; CI is running.

@zlareb1
zlareb1 merged commit 6a0ade2 into ClickHouse:main Nov 18, 2026
49 checks passed
@zlareb1 zlareb1 mentioned this pull request Nov 18, 2026
6 tasks done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

loom install --client gemini writes Gemini CLI's MCP entry

3 participants