Code Review Agent MCP

Code Review Agent MCP

An AI-powered MCP server that reviews code bluntly, without sugarcoating, citing line numbers and severity labels.

Category
访问服务器

README

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.

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选