ENICar MCP Code Reviewer
Provides tools for fetching GitHub pull request diffs and posting inline review comments to PRs, using a GitHub REST client and webhook signature verification.
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
ENICar MCP Code Reviewer
A multi-agent pull request reviewer built on Claude tool calling, LangGraph, FastAPI, and a custom Model Context Protocol (MCP) server. It reads a pull request diff, detects bugs and security vulnerabilities, pauses for human approval via LangGraph interrupts, and posts inline review comments to GitHub.
It also ships with a 30-case evaluation suite of PR diffs with seeded bugs so prompt or model changes are measured objectively.
Developed and maintained by Oussama Mejri, engineering student at ENICarthage (École Nationale d'Ingénieurs de Carthage).
Architecture & Workflow
flowchart LR
GH["GitHub PR"] -->|"Webhook (HMAC-SHA256)"| S["FastAPI Service\n(server.py)"]
S --> F["fetch_diff"]
F --> P["1. Planner"]
P --> R["2a. Security & Code Reviewer"]
P --> T["2b. Sandboxed Test Runner"]
R --> Z["3. Summarizer"]
T --> Z
Z --> H{"4. Human Approval\n(LangGraph interrupt)"}
H -->|"Approved"| POST["5. post_review"]
H -->|"Rejected"| E(("END"))
POST --> GH
subgraph MCP ["Custom MCP Server (mcp_server.py)"]
M1["get_pr_diff"]
M2["read_file"]
M3["run_tests"]
M4["post_review_comment"]
end
CD["Claude Desktop / MCP Client"] --> M1Related MCP server: github-pr-review-mcp-server
Components Overview
Component | Purpose |
| MCP server (Python MCP SDK) exposing |
| LangGraph workflow: |
| Explicit Claude tool-calling loop with schema-validated Pydantic |
| FastAPI webhook service verifying |
| Unified diff parser that prefixes lines with new-file line numbers for accurate inline GitHub comments. |
| GitHub REST client & local workspace abstraction, separating inline hunk comments from body comments. |
| Sandboxed test runner scoped to |
| Command-line interface ( |
| 30 seeded-bug PR diffs across security, correctness, concurrency, reliability, and performance with precision/recall & latency reporting. |
| Ruff lint, unit tests, Docker image build, and automated evaluation workflow. |
| Deployment guide for AWS EC2 with Docker and Caddy HTTPS. |
Quick Start
git clone https://github.com/oussama-mejri007/enicar-mcp-code-reviewer.git
cd enicar-mcp-code-reviewer
python -m venv .venv
# Linux / macOS:
source .venv/bin/activate
# Windows:
# .venv\Scripts\activate
pip install -e ".[dev]"
cp .env.example .env # Add ANTHROPIC_API_KEY and GITHUB_TOKEN
pytest -q # Runs unit tests with fake client (no API key needed)
review-agent review owner/repo#42 # Review a GitHub PR (prompts before posting)
review-agent review --diff my.diff # Review a local diff fileUsing as an MCP Server (Claude Desktop)
Add the following configuration to claude_desktop_config.json:
{
"mcpServers": {
"code-review": {
"command": "/path/to/.venv/bin/review-agent-mcp",
"env": { "GITHUB_TOKEN": "ghp_..." }
}
}
}Or launch via streamable HTTP:
review-agent-mcp --httpThen ask your MCP client: "Get the diff for oussama-mejri007/demo PR 3 and point out any security issues."
Evaluation Suite
python -m evals.run_eval # Run all 30 seeded-bug cases
python -m evals.run_eval --model claude-haiku-4-5-20251001 --limit 10Each case pairs realistic code changes with a planted bug (SQL injection, unverified JWTs, missing authorization, off-by-one pagination, TOCTOU races, SSRF, N+1 queries, etc.). A bug counts as detected when a comment lands on the target file within two lines of the planted bug; extra comments count as false positives. Results are exported to evals/results/ as JSON and Markdown.
Design Decisions
Explicit Tool Loop: Enforced
tool_choice: anywith Pydantic schema validation onsubmit_result, feeding validation errors back to the model and tracking exact token usage per node.Line-Numbered Diffs: Every hunk line is prefixed with its new-file line number so inline GitHub comments target the right line reliably.
Human-in-the-Loop Interrupts: LangGraph pauses at
human_approvaland checkpoints state in SQLite, surviving restarts while waiting for maintainer review.Safe Inline vs. Body Splitting: Comments outside diff hunks automatically move into the review summary body so GitHub never rejects the full review.
Sandboxed Test Execution: Runs exclusively inside
REVIEW_WORKDIR, disabled by default in webhook mode, with non-root execution inside Docker.
Project Layout
enicar-mcp-code-reviewer/
├── .github/workflows/ci.yml # Lint, pytest, Docker build & eval workflow
├── assets/banner.svg # Project header banner
├── docs/deploy-aws.md # AWS EC2 + Caddy deployment guide
├── evals/ # 30 seeded-bug cases & evaluation runner
├── src/review_agent/
│ ├── cli.py # CLI entrypoint
│ ├── diff.py # Unified diff parser & line numbering
│ ├── graph.py # LangGraph multi-agent workflow
│ ├── llm.py # Claude tool-calling loop & token accounting
│ ├── mcp_server.py # MCP server exposing GitHub & test tools
│ ├── schemas.py # Pydantic output schemas
│ ├── server.py # FastAPI webhook & approval API
│ ├── tools.py # Sandboxed test runner
│ └── workspace.py # GitHub & local workspace abstraction
├── tests/ # Unit tests (fake client, no network required)
├── Dockerfile # Non-root production container
├── LICENSE # MIT License (Oussama Mejri)
└── pyproject.toml # Package metadata & dependenciesLicense
This project is licensed under the MIT License — see the LICENSE file for details.
Copyright (c) 2026 Oussama Mejri (ENICarthage)
Author
Oussama Mejri
Engineering Student at ENICarthage (École Nationale d'Ingénieurs de Carthage)
GitHub: @oussama-mejri007
Email: mejri3954@gmail.com
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
This server cannot be deployed
Maintenance
Related MCP Connectors
MCP server for the GitCore API, enabling AI agents to interact with GitCore repositories, issues, pull requests, and more.
GitHub Copilot MCP: code, repo, PR, workflow tools for AI assistants.
MCP server exposing Buildkite API data (pipelines, builds, jobs, tests) to AI tooling and editors.
Nifty's MCP server — exposes tasks, projects, messages, and files as tools for AI agents.
Related MCP Servers
- FlicenseNot gradedqualityDmaintenanceExposes Claude Code's file editing, command execution, and test running capabilities as composable MCP tools for any MCP-compatible host, enabling code operations via a stateless bridge.-
- AlicenseNot gradedqualityDmaintenanceA focused Model Context Protocol server for triaging and reviewing GitHub pull requests from Claude Desktop, Cursor, and other stdio-compatible MCP clients.MIT
- FlicenseNot gradedqualityDmaintenanceEnables Claude to pull a live GitHub pull request's diff and CI check status and to post review findings back as comments on that PR, via three tools over stdio.-
- AlicenseNot gradedqualityBmaintenanceEnables AI assistants to query GitHub repository data through read-only tools, including repo metadata, issues, pull requests, commit statuses, PR diffs, and recent commits. Works with any MCP-compatible client over stdio or Streamable HTTP.1ISC