Skip to main content

Code Review Agent MCP

AI code review agent that doesn't sugarcoat. If your code is bad, it tells you. Bluntly.

PyPI version Python 3.10+ License: MIT Code style: ruff

An AI-powered MCP (Model Context Protocol) server that reviews your code the way experienced maintainers review patches on serious projects: technically, directly, without diplomacy.

What it does

  • AI code review — reviews code snippets, files, git diffs, and commits
  • Returns findings with severity labels: CRITICAL, MAJOR, MINOR, NIT, CLEAN
  • Cites specific line numbers for every finding
  • Explains why something is bad, then how to fix it
  • Ends with a clear verdict: "Ship it." or "Do not merge until..."
  • No false praise. No hedging. No apologies. No filler.

Why?

Most AI code reviewers are trained to be polite. They preface criticism with "great work but...", they hedge with "you might want to consider...", they soften findings with "this could potentially be an issue".

That's not how serious code review works. On real projects (Linux kernel, PostgreSQL, Redis, SQLite), maintainers review patches directly. They find problems and call them out clearly. They don't exist to make the author feel good — they exist to make the code better.

This MCP encodes that tradition. The personality IS the product.

Anti-RLHF engineering

LLMs are RLHF-trained to be polite. This AI agent fights that with three layers:

  1. System prompt — 12 core principles (code-not-coder, verdict-first, severity labels, line citations, no false praise, no hedging, no apologies, no filler, second person, no demographic references, no refusal, no hallucinated bugs)
  2. Post-processor — strips 40+ banned phrases (hedging, softeners, apologies, filler) from LLM output
  3. Validator — checks output has severity labels, line citations, and verdict; flags vague problem statements as hallucination signals

Tools

Tool Description
review_code Review a code snippet
review_file Review a file from disk (sandboxed)
review_diff Review a git diff
review_commit Review a git commit (git show <ref>)
list_severities List severity labels with definitions

Harshness levels

Level Behavior
gentle Softens language slightly. Still reports all findings.
standard Default blunt review. Direct, technical, no diplomacy.
brutal No softening. "This is wrong." not "This should be changed."
kernel-maintainer Maximum bluntness. Short sentences. Imperative voice.

Installation

pip install code-review-agent-mcp

Or with uv:

uv pip install code-review-agent-mcp

Configuration

Claude Desktop

Add to claude_desktop_config.json:

{
  "mcpServers": {
    "code-review-agent": {
      "command": "python",
      "args": ["-m", "blunt_codereview.server"]
    }
  }
}

Or if installed via pip:

{
  "mcpServers": {
    "code-review-agent": {
      "command": "blunt-codereview-mcp"
    }
  }
}

Cursor

Add to .cursor/mcp.json:

{
  "mcpServers": {
    "code-review-agent": {
      "command": "python",
      "args": ["-m", "blunt_codereview.server"]
    }
  }
}

Usage examples

Review a code snippet

User: Review this code for me

def get_user(username):
    import sqlite3
    conn = sqlite3.connect("users.db")
    cursor = conn.cursor()
    query = f"SELECT * FROM users WHERE username = '{username}'"
    cursor.execute(query)
    return cursor.fetchone()

MCP response:

## Code Review: snippet

### Findings

**CRITICAL** `snippet:7` — SQL injection
The query uses an f-string with user input, allowing SQL injection. Use parameterized queries: `cursor.execute("SELECT * FROM users WHERE username = ?", (username,))`.

### Verdict

Do not merge until CRITICAL is fixed.

Review a file

User: Review src/auth.py

MCP calls review_file with file_path="src/auth.py"
Returns blunt review with line citations.

Review a commit

User: Review the last commit

MCP calls review_commit with commit_ref="HEAD"
Returns blunt review of the diff.

Severity labels

Label When to use
CRITICAL Security vulnerability, data loss, deadlock, RCE, anything that ships broken
MAJOR Logic error, race condition, resource leak, broken edge case, wrong abstraction
MINOR Style, naming, missing test, redundant code, brittle assumption
NIT Cosmetic, formatting, comment wording
CLEAN Explicitly state when a section is fine. Prevents invented-bug bias.

Security

This MCP server implements security sandboxing:

  • File access is sandboxed to the current working directory by default
  • Sensitive paths (.ssh, .aws, .env, /etc/passwd, etc.) are refused
  • Git refs are validated against a strict character whitelist to prevent option injection
  • Subprocess calls use shell=False and disable global git config

See SECURITY.md for the full threat model.

Development

# Install in development mode
pip install -e ".[dev]"

# Run tests
pytest

# Run tests with coverage
pytest --cov=blunt_codereview

Benchmark snippets

The benchmarks/ directory contains 5 regression snippets that verify the reviewer:

  1. SQL injection — expects CRITICAL, line citation, "Do not merge"
  2. Mutable default — expects MAJOR
  3. Clean code (binary search) — expects CLEAN, "Ship it" (anti-hallucination test)
  4. Swallowed exception — expects MAJOR
  5. Off-by-one — expects MAJOR

The clean code benchmark is the most important — it catches hallucination. If the reviewer invents bugs in correct code, the anti-RLHF system is broken.

License

MIT

Acknowledgments

This project encodes the kernel maintainer tradition of code review — a methodology practiced by many senior engineers across many projects (Linux kernel, PostgreSQL, Redis, SQLite, and others). We cite the tradition, not any single practitioner.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

code_review_agent_mcp-0.2.0.tar.gz (45.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

code_review_agent_mcp-0.2.0-py3-none-any.whl (29.6 kB view details)

Uploaded Python 3

File details

Details for the file code_review_agent_mcp-0.2.0.tar.gz.

File metadata

  • Download URL: code_review_agent_mcp-0.2.0.tar.gz
  • Upload date:
  • Size: 45.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for code_review_agent_mcp-0.2.0.tar.gz
Algorithm Hash digest
SHA256 b9993854ba2b729fb5b64fe914ef666ccb8733fc9ef260335b1954faef3ae563
MD5 254e7c1437fadd191b5728a3501c52df
BLAKE2b-256 734c750d05ba117ba54aea9a658a9e74c5d6c9dfdc566f76b37fda1c008e19e3

See more details on using hashes here.

Provenance

The following attestation bundles were made for code_review_agent_mcp-0.2.0.tar.gz:

Publisher: publish.yml on frangelbarrera/code-review-agent-mcp

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file code_review_agent_mcp-0.2.0-py3-none-any.whl.

File metadata

File hashes

Hashes for code_review_agent_mcp-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c3910af50b123dbf3070e1c945216a71c7dabc82a3a9d114c4b579dcb797edab
MD5 d66fb8d3114163eea1dca6505629fbef
BLAKE2b-256 cc5eef9bb6d5b7845467c7f241c6437a33e1f4a94146c7e2a66b114768987cf6

See more details on using hashes here.

Provenance

The following attestation bundles were made for code_review_agent_mcp-0.2.0-py3-none-any.whl:

Publisher: publish.yml on frangelbarrera/code-review-agent-mcp

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 files

0.1.0

2 files

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