AI-Code-Reviewer
Allows reviewing diffs from local Git repositories, computing diffs from base and head refs, or accepting explicit diff text.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@AI-Code-Reviewer Review the latest commit diff for coding style issues"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
ai-code-reviewer-mcp
An AI code reviewer, shipped as an installable MCP server. It reviews a diff/PR against a target repository's own coding conventions — learned via RAG over that repo's real code, docs, and lint config — rather than a fixed, generic linter ruleset.
Point it at any repo, ask it to review a diff, and it comes back with findings that cite the actual file:line in that repo the convention came from — not generic advice.
How it works
MCP Host (Claude Code / Cursor / Claude Desktop)
│ stdio (JSON-RPC over MCP)
▼
FastMCP server (Python)
├── index_repo / get_index_status — RAG indexing pipeline
├── explain_convention — one-shot grounded Q&A over the index
└── review_diff / review_file — LangGraph multi-step review agent
│
▼
Local state: ~/.ai-code-reviewer-mcp/<repo-hash>/{chroma/, manifest.sqlite}
│
▼ (only the review-generation/critic LLM calls leave the laptop)
Gemini API (gemini-flash-lite-latest, free tier)Retrieval, chunking, and the vector store all run locally and for free — chunking
is done with Python's ast module at symbol boundaries (one chunk per function/method/
class, not prose-style sliding windows), and embeddings are computed on-device via
fastembed (sentence-transformers/all-MiniLM-L6-v2,
ONNX runtime, no GPU/torch needed). Only the review-generation and critic steps call
Gemini's API.
The review agent (LangGraph)
review_diff runs a mostly-linear graph with exactly one bounded conditional loop:
parse_diff → retrieve_conventions → generate_hunk_review → critic_selfcheck ─┐
▲ │
└──────────── (weak citation, retry-capped at 1) ───────┘
│
aggregate_and_dedup ◄┘
│
format_outputgenerate_hunk_review— one structured-output Gemini call per diff hunk. The model must cite achunk_idfrom the retrieved conventions — it can't free-type a file:line, which is what prevents hallucinated citations.critic_selfcheck— two independent passes: (a) a deterministic check (no LLM) that every cited chunk really exists in the retrieved set and that the repo hasn't changed since indexing; (b) an LLM judgment pass that keeps/downgrades/ suppresses each finding and can trigger one bounded re-retrieval if the citation looks weak.
The graph is kept linear everywhere else on purpose — the parse → retrieve → generate → critique → aggregate sequence is fully knowable upfront, so a dynamic planner node would add complexity without payoff. The one retry loop is the actual justification for using LangGraph over a plain function pipeline here.
Related MCP server: grippy-code-review
Tools exposed
Tool | Purpose |
| (Re)index a local repo's source/docs/lint-config. Incremental — only files whose git blob sha changed are re-embedded. |
| Whether a repo is indexed, and whether the index is stale vs. current HEAD. |
| Review a diff (or |
| Whole-file review fallback — same pipeline, file treated as fully added. |
| Ask a plain-English question about the repo's conventions, grounded in retrieved chunks. |
| Health check. |
Install
Requires uv and a free Gemini API key from
Google AI Studio (no credit card).
git clone <this-repo>
cd ai-code-reviewer-mcp
uv syncCreate a .env file (gitignored) with your key:
GEMINI_API_KEY=AIza...Add to an MCP host
Point your host's MCP config at this directory:
{
"mcpServers": {
"ai-code-reviewer": {
"command": "uv",
"args": ["--directory", "/absolute/path/to/ai-code-reviewer-mcp", "run", "ai-code-reviewer-mcp"],
"env": { "GEMINI_API_KEY": "AIza..." }
}
}
}(Config file location differs per host — Claude Desktop, Claude Code, and Cursor each have their own; check that host's current docs.)
Usage
index_repo(repo_path="/path/to/some/repo")review_diff(repo_path="/path/to/some/repo", base_ref="HEAD~1", head_ref="HEAD")— or pass an explicitdiffstring.explain_convention(repo_path="...", question="how should I raise a custom error here?")
Eval results
uv run python evals/run_eval.py runs 6 hand-authored fixtures (2 clean, 4 with a
known convention violation) against a small fixture repo, and checks two things:
Grounding — for every finding produced, the cited
(file, line_start, line_end)is verified to really exist in the repo and the cited snippet is checked against the real file content. Last run: 5/5 citations verified (100%) — this is the claim that matters most for this product.Directional precision/recall against the hand-labeled expected findings. Last run: 4/6 cases passed on
gemini-flash-lite-latest(free tier) — zero false positives across all 6 cases, but two recall misses (one of two co-located issues in a single hunk, and a print-vs-logging convention). This is a small, honest sanity check on a tiny fixture set, not a rigorous benchmark, and it's not prompt-tuned against its own fixtures — the whole point of the grounding check above is to keep that discipline honest.
Design notes / scope cuts
Python-only chunking via the stdlib
astmodule — deliberate v1 scope cut. Multi-language support would meantree-sitter, whose grammar-package compatibility churns across versions; not worth the risk for a portfolio-scoped v1.Dense-only retrieval (Chroma + fastembed) — no BM25/hybrid fusion or reranking yet. A complete, legitimate v1 on its own; hybrid search is the first thing to add if this project continues.
Per-repo index state lives under
~/.ai-code-reviewer-mcp/<hash>/, not inside the target repo — avoids writing generated vector-store files into someone else's repo.No GitHub API integration —
review_difftakes diff text directly or computes it from local git refs; no automated PR fetching or webhook bot in v1.Rate-limit aware — free-tier Gemini keys have real per-minute quotas; LLM calls retry with backoff on 429 rather than failing the whole review.
v2 ideas
GitHub webhook bot that posts review comments automatically; Java support via
tree-sitter; per-repo .ai-code-reviewer.yml for severity/category tuning; real hybrid
search + reranking; a standalone trace-visualizer; multi-repo convention-drift
detection; prompt caching for the repeated retrieved-context portion of prompts.
Available Tools
6 toolsexplain_conventionA
Answer a question about a repo's own coding conventions, grounded in chunks retrieved from that repo's indexed code/docs/config (run index_repo first).
Inputs: question (required), repo_path (required). Returns: answer, citations
get_index_statusA
Report whether a repo has been indexed, whether the index is stale relative to its current HEAD commit, and basic index size stats.
Inputs: repo_path (required). Returns: stale, indexed, indexed_at, total_files, +4 more
index_repoA
Index (or incrementally re-index) a local git repository's source, docs, and lint/format config so its own conventions can be retrieved during review. Only files whose git blob sha changed since the last index are re-chunked/re-embedded, unless force=True.
Inputs: repo_path (required), force, exclude_globs, include_globs. Returns: status, files_indexed, files_removed, chunks_indexed, +3 more
pingA
Health check — confirms the server is reachable and responding over MCP.
Inputs: no named parameters. Returns: result
review_diffA
Review a diff against this repo's own conventions, grounded via RAG over its
indexed code/docs/config (run index_repo first). If diff is omitted, computes
git diff base_ref..head_ref in repo_path.
Inputs: repo_path (required), diff, base_ref, head_ref, +1 more. Returns: summary, findings, trace_id, hunks_reviewed, +2 more
review_fileA
Whole-file review — a simpler fallback that reuses the same review pipeline as review_diff, with the entire file synthesized as an all-added unified diff.
Inputs: file_path (required), repo_path (required), head_ref. Returns: summary, findings, trace_id, hunks_reviewed, +2 more
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 6 tools
Each tool serves a distinct purpose: ping for health, index_repo for indexing, get_index_status for checking indexing state, explain_convention for Q&A on conventions, and review_diff/review_file for reviewing code changes. No two tools overlap in functionality.
Most tool names follow a consistent verb_noun pattern (e.g., index_repo, review_diff), but 'ping' deviates as a noun-only name. This minor inconsistency is acceptable.
With 6 tools, the server is well-scoped for its purpose of indexing and reviewing code conventions. Each tool earns its place, covering indexing, status, health, and two review methods.
The tool set covers the core workflow (index, check status, review diff/file, explain conventions). Missing a tool to retrieve all conventions or clear the index are minor gaps, but the essential review cycle is complete.
Maintenance
Related MCP Connectors
Team memory for AI coding agents and code reviews, reviewed by humans and served over MCP.
An MCP server that gives your AI access to the source code and docs of all public github repos
One MCP server for all your MCP servers: code mode, per-tool permissions, approvals and audit.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceAn MCP server that automates code reviews through linting, testing, and git diff analysis. It also generates conventional commit messages and detailed pull request descriptions based on file changes and code patterns.ISC
- AlicenseNot gradedqualityCmaintenanceOpen-source AI code review MCP server for local git diff auditing with deterministic security rules and AI-powered analysis using any OpenAI-compatible model.4MIT
- AlicenseAqualityDmaintenanceAn MCP server that performs automated code reviews by analyzing git diffs against configurable review standards with custom reviewer personas.72MIT
- AlicenseNot gradedqualityDmaintenanceMCP server for reviewing code changes using LLMs, supporting Copilot, Ollama, and OpenAI-compatible endpoints.MIT