codereview-mcp
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., "@codereview-mcpreview the latest commit diff"
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.
codereview-mcp
An MCP server that lets an AI coding agent review code with a language model. Point it at a git diff, a file, or a snippet and it returns a structured review with severity levels. It works with any MCP client (Claude Code, Cursor, VS Code, Continue, Windsurf) and supports Ollama (local, the default), OpenAI, Anthropic, OpenRouter, and any OpenAI-compatible server (llama.cpp, vLLM, LM Studio, and similar).
With the default Ollama backend, code never leaves your machine.
What it does
Reviews
git diffoutput, parsing it per file and skipping binaries and deletionsReviews whole files, with language auto-detected from the extension (50+ languages)
Reviews inline snippets in a language you specify
Returns findings tagged by severity: CRITICAL, WARNING, SUGGESTION, NOTE
Retries transient provider failures (rate limits, timeouts, 5xx) with backoff
It is a reviewer, not a gate. The output is advice from a model and should be read by a human, not wired straight into an automatic merge. See SECURITY.md for the threat model, including prompt injection.
Related MCP server: AI-PR-Review-MCP
Install
Requires Python 3.10+. Install from the repository:
pip install git+https://github.com/lfylow/codereview-mcpOr from a clone:
git clone https://github.com/lfylow/codereview-mcp
cd codereview-mcp
pip install .For the default local backend, install Ollama and pull a model. A coding-tuned model gives noticeably better reviews than a small general model:
ollama pull qwen2.5-coder:7b # recommended
# or the smaller default, lighter on RAM:
ollama pull llama3.2:3bThen run the server (it speaks MCP over stdio, so it's normally launched by a client rather than by hand):
codereview-mcp --model qwen2.5-coder:7bTo see which models are installed on your Ollama server:
codereview-mcp --list-modelsConnect an agent
Claude Code
claude mcp add codereview-mcp -- codereview-mcpTo use a hosted provider, pass the environment through:
claude mcp add codereview-mcp --env LLM_PROVIDER=openai --env OPENAI_API_KEY=sk-... -- codereview-mcpVS Code (Copilot) — .vscode/mcp.json
{
"servers": {
"codereview-mcp": { "type": "stdio", "command": "codereview-mcp" }
}
}Cursor — .cursor/mcp.json
{
"mcpServers": {
"codereview-mcp": { "command": "codereview-mcp" }
}
}Continue / Windsurf
Both use the same shape as Cursor: an mcpServers entry with "command": "codereview-mcp".
Add provider keys under an "env" object on that entry if you aren't using Ollama.
Once connected, ask the agent things like "review my staged changes" or "review
src/auth.py" and it will call the matching tool.
Tools
Tool | Use it for |
| Output of |
| A file on disk. Language detected from the extension. |
| A piece of code not yet in a file. |
Providers
Provider | Set | Connection | Notes |
Ollama |
| local server, no key | Code stays on your machine |
OpenAI |
|
| Also any OpenAI-compatible API via |
Anthropic |
|
| |
OpenRouter |
|
| One key, many models — see openrouter.ai/models |
OpenAI-compatible (llama.cpp, vLLM, LM Studio) |
| usually no key | Local servers generally ignore the key |
Authentication is by API key. The hosted providers don't offer an official way to use an account subscription in place of an API key for programmatic API access, so that mode isn't supported.
# OpenRouter
LLM_PROVIDER=openrouter OPENROUTER_API_KEY=sk-or-... codereview-mcp
# local OpenAI-compatible server (e.g. LM Studio on :1234), no key needed
LLM_PROVIDER=openai OPENAI_BASE_URL=http://localhost:1234/v1 codereview-mcp --model my-local-modelModels
Review quality tracks the model. For local use, a coding-tuned model is worth the extra download:
Model | Pull with | Notes |
Qwen2.5-Coder |
| Strong all-round code model; |
Qwen3-Coder |
| Newer Qwen coding model |
DeepSeek-Coder V2 |
| Good multi-language coverage |
Codestral |
| Mistral's code model |
CodeLlama |
| Widely available baseline |
Llama 3.2 3B |
| The default — small and fast, lighter reviews |
Run codereview-mcp --list-models to see what's installed locally. Pick a model with
--model, OLLAMA_MODEL, or the config file.
Configuration
Configuration is read from defaults, then a config file, then environment variables, then CLI flags — each layer overriding the previous one.
Environment variables
Variable | Default | Description |
|
|
|
|
| Ollama server URL |
|
| Ollama model name |
| — | OpenAI API key (optional for local servers) |
|
| OpenAI model name |
| — | Custom OpenAI-compatible endpoint |
| — | Anthropic API key |
|
| Anthropic model name |
| — | OpenRouter API key |
|
| OpenRouter model slug |
|
| OpenRouter endpoint |
|
| Max tokens per response |
|
| Sampling temperature (0–2) |
|
| Per-request timeout in seconds |
|
| Reject inputs larger than this |
|
| Stream responses; falls back to a single request if unsupported |
| — | Override the review prompt (must contain |
Config file
~/.config/codereview-mcp/config.yml on Linux/macOS (respects XDG_CONFIG_HOME),
or %APPDATA%\codereview-mcp\config.yml on Windows:
llm_provider: ollama
ollama_model: llama3.2:3b
temperature: 0.2
max_tokens: 2048CLI flags
codereview-mcp --help
codereview-mcp --version
codereview-mcp --provider openai --model gpt-4o
codereview-mcp --config /path/to/config.yml
codereview-mcp --list-models # list installed Ollama models and exit
codereview-mcp --no-stream # disable streaming
codereview-mcp --verboseExample output
A review of a small Python file looks like this:
## Review: `src/database.py` (python)
🔴 CRITICAL — SQL injection
`f"SELECT * FROM users WHERE id = {user_id}"` interpolates user input into SQL.
Use a parameterized query: `cursor.execute("SELECT * FROM users WHERE id = ?", (user_id,))`
🟡 WARNING — connection never closed
The connection opened on line 2 is never closed. Use a context manager:
`with sqlite3.connect("users.db") as conn:`
🟢 SUGGESTION — use the built-in
`calculate_average` can be `sum(numbers) / len(numbers)`.The exact wording depends on the model you run.
Troubleshooting
"connection refused" / transport errors — Ollama isn't running or isn't on the
expected URL. Start it with ollama serve and check OLLAMA_BASE_URL.
Empty or low-quality reviews — small local models miss things. Try a larger model
(OLLAMA_MODEL=qwen2.5-coder:7b) or a hosted provider.
"Input too large" — the file or diff exceeds MAX_INPUT_CHARS. Review a smaller
chunk or raise the limit.
"API key is required" — set OPENAI_API_KEY or ANTHROPIC_API_KEY for the chosen
provider.
Run with --verbose to see what the server is doing on stderr.
Limitations
Review quality depends entirely on the backing model. Small local models are fast and private but less thorough than large hosted ones.
The tool reviews the added/changed lines of a diff with surrounding context, not the full repository, so it can miss issues that span files.
Output is non-deterministic and advisory. It is not a substitute for tests or human review.
Development
git clone https://github.com/lfylow/codereview-mcp
cd codereview-mcp
pip install -e ".[dev]"
pytest
ruff check src/ tests/
ruff format --check src/ tests/
mypySee CONTRIBUTING.md for more.
License
MIT — see LICENSE.
Available Tools
3 toolsreview_code_fileB
Review an entire source file for bugs and improvements.
Provide the absolute path to a file. Language is auto-detected from the file extension. Supports 50+ languages.
Best for: reviewing new files, complete rewrites, or files where you want a comprehensive analysis of the entire codebase.
| Name | Required | Description | Default |
|---|---|---|---|
| filepath | Yes |
Output Schema
| Name | Required | Description |
|---|---|---|
| result | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations are provided, so the description carries full burden. It does not disclose behavioral traits such as auth needs, rate limits, side effects, or that the tool is read-only.
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?
Description is compact (4 sentences), front-loaded with the main purpose. Slight redundancy in listing 'new files' twice, but overall efficient.
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 only one parameter and an output schema present, description covers basic needs. However, it misses differentiation from sibling tools, which reduces completeness for an agent choosing between tools.
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% (no parameter descriptions in schema). Description adds meaning by stating filepath is absolute and language auto-detected, which is valuable context beyond the bare 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?
Description clearly states the tool reviews entire source files for bugs and improvements, mentions absolute path and language auto-detection. It gives use cases but does not explicitly contrast with siblings like review_code_snippet or review_git_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?
Description provides 'Best for' guidance (new files, rewrites, comprehensive analysis) but lacks explicit when-not-to-use or direct comparisons to sibling tools.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
review_code_snippetA
Review a code snippet (not from a file) in the specified language.
Use this when you have a small piece of code to review that isn't in a file yet, or when you want to review an isolated snippet.
Args: code: The source code to review. language: Programming language (python, javascript, rust, go, etc.)
| Name | Required | Description | Default |
|---|---|---|---|
| code | Yes | ||
| language | No | python |
Output Schema
| Name | Required | Description |
|---|---|---|
| result | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations are provided, so the description bears full responsibility for behavioral disclosure. The description only says 'review' but does not explain what the review entails, what output is returned, or any side effects. Since an output schema exists but isn't described, the agent lacks critical behavioral insights beyond the basic operation.
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 concise with no wasted sentences. It opens with a clear purpose statement, follows with a usage paragraph, and then lists parameters. The structure is front-loaded and easy to parse. 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?
Given the tool's simplicity (2 parameters, one required, no annotations), the description covers the main aspects: what it does, when to use it, and what parameters are needed. However, it omits the output format (despite an output schema existing) and lacks behavioral details. It is minimally adequate but not fully comprehensive.
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%, but the description compensates by listing both parameters in an Args block with brief explanations: 'code: The source code to review' and 'language: Programming language (python, javascript, rust, go, etc.)'. This adds meaning beyond the schema, which only provides titles and types. However, it does not clarify defaults or constraints beyond examples.
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 verb 'review' and the resource 'code snippet' and explicitly distinguishes it from file-based review by saying 'not from a file'. It also mentions the language parameter, making the purpose unambiguous and differentiating it from sibling tools like review_code_file and review_git_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 explicitly states when to use the tool: 'when you have a small piece of code to review that isn't in a file yet, or when you want to review an isolated snippet.' It does not explicitly state when not to use or name alternatives, but the sibling tools provide context for exclusion. This is clear but not exhaustive.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
review_git_diffA
Review a git diff for bugs, security issues, and improvements.
Accepts the output of git diff as plain text. Returns a structured
review with severity levels (🔴 CRITICAL, 🟡 WARNING, 🟢 SUGGESTION, ℹ️ NOTE).
Example: git diff | review_git_diff
| Name | Required | Description | Default |
|---|---|---|---|
| diff | Yes |
Output Schema
| Name | Required | Description |
|---|---|---|
| result | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations provided, but description discloses output format (structured with severity levels). No contradictions.
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 plus example, front-loaded with purpose. No unnecessary text.
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 simplicity (one param, no annotations, has output schema), description covers input format, output format, and usage example completely.
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?
Only one parameter (diff), schema has no description (0% coverage). Description clarifies it accepts 'git diff' output as plain text, adding value beyond 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?
Clearly states it reviews git diffs for bugs, security, and improvements, with a structured output. Distinct from siblings (code file/snippet review).
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?
Describes input (git diff output) and gives example usage. Implicitly distinguishes from siblings, but no explicit when-not to use.
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.
3 tool updates
v0.1.0- First observed
review_code_file - First observed
review_code_snippet - First observed
review_git_diff
TDQS
Each tool targets a distinct input type: file, snippet, or git diff. The descriptions clearly differentiate them, leaving no ambiguity about when to use each.
All tools follow the consistent 'review_<source>' pattern (review_code_file, review_code_snippet, review_git_diff), making naming predictable and clear.
Three tools is appropriate for the code review domain, covering the main scenarios without being too few or too many.
The surface covers the primary use cases: reviewing files, snippets, and diffs. Potential additions like reviewing a pull request or URL are missing but not essential.
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
Hosted MCP server connecting claude.ai, ChatGPT and other AI apps to your own computer
Driflyte MCP server which lets AI assistants query topic-specific knowledge from web and GitHub.
Official MCP server for Agentwork — delegate tasks to AI agents with human-in-the-loop
Related MCP Servers
- AlicenseNot gradedqualityCmaintenanceAn MCP server that provides agentic code review powered by OpenAI-compatible models, designed for use with Claude Code.1MIT
- FlicenseNot gradedqualityDmaintenanceAn MCP server that automates pull request reviews using multiple LLM providers (OpenAI, Claude, Gemini, Groq, Perplexity) and supports GitHub and Bitbucket with real-time webhook integration and interactive AI assistant commands.1-
- AlicenseNot gradedqualityCmaintenanceMCP server for reviewing code changes using LLMs, supporting Copilot, Ollama, and OpenAI-compatible endpoints.MIT
- AlicenseNot gradedqualityBmaintenanceMCP server for automated code review using AI agents. It analyzes code diffs or file paths for bugs, security issues, and style violations.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/lfylow/codereview-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server