Skip to content
MCP server

AdversaryGate

Fail-closed merge gate that tells an AI coding agent MERGE, BLOCK or INCONCLUSIVE

Runs locallyStatus and history
Install
Pricing
Open source
Platforms
CLI, self-hosted
Runs
Locally
Version
3.0.17
Listing updated
2 days ago

About AdversaryGate

AdversaryGate is an open-source MCP server for developer tools. It runs locally on your machine and is started by your AI client.

Most before-and-after checks treat a test that never ran as no change. This gate treats it as missing evidence: import errors, wrong test IDs, timeouts and runs killed by limits count as unverified, and the answer becomes INCONCLUSIVE rather than a pass. Exit codes are 0 for merge, 1 for block and 2 for inconclusive.

It runs the named tests, or those that coverage says touched the changed lines, three times each on the baseline and on the patch. It computes diff coverage from your unified diff and a coverage.py JSON report, recording both by SHA-256, then mutation-tests only the lines the patch wrote. The suite-strength floor uses the lower bound of an 80% confidence interval, so a very small change can be too small to judge.

No language model runs inside the verifier. It measures Python and pytest projects today; other stacks get INCONCLUSIVE. Operators can pin the baseline git ref so the agent cannot choose it.

Install

Run in a terminal

claude mcp add adversary-gate -- uvx adversary-gate-mcp

Add to claude_desktop_config.json

{
  "mcpServers": {
    "adversary-gate": {
      "command": "uvx",
      "args": [
        "adversary-gate-mcp"
      ]
    }
  }
}
Install in CursorOpens Cursor, which asks you to confirm. Or add it by hand:

Add to ~/.cursor/mcp.json

{
  "mcpServers": {
    "adversary-gate": {
      "command": "uvx",
      "args": [
        "adversary-gate-mcp"
      ]
    }
  }
}
Install in VS CodeOpens VS Code, which asks you to confirm. Or add it by hand:

Add to .vscode/mcp.json

{
  "servers": {
    "adversary-gate": {
      "type": "stdio",
      "command": "uvx",
      "args": [
        "adversary-gate-mcp"
      ]
    }
  }
}

Add to ~/.codeium/windsurf/mcp_config.json

{
  "mcpServers": {
    "adversary-gate": {
      "command": "uvx",
      "args": [
        "adversary-gate-mcp"
      ]
    }
  }
}

Add to your client's MCP settings (most use this shape)

{
  "mcpServers": {
    "adversary-gate": {
      "command": "uvx",
      "args": [
        "adversary-gate-mcp"
      ]
    }
  }
}

Configuration

  • ADVERSARY_GATE_BASE_REFBaseline git ref (e.g. origin/main). Unset, the agent may pick it, and whoever picks the baseline picks the oracle
  • ADVERSARY_GATE_REQUIRE_PINNED_BASESet to 1 to refuse any run without ADVERSARY_GATE_BASE_REF, so the agent can never choose the baseline (the oracle)
  • ADVERSARY_GATE_PYTHONInterpreter that runs the tests; must be one the agent cannot write to
  • ADVERSARY_GATE_POLICYExtra gate flags set by the operator; evidence flags are refused

What it does

Three-way decision
Answers MERGE, BLOCK or INCONCLUSIVE with a reason and next steps.
Baseline versus patch runs
Runs the same tests on both sides, three times each.
Diff coverage from artefacts
Computes coverage from a diff and a coverage.py report, with inputs hashed.
Mutation testing on changed lines
Breaks only the lines the patch wrote to gauge test strength.
Pinned baseline
An environment variable can force a fixed baseline ref the agent cannot pick.
CLI, Action and MCP
Available as a command line, a GitHub Action and an MCP server.

Good for

  • Stop an agent from reporting done on a patch that breaks a passing test
  • Catch patches that rewrite their own tests to agree with a bug
  • Gate agent-authored pull requests in CI
  • Require measured coverage before accepting an automated fix

Pricing

Open source

Open source under AGPL-3.0

Prices change. Check sanflow10.github.io before you buy.

AdversaryGate FAQ

Which languages does it measure?

Python and pytest projects. Other languages return INCONCLUSIVE, never MERGE.

What licence applies?

AGPL-3.0 for current releases; the 2.x line up to 2.14.2 was MIT.

Does an LLM judge the patch?

No. The rules are plain code and are the same for any agent.

Why was my one-line fix inconclusive?

The README explains that the floor needs at least 5 killed mutants, so a very small change can be too small to measure.

Is AdversaryGate free?

Yes. AdversaryGate is open source, so you can use and self-host it for free.

How do I add AdversaryGate to Claude Code?

Run this command in your terminal: claude mcp add adversary-gate -- uvx adversary-gate-mcp

What are the best alternatives to AdversaryGate?

The closest alternatives to AdversaryGate are REA, Codebase Memory, GitHub, Serena MCP: the IDE for your agent and XERJ.

Alternatives to AdversaryGate

  1. REA

    MCP server

    CLI and MCP server that lets coding agents reverse engineer apps and binaries

    Runs locally
    • Open source
    • 464K GitHub stars
    • Developer tools
  2. Codebase Memory

    MCP server

    Local MCP server that builds a code knowledge graph for AI coding agents

    Runs locally
    • Open source
    • 48.7K GitHub stars
    • Knowledge and memory
  3. GitHub

    MCP server

    Official MCP server connecting AI assistants to GitHub repos, issues and workflows

    Not checked yet
    • Remote
    • Open source
    • 34.5K GitHub stars
    • Developer tools
  4. MCP toolkit giving coding agents symbol-level code retrieval and editing

    Runs locally
    • Open source
    • 31.5K GitHub stars
    • Developer tools
  5. XERJ

    MCP server

    Local search engine for AI agents with cited answers over your code and docs

    Runs locally
    • Open source
    • 19.2K GitHub stars
    • Knowledge and memory
  6. Ouroboros

    MCP server

    Spec-first layer that pins requirements and verifies results of AI coding agent work

    Runs locally
    • Open source
    • 6.4K GitHub stars
    • Developer tools