Skip to main content
Glama
README.md
# mcp-cross-check

[![CI](https://github.com/multisystemalaga/mcp-cross-check/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/multisystemalaga/mcp-cross-check/actions/workflows/ci.yml)
[![License: MIT](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)

Ask a second model to review a proposed change before applying it. This Python 3.10+ [Model Context Protocol](https://modelcontextprotocol.io/) server gives Claude Code and Claude Desktop three tools for reviewing a git diff, challenging a plan, or checking an artifact against explicit invariants. Its runtime uses only the Python standard library.

```text
Claude Code or Claude Desktop
    |  tool name + arguments
    v  JSON-RPC over local stdio
mcp-cross-check
    |  review instructions + supplied arguments
    v  POST /chat/completions
OpenAI-compatible reviewer
    |
    +-- review text --> mcp-cross-check --> Claude
```

The host supplies the material for each review. The server sends those arguments, including optional context, to the configured endpoint. It never needs a repository checkout or a shell to answer a tool call. Remove credentials and customer data from patches and context before sending them to an external provider.

## Install

With Git and Python 3.10+ available, install into a dedicated virtual environment. The shell examples below use macOS or Linux.

```sh
python3 -m venv "$HOME/.venvs/mcp-cross-check"
. "$HOME/.venvs/mcp-cross-check/bin/activate"
pip install git+https://github.com/multisystemalaga/mcp-cross-check.git
mcp-cross-check --version
command -v mcp-cross-check
```

Keep the absolute executable path printed by the last command for host registration. On Windows, the corresponding executable is `Scripts\mcp-cross-check.exe` inside the virtual environment.

## Configure the reviewer

| Variable | Default | Purpose |
| --- | --- | --- |
| `CROSS_CHECK_API_KEY` | Required for reviews | Bearer credential for the reviewer endpoint. |
| `CROSS_CHECK_BASE_URL` | `https://api.openai.com/v1` | API root. The server appends `/chat/completions`. |
| `CROSS_CHECK_MODEL` | `gpt-4.1` | Model ID accepted by that endpoint. Choose a reviewer independent of the model proposing the change. |
| `CROSS_CHECK_TIMEOUT` | `45.0` | Positive timeout in seconds for the HTTP request. |

Load the key from your secret manager, or use these commands to enter it once in the current Bash or Zsh session with echo disabled.

```sh
printf 'Reviewer API key: '
read -rs CROSS_CHECK_API_KEY
printf '\n'
export CROSS_CHECK_API_KEY
mcp-cross-check --check-config
```

`--check-config` validates the local settings without making a model request. Starting the server and listing its tools also work offline. To use a different provider, set the API key, base URL and model together so the credential is sent to its intended endpoint.

## Register with Claude Code

Run this in the activated environment. The single quotes preserve the variable reference in Claude's user-scoped configuration. Launch Claude Code from a shell that exports the reviewer settings.

```sh
claude mcp add --scope user \
  --env 'CROSS_CHECK_API_KEY=${CROSS_CHECK_API_KEY:-}' \
  --transport stdio cross-check -- "$(command -v mcp-cross-check)"
claude mcp list
```

Open `/mcp` in Claude Code and select `cross-check` to see its tools. For a first review, try “Use cross-check’s `review_plan` on this migration plan. Identify any step that could discard data before it has been verified.” [Claude Code MCP documentation](https://code.claude.com/docs/en/mcp)

## Register with Claude Desktop

Open **Settings → Developer → Edit Config**. Merge the `cross-check` entry below into the existing `mcpServers` object in `claude_desktop_config.json`. Replace the example path with the installed executable's absolute path and the example key with your reviewer credential.

```json
{
  "mcpServers": {
    "cross-check": {
      "command": "/absolute/path/to/mcp-cross-check",
      "env": {
        "CROSS_CHECK_API_KEY": "replace-with-your-reviewer-key"
      }
    }
  }
}
```

The `env` block stores its values in plain text. Keep this file private, or point `command` at a local launcher that reads the key from your secret manager. Add provider overrides to the same `env` block if needed. Fully quit and reopen Claude Desktop to load the configuration. [Local MCP server setup](https://modelcontextprotocol.io/docs/develop/connect-local-servers)

## Tool reference

| Tool | Required arguments | What to ask |
| --- | --- | --- |
| `audit_diff` | `diff` (string) | Inspect a proposed patch for regressions and missing tests. Pass the actual patch text, such as the output of `git diff --staged`. |
| `review_plan` | `plan` (string) | Challenge the plan's assumptions, dependencies and rollback steps before implementation. |
| `verify_invariants` | `artifact` (string), `invariants` (nonempty array of strings) | For each stated rule, ask whether the supplied code or design upholds it. |

Each tool also accepts an optional `context` string. In this example, `verify_invariants` checks whether a migration preserves archived accounts and keeps a rollback path open.

```json
{
  "artifact": "Copy active accounts into accounts_v2, compare row counts, then drop accounts_v1.",
  "invariants": [
    "Every account, including archived accounts, must survive the migration.",
    "Rollback must remain possible until row-level verification succeeds."
  ]
}
```

The reviewer is asked for a `PROCEED`, `REVISE`, or `BLOCK` verdict and findings grouped under `CRITICAL`, `WARNING`, and `SUGGESTION`. Claude receives the model's review as text. A `BLOCK` verdict leaves the decision with the caller. A tool execution failure, such as a missing API key, returns `isError: true`.

## Develop and test

Run the suite from the repository root. Installing the checkout then lets you check the console entry point.

```sh
PYTHONPATH=src python3 -m unittest discover -s tests -v
python3 -m pip install -e .
mcp-cross-check --version
```

The tests inject an offline reviewer transport. CI runs on Python 3.10, 3.11 and 3.12. The stdio server speaks newline-delimited JSON-RPC 2.0 and negotiates MCP revisions `2025-03-26` and `2024-11-05`.

## Roadmap

- [ ] Query multiple independent reviewers in parallel and reconcile disagreements by severity.
- [ ] Expose the staged git diff as a read-only MCP resource at `git://diff/staged`.
- [ ] Add a non-interactive `--fail-on critical` gate for pre-commit hooks and CI.

TDQS

B3.3/5.0

Scored across 3 tools

Disambiguation4/5

Each tool targets a distinct artifact type: a git diff, an implementation plan, and an artifact plus stated invariants. The main overlap risk is between audit_diff and verify_invariants when invariants are checked directly against a diff, but the descriptions make the input shape and intent separable.

Naming Consistency5/5

All three names follow a clean verb_noun snake_case pattern (audit_diff, review_plan, verify_invariants). The verbs are also semantically distinct rather than near-synonyms, reinforcing the pattern.

Tool Count4/5

Three tools is on the thin side, but for a focused cross-check/review server it is a coherent, well-scoped set with no filler. A fourth tool (e.g. reviewing a code file or PR description) might round it out, but nothing here feels extraneous.

Completeness4/5

The review surface covers the three common artifacts an agent would want cross-checked (plans, diffs, invariant claims), so no obvious dead ends in core workflows. Minor gaps exist around reviewing non-diff code artifacts or producing a consolidated verdict across multiple checks.

Maintenance

ActivityMaintained
ResponsivenessNo recent community issues