Skip to content

cli: Gemini CLI support, clear permission errors, Codex hint without the CLI - #17

Merged
chenchenSimular merged 4 commits into
mainfrom
chenchen/gemini-cli
Nov 4, 2026
Merged

chenchenSimular merged 4 commits into
mainfrom
chenchen/gemini-cli

Conversation

@chenchenSimular

@chenchenSimular chenchenSimular commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

Closes #16

Why

The add-mcp spike (#14, closed; decision in #15 (comment)) showed that Gemini CLI reads a plain mcpServers entry and signs in with OAuth by itself. Box can support it with our existing JSON writer and no new dependency. The spike also found two first-run gaps that don't need add-mcp; this PR carries those over too.

What

  • Gemini CLI (--client gemini-cli, alias gemini), on json-client.js. It writes mcpServers.box = {"type": "http", "url": "https://relay.simular.cloud/mcp"} into ~/.gemini/settings.json, keeping comments and other settings. doctor and remove work as for the other JSON clients: only an entry that points at box is ours, a backup is kept, and old box-control entries are removed. A foreign box given as httpUrl is recognised too.
    • How it signs in (checked in the 0.66.0 bundle):
      • type: "http" makes Gemini CLI use streamable HTTP (url without a type would fall back to SSE on errors).
      • On a 401 it marks the server as needing OAuth and tells the user to run /mcp auth box.
      • /mcp auth finds the sign-in from the WWW-Authenticate header, with no oauth block needed. Without oauth.enabled, Gemini doesn't open a browser at every start; that matches the explicit sign-in step we use for the other clients.
    • Trusted folders: Gemini CLI loads MCP servers only in a trusted folder, so the hint says so.
  • Permission errors. When a config can't be changed (EACCES/EPERM, or EBUSY on Windows), connect names the client's config and says the file or its folder may belong to another user, or the app may hold it open. For Codex it also prints the Codex app steps, for when the app holds the file: Settings → MCP servers → Add server, name it box, Streamable HTTP, paste the URL, Save, restart, Authenticate.
  • Codex sign-in hint. With no codex on PATH (the Codex app alone), the hint points at the app's Settings → Authenticate instead of codex mcp login box.
  • CI: gemini-cli (@google/gemini-cli@0.66.0) joins the real-client install matrix on Linux, macOS and Windows. The matrix seeds another server, runs connect, checks that gemini mcp list shows box: … (http), re-runs connect (no change), runs doctor, removes, and checks that the other server survived. The smoke dry run includes it.
  • READMEs and package keywords list Gemini CLI.

Tests

  • Unit:
    • Gemini round trip: comments and settings kept, idempotent, one backup, remove.
    • Foreign httpUrl box left alone.
    • Gemini added to the foreign-box and dry-run sweeps.
    • EACCES on Codex's config prints the app steps.
    • Codex hint without the CLI.
  • Install matrix run locally on macOS: gemini-cli, codex and opencode all OK. All three OSes run in CI on this PR.

Review

An independent review (simular-code-review plus secure-coding invariant review) found nothing blocking.

  • Gemini entry: checked against the 0.66.0 bundle and the live relay. It covers streamable HTTP, the 401 auth-required path, and /mcp auth discovery with DCR and iss.
  • Fixed in the second commit: the permission message printed err.path, which can be a temp file or a file whose folder is the real problem, so it now names the config. EBUSY is now covered.
  • Not verified: the Codex app's "Add server" when ~/.codex belongs to root. The app likely writes the same file, so the steps are worded for the case where the app holds the file. The interactive Gemini browser sign-in was not run end to end.

🤖 Generated with Claude Code

chenchenSimular and others added 3 commits November 4, 2026 11:38
…the CLI

- gemini-cli client on our JSON writer: ~/.gemini/settings.json,
  mcpServers.box = {type: "http", url}; connect, doctor and remove, with
  the same foreign-server guard, backups and box-control cleanup. The
  next hint is `/mcp auth box` in a trusted folder.
- When a config can't be written (EACCES/EPERM), connect says so; for
  Codex it prints the steps to add box in the Codex app's Settings.
- The Codex sign-in hint points at the app when `codex` is not on PATH.
- gemini-cli joins the real-client install matrix on Linux, macOS and
  Windows (@google/gemini-cli@0.66.0).

Closes #16

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…r EBUSY

From review of #17: the permission message printed err.path, which can be
a temp file or a file whose folder is the real problem. It now names the
client's config and says the file or its folder may belong to another user.
EBUSY (Windows, app holds the file) gets the same help. The Codex app
steps are offered for the case where the app holds the file.

Refs #16

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ies (#19)

* Move box to https://mcp.box.simular.ai/mcp and migrate old relay entries

The box MCP server moved from relay.simular.cloud to mcp.box.simular.ai. The old
address now returns protected-resource metadata naming the new URL, so MCP
clients refuse to sign in through it.

- CLI default URL, Claude Code / Hermes / dsh plugin configs and docs point at
  the new URL; plugin versions bumped (claude 0.1.1, hermes 0.1.1, dsh 0.2.1).
- connect rewrites a box entry at the old address (it stays "ours"), and says
  the app may ask to sign in again. For Claude Code it runs
  `claude plugin marketplace update` + `claude plugin update` when the
  installed plugin still points at the old URL.
- doctor flags an entry at the old address, and an endpoint whose metadata
  names a different resource.
- Install matrix seeds a box at the old address for every client and, for
  Claude Code, installs the old plugin from a local git marketplace built
  from this checkout, so it tests this branch's plugin and the update path.

Refs #18

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* cli: check the Claude Code plugin's URL after updating it

Review follow-up: if the marketplace still serves the old .mcp.json (a fork
or pinned ref), connect now fails with the fix instead of reporting success
and re-running the update on every connect.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
@chenchenSimular
chenchenSimular merged commit 0085bfa into main Nov 4, 2026
27 checks passed
@chenchenSimular
chenchenSimular deleted the chenchen/gemini-cli branch November 4, 2026 05:00
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.

cli: Gemini CLI support, clear permission errors, Codex hint without the CLI

1 participant