Skip to main content
Glama
devatraj

AI-Code-Reviewer

by devatraj

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_output
  • generate_hunk_review — one structured-output Gemini call per diff hunk. The model must cite a chunk_id from 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

index_repo

(Re)index a local repo's source/docs/lint-config. Incremental — only files whose git blob sha changed are re-embedded.

get_index_status

Whether a repo is indexed, and whether the index is stale vs. current HEAD.

review_diff

Review a diff (or git diff base..head computed for you) against the repo's own conventions.

review_file

Whole-file review fallback — same pipeline, file treated as fully added.

explain_convention

Ask a plain-English question about the repo's conventions, grounded in retrieved chunks.

ping

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 sync

Create 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

  1. index_repo(repo_path="/path/to/some/repo")

  2. review_diff(repo_path="/path/to/some/repo", base_ref="HEAD~1", head_ref="HEAD") — or pass an explicit diff string.

  3. 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 ast module — deliberate v1 scope cut. Multi-language support would mean tree-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 integrationreview_diff takes 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 tools
explain_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).

ParametersJSON Schema
NameRequiredDescriptionDefault
questionYes
repo_pathYes

Output Schema

ParametersJSON Schema
NameRequiredDescription
answerYes
citationsYes

TDQS

A4.1/5.0
Behavior4/5

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.

Conciseness5/5

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.

Completeness4/5

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.

Parameters2/5

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.

Purpose5/5

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.

Usage Guidelines4/5

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.

ParametersJSON Schema
NameRequiredDescriptionDefault
repo_pathYes

Output Schema

ParametersJSON Schema
NameRequiredDescription
staleYes
indexedYes
indexed_atYes
total_filesYes
total_chunksYes
embedding_modelYes
current_head_shaYes
last_indexed_commit_shaYes

TDQS

A3.7/5.0
Behavior4/5

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.

Conciseness4/5

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.

Completeness5/5

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.

Parameters1/5

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.

Purpose5/5

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.

Usage Guidelines3/5

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.

ParametersJSON Schema
NameRequiredDescriptionDefault
forceNo
repo_pathYes
exclude_globsNo
include_globsNo

Output Schema

ParametersJSON Schema
NameRequiredDescription
statusYes
files_indexedYes
files_removedYes
chunks_indexedYes
git_commit_shaYes
duration_secondsYes
files_skipped_unchangedYes

TDQS

A3.6/5.0
Behavior3/5

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.

Conciseness5/5

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.

Completeness3/5

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.

Parameters2/5

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.

Purpose5/5

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.

Usage Guidelines3/5

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.

ParametersJSON Schema
NameRequiredDescriptionDefault

No parameters

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

A4.3/5.0
Behavior4/5

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.

Conciseness5/5

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.

Completeness5/5

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.

Parameters4/5

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.

Purpose5/5

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.

Usage Guidelines3/5

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.

ParametersJSON Schema
NameRequiredDescriptionDefault
diffNo
base_refNoHEAD~1
head_refNoHEAD
repo_pathYes
max_findingsNo

Output Schema

ParametersJSON Schema
NameRequiredDescription
summaryYes
findingsYes
trace_idYes
hunks_reviewedYes
duration_secondsYes
findings_suppressed_by_criticYes

TDQS

A4/5.0
Behavior3/5

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.

Conciseness5/5

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.

Completeness4/5

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.

Parameters3/5

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.

Purpose5/5

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.

Usage Guidelines4/5

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.

ParametersJSON Schema
NameRequiredDescriptionDefault
head_refNoHEAD
file_pathYes
repo_pathYes

Output Schema

ParametersJSON Schema
NameRequiredDescription
summaryYes
findingsYes
trace_idYes
hunks_reviewedYes
duration_secondsYes
findings_suppressed_by_criticYes

TDQS

A3.8/5.0
Behavior4/5

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.

Conciseness5/5

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.

Completeness3/5

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.

Parameters1/5

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.

Purpose5/5

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.

Usage Guidelines4/5

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.

  1. 6 tool updatesv0.1.0
    • First observedexplain_convention
    • First observedget_index_status
    • First observedindex_repo
    • First observedping
    • First observedreview_diff
    • First observedreview_file

TDQS

A4/5.0
Disambiguation5/5

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.

Naming Consistency4/5

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.

Tool Count5/5

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.

Completeness4/5

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

ActivitySlowing
ResponsivenessSyncing

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

Related MCP Servers

Latest Blog Posts

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