MCP server for LLM-powered code review — GitHub PRs, GitLab MRs, local diffs
Project description
mcp-code-review
An MCP server that brings structured code review into any MCP-compatible client. Review GitHub Pull Requests, GitLab Merge Requests, and local git diffs — with static analysis, project conventions, and multi-language report output.
Features
- Review GitHub PRs and GitLab MRs by URL
- Review local git diffs against any base branch
- Review individual files with static analysis
- Scan entire projects for issues
- Post review comments back to GitHub PRs and GitLab MRs
- Static analysis via Ruff (linting) and Bandit (security)
- Project conventions loaded from
.codereview.ymlor auto-detected - Multi-language report output: English, Italian, Spanish
- Configurable review focus: all, security, performance, quality
- Saves review reports as Markdown files
Installation
Install the base package:
pip install mcp-code-review
Install with Python static analysis tools (Ruff + Bandit):
pip install "mcp-code-review[python]"
Quick Start
Add mcp-code-review to your MCP client configuration.
Claude Code (~/.claude/claude_desktop_config.json):
{
"mcpServers": {
"mcp-code-review": {
"command": "mcp-code-review",
"env": {
"GITHUB_TOKEN": "ghp_your_token_here",
"GITLAB_TOKEN": "glpat_your_token_here"
}
}
}
}
Cursor (.cursor/mcp.json in project root or ~/.cursor/mcp.json globally):
{
"mcpServers": {
"mcp-code-review": {
"command": "mcp-code-review",
"env": {
"GITHUB_TOKEN": "ghp_your_token_here"
}
}
}
}
Once configured, tools are available in the assistant context. Example prompts:
- "Review the PR at https://github.com/org/repo/pull/42"
- "Review the local diff against main, focus on security"
- "Review the file src/auth.py"
Tools
| Tool | Description |
|---|---|
review_github_pr |
Fetch and review a GitHub Pull Request by URL |
review_gitlab_mr |
Fetch and review a GitLab Merge Request by URL |
review_diff |
Review local git diff against a base branch |
review_file |
Review a single file with static analysis |
review_project |
Scan an entire project: structure, deps, security |
post_github_review |
Post review comments on a GitHub PR |
post_gitlab_review |
Post review comments on a GitLab MR |
save_review_report |
Save a review report as a Markdown file |
get_conventions |
Get project conventions from config or auto-detect |
list_analyzers |
List available static analysis tools |
All tools accept a focus parameter ("all", "security", "performance", "quality") and a locale parameter for report language.
Configuration
Environment Variables
| Variable | Description | Default |
|---|---|---|
GITHUB_TOKEN |
GitHub personal access token | — |
GITLAB_TOKEN |
GitLab personal access token | — |
GITLAB_URL |
GitLab instance base URL | https://gitlab.com |
REVIEW_LOCALE |
Default report language (en, it, es) |
en |
REVIEW_OUTPUT_DIR |
Directory for saved review reports | . |
.codereview.yml
Place a .codereview.yml file at the root of a project to configure conventions:
language: python
framework: fastapi # optional: django, flask, fastapi
locale: en # en | it | es
ignore:
- "migrations/**"
- "tests/**"
severity_overrides:
E501: warning # downgrade line-length errors to warnings
custom_rules:
max_function_lines: 50
require_docstrings: true
If no .codereview.yml is found, the server auto-detects the language and framework from project files (pyproject.toml, requirements.txt, import patterns).
Multi-Language Support
Review reports can be generated in English, Italian, or Spanish. Set the language per-request via the locale parameter, or globally via the REVIEW_LOCALE environment variable or the locale key in .codereview.yml.
Supported locales:
| Code | Language |
|---|---|
en |
English |
it |
Italian |
es |
Spanish |
Development
Clone the repository and install dependencies with uv:
git clone https://github.com/mauriziomocci/mcp-code-review.git
cd mcp-code-review
uv sync --extra python
Run the test suite:
uv run pytest tests/ -v
Run linting:
uv run ruff check src/
License
MIT License. See LICENSE for details.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file mcp_code_review-0.1.0.tar.gz.
File metadata
- Download URL: mcp_code_review-0.1.0.tar.gz
- Upload date:
- Size: 121.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.26 {"installer":{"name":"uv","version":"0.9.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1fae6d597c1e1ebb8c2cb7a6a42a78fe59e462d237136585dc4c8862aa68f2f5
|
|
| MD5 |
35426955f065a1a1e4ca06b5ef347514
|
|
| BLAKE2b-256 |
d66452aa965f9a7ccea57c063c0c2ffa2673417b3c0622518e9057bc4e92abbf
|
File details
Details for the file mcp_code_review-0.1.0-py3-none-any.whl.
File metadata
- Download URL: mcp_code_review-0.1.0-py3-none-any.whl
- Upload date:
- Size: 19.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.26 {"installer":{"name":"uv","version":"0.9.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8702915b6aaaa792935efaf0920d1bef1da82eededf78df383d5983a8979f01c
|
|
| MD5 |
c88169f919a593ce48ff01c3449cd944
|
|
| BLAKE2b-256 |
b826d65051500d8045cdc94e2a104cf447c3722cd4386f43b87a31c2936592dd
|