Skip to main content
Refactron ships an MCP server that exposes exactly one tool: verify_change. An agent hands it a repository root and a proposed change, and gets back a verdict backed by your real test suite, run in an isolated shadow tree. The server speaks stdio, identifies itself as refactron version 0.3.0, and runs entirely on your machine. It never writes to your repository: applying the change stays the agent’s job, after a verdict the agent trusts. The fastest way in is to let your agent do the setup. Every client page below opens with a copy-only prompt that installs the server, registers it, reloads the client, and gets a first real verdict, written for that client specifically. Prefer to do it by hand? Pick your client below, or follow the MCP quickstart.
An AI agent calling Refactron's verify_change MCP tool and receiving a SAFE, UNSAFE, or UNPROVEN verdict before landing the change

An agent proposes a change, calls verify_change, and decides whether to land it based on the verdict.

Why an agent calls it

A coding agent has no independent way to tell a change that works from a change that only looks right. verify_change gives it one: run the project’s own tests against the proposal, in a copy, and report what that run actually proved.
  • SAFE: every gate passed and your tests exercised the changed code. Suite-approved, not proven correct: the verdict inherits exactly what your tests check.
  • UNSAFE: a gate failed. The change broke something.
  • UNPROVEN: the gates passed, but the evidence for SAFE is missing. A warning, not a rejection.
The full model, including how coverage fuses with the gates and what SAFE does not claim, is in Verdicts.

Install

Requires Node.js 18 or newer. For a coverage-backed SAFE verdict you also need Python 3.8+ with pytest and coverage.py. Install globally and get both binaries on your PATH:
That gives you refactron (the CLI) and refactron-mcp (this server). To skip the install and let the client fetch the package on demand:
The -p flag is required. refactron-mcp is a second binary of the refactron package, not a package of its own, so npx refactron-mcp on a machine without the global install looks for a package named refactron-mcp and fails with a registry 404.
pip install refactron==0.3.0 installs a wrapper that still requires Node.js 18+, and it provides the refactron command only.
The PyPI wrapper does not ship refactron-mcp. If you found Refactron through PyPI and want the MCP server, install the npm package as well.

Connect your client

Claude Code

One claude mcp add command, or a project .mcp.json.

Claude Desktop

Edit claude_desktop_config.json and restart the app.

Codex CLI

~/.codex/config.toml, in TOML, under [mcp_servers.refactron].

Cursor

Project .cursor/mcp.json or the global ~/.cursor/mcp.json.

GitHub Copilot in VS Code

.vscode/mcp.json, whose root key is servers, not mcpServers.

Gemini CLI

One gemini mcp add command, or ~/.gemini/settings.json.

Windsurf

Cascade reads ~/.codeium/windsurf/mcp_config.json.

Any other client

Anything that can launch a stdio MCP server can run this one, Zed and Cline included.

Make it verify, not just connect

Registering the server only adds a tool the agent may never reach for. These two prompts are what turn it into a habit. Both are written for the agent, not for you.

Verify before you apply

Defines the loop: propose, verify, then act on the verdict. Lasts the current conversation.

Make it stick across sessions

Writes that rule into the project, so every session and every teammate inherits it.

Why the wording in these prompts matters

Every prompt tells the agent, more than once, not to report SAFE as “correct”. That is deliberate. SAFE means the gates passed and your suite exercised the changed code. It does not mean the change is right. A real example from Refactron’s own hardening runs: changing <= to < in Jinja2’s truncate filter genuinely changes behavior at the boundary, all 911 tests still pass, the changed line is covered, and the verdict is SAFE. The verdict is correct about what it claims and is still not a proof of correctness. An agent that reports SAFE as “verified correct” has laundered a test-suite result into a guarantee. That is the one failure mode this tool exists to prevent, so the prompts spend words on it.

Then use it

Quickstart

Install, register, confirm the tool is listed, and get a first real verdict.

Verify before you apply

The standing rule that makes your agent verify instead of guess.

Tool reference

Every verify_change argument, the response shape, and the error shape.

Verdicts

What each verdict is allowed to claim, and what it is not.

What the server does and does not do

  • It runs entirely local. Verification happens on your machine, in a shadow tree. Nothing about your code leaves it, and the handler makes no network calls.
  • It never mutates your repository. verify_change reads your tree and applies the change in an isolated copy. Landing the change is the agent’s job, after a verdict it trusts.
  • It is deterministic. The same repository state and the same change produce the same verdict every time.
  • It needs no login. The verify-diff CLI is auth-gated, but the MCP handler calls the local engine directly.

Limits worth knowing before you start

Coverage attestation runs through coverage.py, so it is Python-only today. A TypeScript, JavaScript, or mixed-language change passes through the same three gates but caps at UNPROVEN with coverage.tool set to none, because Refactron cannot measure whether the changed statements ran. It will not guess, and a guess here would be a false SAFE. Coverage also cannot see code that only runs in a subprocess. A change exercised solely through subprocess.run or a multiprocessing worker reads as UNPROVEN unless you wire up subprocess coverage yourself. Diffs that delete, rename, or copy a file, or that change a binary file, are refused rather than partially verified. See Unsupported operations. There is no hosted CI gate. Refactron runs where you run it: your machine, or your own CI job.