Skip to main content

VerifierMCP

An MCP server that gives any LLM the power to check its own work. Instead of trusting a model's arithmetic, regex, JSON or "the code prints X", the model can call a tool and verify it. Five verification tools over the Model Context Protocol: symbolic math, sandboxed code execution, JSON-Schema validation, dimensional analysis, and regex testing.

VerifierMCP playground catching errors live

Built with the official MCP Python SDK (FastMCP). Works in Claude Desktop and any MCP client over stdio, or remotely over streamable HTTP (e.g. behind Amazon Bedrock AgentCore Gateway).


Why it matters

LLMs are confidently wrong about exactly the things that are mechanically checkable: (x+1)² = x²+1, a regex that doesn't quite match, JSON that violates its schema, a unit slip, "this function returns 5050". VerifierMCP turns each of those into a tool call, so an agent can replace an assertion with a verified fact.

The tools

Tool Checks Engine
verify_math Is an equation an identity? Does a claimed result hold? SymPy
run_code What does this Python snippet actually output? sandboxed subprocess
validate_schema Does this JSON conform to its JSON Schema? jsonschema (Draft 2020-12)
check_units Is this quantity/equation dimensionally correct? Pint
test_regex Does this regex match/reject the right cases? re

Each tool body lives in src/verifier_mcp/tools/ as a pure function, so it is unit-tested without the protocol and reused by the web playground.


Quickstart

pip install verifier-mcp            # or: pip install "verifier-mcp[web]" for the playground

# Run the MCP server over stdio (what Claude Desktop launches)
verifier-mcp

# Or serve it over HTTP (MCP streamable transport on :8000/mcp)
verifier-mcp --http

# See it in action — the visual playground (needs the [web] extra)
uvicorn verifier_mcp.playground:app --port 8080   # http://localhost:8080

Connect to Claude Desktop

Add to claude_desktop_config.json:

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

Restart Claude Desktop and ask it something like "Is (x+1)² equal to x²+1? Use the verifier." — it will call verify_math and come back with the checked answer.


Self-checking agent demo (Groq + MCP)

examples/self_checking_agent.py connects a Groq LLM to this server over real MCP (via langchain-mcp-adapters), instructs it to verify before asserting, and watches it catch its own mistake:

pip install -r requirements-demo.txt
export GROQ_API_KEY=gsk_...                       # real Groq agent
python examples/self_checking_agent.py

python examples/self_checking_agent.py --offline  # no key: scripted LLM, REAL MCP verification
[offline] Question: Is (x+1)^2 equal to x^2 + 1? If not, what is the correct expansion?

  [Assistant] draft answer: "(x+1)^2 = x**2 + 1"
  → verify_math((x+1)**2, claimed_result=x**2 + 1)  [real MCP call]
    MCP result: verified=False  —  expression simplifies to (x + 1)**2, not x**2 + 1
  → verify_math((x+1)**2, claimed_result=x**2 + 2*x + 1)  [real MCP call]
    MCP result: verified=True

  [Assistant] Corrected: (x+1)^2 = x^2 + 2x + 1 — verified, not x^2 + 1.

Deploy remotely (Amazon Bedrock AgentCore Gateway)

The HTTP transport (--http, container in Dockerfile) exposes a standard MCP endpoint at /mcp. Point AgentCore Gateway at it to turn these verifiers into tools any Bedrock agent can call:

docker build -t verifier-mcp .
docker run -p 8000:8000 verifier-mcp          # MCP over HTTP at http://localhost:8000/mcp

The sandbox

run_code executes snippets in a fresh python -I -S subprocess with no inherited environment, a temp working dir, and POSIX resource limits (CPU, memory, no forking, no file writes) plus a wall-clock timeout. That is appropriate for a local dev tool. For untrusted, multi-tenant use, run the whole server inside a container / gVisor / Firecracker — the subprocess limits are defense-in-depth, not a complete jail. On Windows the CPU/memory/fork limits are not applied (only the timeout), so prefer running it in a container there.


Tests

pip install -e ".[dev]"
pytest -q      # all pass — tool logic + MCP protocol registration/dispatch

Tech stack

Model Context Protocol (FastMCP) · SymPy · jsonschema · Pint · FastAPI · Docker · GitHub Actions · Amazon Bedrock AgentCore Gateway–ready

License

MIT © Arash Omranpour

Metadata

Release files for verifier-mcp 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for verifier-mcp 0.1.0
File Size Uploaded Provenance Actions
verifier_mcp-0.1.0.tar.gz 134.3 kB With provenance Details for verifier_mcp-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for verifier-mcp 0.1.0
File Interpreter ABI Platform Actions
verifier_mcp-0.1.0-py3-none-any.whl Python 3 none any Details for verifier_mcp-0.1.0-py3-none-any.whl

Total release size: 152.5 kB

Release files / verifier_mcp-0.1.0.tar.gz

Download URL verifier_mcp-0.1.0.tar.gz
Size 134.3 kB
Tags Source
SHA-256 checksum
How to use checksums
99faeb750c6257771c7df3265fbd1be16222d1eba27048726fd694a498f6415c
BLAKE2b-256 checksum
How to use checksums
a51f80679c78c1000717fda695be95e829b34e4d696c131a381a916c0e340963
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 4, 2026.

Transparency log

Release files / verifier_mcp-0.1.0-py3-none-any.whl

Download URL verifier_mcp-0.1.0-py3-none-any.whl
Size 18.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8a4466219f902ede79bd27720104abd3d6b5abb2425647c7578e6f0410668b19
BLAKE2b-256 checksum
How to use checksums
5f3bda703a5698d3a02c64dc8593186312f4922cd946dea81cb35d387480ef30
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 4, 2026.

Transparency log

Security for verifier-mcp 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for verifier_mcp-0.1.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 4, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page