Code Review MCP Server
Provides tools for listing pull requests, retrieving PR details and diffs, reading repository files, and fetching project metadata to facilitate automated code reviews.
Enables analysis of merge requests by providing tools to list MRs, fetch detailed information and diffs, read project files, and access repository metadata.
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., "@Code Review MCP ServerReview the diff for GitHub PR #105 and check it for security 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.
Code Review MCP Server
An MCP server designed to act as a Read-Only Intelligence Provider for code reviews. It connects LLMs (like Claude Desktop or Gemini) to your Git hosting platforms (GitLab & GitHub) to analyze Merge/Pull Requests, understand project context, and provide expert feedback.
Features
Platform Agnostic: Supports both GitLab and GitHub.
List PRs/MRs: See what needs review.
Get Details: Understand the description, author, and intent.
Get Diff: Retrieve and analyze code changes.
Read Files: Fetch specific files from repositories at any ref (commit, branch, tag).
Custom Guidelines: Configure your own code review guidelines.
Installation & Setup
You can use this MCP server in two ways:
Option A: Global Installation (Recommended)
Install the package globally via npm:
npm install -g mcp-server-code-reviewOption B: Clone & Build (For Development)
Clone the repository and build it locally:
git clone <your-repo-url> mcp-server-code-review
cd mcp-server-code-review
npm install
npm run buildConfiguration
The server requires environment variables for authentication. You should add these to your MCP Client configuration (e.g., Claude Desktop).
Environment Variables
Variable | Description | Required For |
| Your GitLab Personal Access Token. | GitLab |
| GitLab instance URL (default: | GitLab (Self-Managed) |
| Your GitHub Personal Access Token. | GitHub |
| Path to a file containing custom code review guidelines. | Optional (Custom Rules) |
| Inline custom code review guidelines text. | Optional (Custom Rules) |
Note: At least one of
GITLAB_TOKENorGITHUB_TOKENmust be provided. IfCODE_REVIEW_GUIDELINES_FILEis set, it takes precedence overCODE_REVIEW_GUIDELINES.
MCP Server Configuration
Using Global Installation
{
"mcpServers": {
"code-review": {
"command": "mcp-server-code-review",
"env": {
"GITLAB_TOKEN": "your_token_here",
"GITHUB_TOKEN": "your_token_here"
}
}
}
}Using Local Clone
Replace /absolute/path/to/... with the actual full path to the project directory.
{
"mcpServers": {
"code-review": {
"command": "node",
"args": ["/absolute/path/to/mcp-server-code-review/dist/index.js"],
"env": {
"GITLAB_TOKEN": "your_token_here",
"GITHUB_TOKEN": "your_token_here"
}
}
}
}With Self-Managed GitLab
{
"mcpServers": {
"code-review": {
"command": "mcp-server-code-review",
"env": {
"GITLAB_TOKEN": "your_token_here",
"GITLAB_URL": "https://gitlab.yourcompany.com"
}
}
}
}With Custom Code Review Guidelines
You can provide custom guidelines either as a file path or inline text:
{
"mcpServers": {
"code-review": {
"command": "mcp-server-code-review",
"env": {
"GITHUB_TOKEN": "your_token_here",
"GITLAB_TOKEN": "your_token_here",
"GITLAB_URL": "https://gitlab.yourcompany.com",
"CODE_REVIEW_GUIDELINES_FILE": "/path/to/your/guidelines.md"
}
}
}
}Or use inline guidelines:
{
"mcpServers": {
"code-review": {
"command": "mcp-server-code-review",
"env": {
"GITHUB_TOKEN": "your_token_here",
"CODE_REVIEW_GUIDELINES": "Focus on performance and security. Ensure all functions have proper error handling."
}
}
}
}Claude Desktop Configuration
Add the following to your claude_desktop_config.json file.
Path locations:
macOS:
~/Library/Application Support/Claude/claude_desktop_config.jsonWindows:
%APPDATA%\Claude\claude_desktop_config.jsonLinux:
~/.config/Claude/claude_desktop_config.json
Claude Code (CLI) Configuration
Add the following to your settings.json file for global configuration, or .claude/settings.local.json in your project directory for project-specific configuration.
Path locations (global):
macOS:
~/.claude/settings.jsonWindows:
%USERPROFILE%\.claude\settings.jsonLinux:
~/.claude/settings.json
Gemini Configuration
Add the following to your settings.json file.
Path locations:
macOS:
~/.gemini/settings.jsonWindows:
%USERPROFILE%\.gemini\settings.jsonLinux:
~/.gemini/settings.json
ChatGPT Configuration
Add the following to your mcp.json file.
Path locations:
macOS:
~/.chatgpt/mcp.jsonWindows:
%USERPROFILE%\.chatgpt\mcp.jsonLinux:
~/.chatgpt/mcp.json
Available Tools
GitHub Tools
Tool | Description |
| List pull requests with optional status filter |
| Get detailed information about a pull request |
| Retrieve code changes/diff for a pull request |
| Read file content at a specific ref |
| Fetch README and manifest files (package.json, etc.) |
GitLab Tools
Tool | Description |
| List merge requests with optional status filter |
| Get detailed information about a merge request |
| Retrieve code changes/diff for a merge request |
| Read file content at a specific ref |
| Fetch README and manifest files (package.json, etc.) |
Available Prompts
Prompt | Description |
| Guided GitLab MR review with Principal Engineer perspective |
| Guided GitHub PR review with Principal Engineer perspective |
These prompts instruct the LLM to:
Act as a Principal Software Engineer
Focus on logic errors, race conditions, security issues, and architectural alignment
Provide structured feedback (Summary, Critical Issues, Suggestions, Nitpicks)
Request issue/ticket details for additional context
Development & Debugging
Run Unit Tests
npm test # Run all tests
npm run test:coverage # Run tests with coverage reportFormat Code
npm run format # Format code with Prettier
npm run format:check # Check code formattingTest with MCP Inspector
The MCP Inspector allows you to test the server and tool calls interactively in your browser without needing the Claude Desktop app.
Build the project:
npm run buildRun the Inspector: (Replace tokens with your actual values)
GITLAB_TOKEN=your_token npx @modelcontextprotocol/inspector node dist/index.jsOpen:
http://localhost:6274(or the port shown in terminal).
License
ISC
This server cannot be installed
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
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/danielefavi/mcp-server-code-review'
If you have feedback or need assistance with the MCP directory API, please join our Discord server