AI-Code-Reviewer
Allows reviewing diffs from local Git repositories, computing diffs from base and head refs, or accepting explicit diff text.
Click on "Install 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-ReviewerReview 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).
| Name | Required | Description | Default |
|---|---|---|---|
| question | Yes | ||
| repo_path | Yes |
Output Schema
| Name | Required | Description |
|---|---|---|
| answer | Yes | |
| citations | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations provided, so description fully bears responsibility. It discloses grounding in indexed chunks and prerequisite, giving transparency on data source and workflow. Lacks error behavior details, but sufficient for a simple retrieval tool.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
Single sentence with no unnecessary words, clearly front-loading the core purpose and key constraint (grounded in indexed data).
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Covers main aspects: function, prerequisite, data source. Output schema likely fills gaps on return format. Could mention error if repo not indexed, but not essential given simplicity.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
With 0% schema coverage, description must compensate but only implicitly conveys parameter meanings via context. Does not clarify input formats or provide examples, leaving ambiguity.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
Description explicitly states tool answers questions about a repo's coding conventions, using specific verb-resource structure. It distinguishes from siblings like index_repo (precondition) and review_file (file-level) by focusing on conventions.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
Includes clear precondition 'run index_repo first', guiding when to use. Does not explicitly contrast with alternatives like review_diff or review_file, but context implies usage.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
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.
| Name | Required | Description | Default |
|---|---|---|---|
| repo_path | Yes |
Output Schema
| Name | Required | Description |
|---|---|---|
| stale | Yes | |
| indexed | Yes | |
| indexed_at | Yes | |
| total_files | Yes | |
| total_chunks | Yes | |
| embedding_model | Yes | |
| current_head_sha | Yes | |
| last_indexed_commit_sha | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations provided, but the description clearly indicates a read-only reporting operation. It explicitly describes what is checked (indexed status, staleness, size stats). Could mention it is non-destructive, but the word 'Report' implies that.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
Single sentence front-loads purpose and includes relevant details. No wasted words, though could be more succinct.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the tool has one parameter and an output schema, the description is complete. It covers all key aspects of what the tool reports without needing to detail return values.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 0% and the description does not elaborate on the repo_path parameter. The parameter's purpose is obvious but the description fails to add meaning beyond the schema.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the tool reports index status, staleness relative to HEAD, and size stats. It distinguishes from siblings like index_repo (which modifies) and review tools (which review diffs/files).
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
No explicit guidance on when to use or when not to use. Usage is implied by name and description, but no alternatives or exclusions are mentioned.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
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.
| Name | Required | Description | Default |
|---|---|---|---|
| force | No | ||
| repo_path | Yes | ||
| exclude_globs | No | ||
| include_globs | No |
Output Schema
| Name | Required | Description |
|---|---|---|
| status | Yes | |
| files_indexed | Yes | |
| files_removed | Yes | |
| chunks_indexed | Yes | |
| git_commit_sha | Yes | |
| duration_seconds | Yes | |
| files_skipped_unchanged | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations provided, so description carries full burden. It explains incremental re-indexing and the force parameter, but does not disclose potential side effects like time consumption or disk usage. Lacks full behavioral disclosure.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
Two sentences, front-loaded with action and purpose. No extra words; every sentence adds value.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Provides enough context for the tool's operation (incremental indexing) but does not relate to siblings (e.g., get_index_status) or clarify that indexing is a prerequisite for review tools. Output schema exists, so return format not needed.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 0%, so description must compensate. Explains 'force' parameter but does not describe 'repo_path', 'exclude_globs', or 'include_globs' in the description text, leaving agent to infer from schema alone.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
Clearly states the action (index/re-index), the resource (local git repository), and purpose (for convention retrieval). Distinguishes from sibling tools like get_index_status or review_file by describing a preparatory indexing step.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
Implies usage context (before reviews to make conventions available) and describes incremental behavior, but does not explicitly state when to use versus siblings or when not to use. No alternatives mentioned.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
pingA
Health check — confirms the server is reachable and responding over MCP.
| Name | Required | Description | Default |
|---|---|---|---|
No parameters | |||
Output Schema
| Name | Required | Description |
|---|---|---|
| result | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations, description carries full burden; it states the tool is a health check that confirms reachability, which implies a safe read operation. No side effects or additional behavioral details needed for this simple tool.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
Single sentence, zero wasted words; front-loaded with the core purpose.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
For a parameterless health check with an output schema, the description is complete; it accurately conveys the tool's function without needing to detail return values.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
No parameters exist, so baseline is 4 per instructions. Description adds no parameter information, but none is required.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
Clearly states the tool is a health check to confirm server reachability, uses a specific verb 'confirms' and resource 'server reachability'. Distinguishes from sibling tools focused on indexing and reviews.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
Implied usage for verifying server connectivity, but no explicit guidance on when to use versus alternatives (e.g., get_index_status) or when not to use it.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
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.
| Name | Required | Description | Default |
|---|---|---|---|
| diff | No | ||
| base_ref | No | HEAD~1 | |
| head_ref | No | HEAD | |
| repo_path | Yes | ||
| max_findings | No |
Output Schema
| Name | Required | Description |
|---|---|---|
| summary | Yes | |
| findings | Yes | |
| trace_id | Yes | |
| hunks_reviewed | Yes | |
| duration_seconds | Yes | |
| findings_suppressed_by_critic | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations provided, so description carries burden. Explains RAG mechanism and diff omission behavior, but lacks details on findings output, default max_findings, and interaction with index state.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
Two concise sentences with front-loaded key action. No redundant information.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Explains core behavior and prerequisite. With output schema present, need not describe return values. Could add more about findings semantics, but overall sufficient.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
0% schema coverage; description explains diff omission and names parameters, but does not elaborate on base_ref, head_ref, or max_findings beyond defaults.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
Clearly states it reviews a diff against repo conventions via RAG. Explains fallback behavior when diff is omitted. Distinct from siblings.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
Mentions prerequisite to run index_repo first. Does not explicitly state when not to use, but context distinct from sibling tools.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
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.
| Name | Required | Description | Default |
|---|---|---|---|
| head_ref | No | HEAD | |
| file_path | Yes | ||
| repo_path | Yes |
Output Schema
| Name | Required | Description |
|---|---|---|
| summary | Yes | |
| findings | Yes | |
| trace_id | Yes | |
| hunks_reviewed | Yes | |
| duration_seconds | Yes | |
| findings_suppressed_by_critic | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
The description reveals that the tool reuses the review pipeline and synthesizes the file as a unified diff, which explains its behavior. However, with no annotations, additional traits like read-only nature or permission requirements are not disclosed.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is a single, well-structured sentence that conveys the core purpose and mechanism without extraneous words.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
With an output schema present, return values are covered, but the description lacks details on prerequisites, error conditions, or usage context beyond being a fallback.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema coverage is 0% and the description provides no information about the parameters (repo_path, file_path, head_ref), leaving the agent without guidance beyond the schema's titles.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states it performs a whole-file review as a fallback, distinguishing itself from the sibling tool review_diff by specifying it synthesizes the entire file as an all-added unified diff.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description implies usage as a fallback when review_diff is not applicable, but does not explicitly state when to use or not use this tool compared to alternatives.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections. Dates show when Glama detected each change.
6 tool updates
v0.1.0- First observed
explain_convention - First observed
get_index_status - First observed
index_repo - First observed
ping - First observed
review_diff - First observed
review_file
TDQS
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
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Connectors
An MCP server that gives your AI access to the source code and docs of all public github repos
MCP server for visual regression testing: triage a PR's UI diffs from your coding agent.
9118AI-native git hosting — repos, PRs, issues, CI gates, and AI code review over MCP (60 tools).
Related MCP Servers
- FlicenseNot 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.-
- 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
- AlicenseNot gradedqualityDmaintenanceAn MCP server that performs automated code reviews by analyzing git diffs against configurable review standards with custom reviewer personas.2MIT
- AlicenseNot gradedqualityCmaintenanceMCP server for reviewing code changes using LLMs, supporting Copilot, Ollama, and OpenAI-compatible endpoints.MIT
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/devatraj/AI-Code-Reviewer'
If you have feedback or need assistance with the MCP directory API, please join our Discord server