Skip to main content
Gemini CLI reads MCP servers from settings.json under the root key mcpServers, the same shape Claude Desktop and Cursor use. There is a subcommand that writes the entry for you.

Set it up with your agent

One prompt, written for Gemini CLI to read rather than you. It installs the server, registers it, reloads, and proves the tool works with a real verification.
Prefer to do it yourself? The rest of this page is the same setup by hand.

Config location

gemini mcp add defaults to project scope, so it writes .gemini/settings.json unless you ask otherwise.

Add it

That writes the project file. For every project on the machine, use user scope:
By hand, add this to settings.json alongside the objects already there:
timeout is in milliseconds here, not seconds. Gemini CLI defaults to 600000 (10 minutes), which is the same order as Refactron’s own 600 second test-gate default, so a suite that runs long enough to hit one will be near the other. Set it above your slowest full suite run. To pin the version and skip the global install:
The -p flag is required. refactron-mcp is a second binary of the refactron package, not a package of its own.

Verify the connection

Inside a session, the /mcp slash command shows connected servers with their tools expanded. You are looking for one tool, verify_change, under refactron.

Troubleshooting

  • The server shows Disconnected and the command is right: Gemini CLI only starts a stdio server in a trusted folder. Run gemini trust in the project directory, then list again. This is the failure that looks like a broken install and is not one.
  • gemini mcp add put it somewhere unexpected: the default scope is project, so the entry landed in .gemini/settings.json in whatever directory you ran it from. Re-run with --scope user for a machine-wide entry.
  • command not found on launch: run which refactron-mcp. If it prints nothing, run npm install -g refactron@0.3.0, or switch to the npx form above.
  • A verification is cut off partway: timeout is milliseconds. 900 means 0.9 seconds, not 15 minutes, and every call fails instantly.
  • Confirmation prompts on every call: set "trust": true on the refactron entry to skip them. The server reads your repository and writes only to a temporary shadow copy, so this is a reasonable server to trust. It is a per-server setting, so it does not loosen anything else.
  • The server is configured but excluded: check the top-level mcp object for an allowed list. If mcp.allowed is set and does not name refactron, the CLI never connects to it.