The MCP Server for Code Review is a specialized tool that leverages Repomix and Large Language Models to analyze and review code. It flattens codebases and provides structured feedback with specific issues and recommendations, supporting multiple LLM providers including OpenAI, Anthropic, and Gemini.
# Clone the repository
git clone https://github.com/yourusername/code-review-server.git
cd code-review-server
# Install dependencies
npm install
# Build the server
npm run build
Create and edit a .env
file in the root directory with your preferred LLM provider settings:
# Copy the example configuration
cp .env.example .env
Edit the .env
file to set up your preferred LLM provider and API key:
# LLM Provider Configuration
LLM_PROVIDER=OPEN_AI
OPENAI_API_KEY=your_openai_api_key_here
Start the server to make it available to any MCP client:
node build/index.js
The server exposes two main tools:
Use this tool when you need:
Example scenarios:
Use this tool when you need:
Example scenarios:
Available parameters:
specificFiles
: Limit review to certain filesfileTypes
: Focus on specific file extensionsdetailLevel
: Choose 'basic' or 'detailed' analysisfocusAreas
: Prioritize aspects like security or performanceFor testing purposes, you can use the included command-line tool:
node build/cli.js <repo_path> [options]
Options:
--files <file1,file2>
: Specific files to review--types <.js,.ts>
: File types to include--detail <basic|detailed>
: Level of detail (default: detailed)--focus <areas>
: Focus areas (security,performance,quality,maintainability)Example:
node build/cli.js ./my-project --types .js,.ts --detail detailed --focus security,quality
The server supports multiple LLM providers that can be configured in your .env
file:
# Set which provider to use
LLM_PROVIDER=OPEN_AI # Options: OPEN_AI, ANTHROPIC, or GEMINI
# Provider API Keys (add your key for the chosen provider)
OPENAI_API_KEY=your-openai-api-key
ANTHROPIC_API_KEY=your-anthropic-api-key
GEMINI_API_KEY=your-gemini-api-key
# Optional: Override the default models
OPENAI_MODEL=gpt-4-turbo
ANTHROPIC_MODEL=claude-3-sonnet-20240229
GEMINI_MODEL=gemini-1.5-flash-preview
Code reviews are returned in a structured JSON format:
{
"summary": "Brief summary of the code and its purpose",
"issues": [
{
"type": "SECURITY|PERFORMANCE|QUALITY|MAINTAINABILITY",
"severity": "HIGH|MEDIUM|LOW",
"description": "Description of the issue",
"line_numbers": [12, 15],
"recommendation": "Recommended fix"
}
],
"strengths": ["List of code strengths"],
"recommendations": ["List of overall recommendations"]
}
The review provides clear insights into code quality with specific issues categorized by type and severity, along with actionable recommendations for improvement.
To add this MCP server to Claude Code, run this command in your terminal:
claude mcp add-json "code-review" '{"command":"node","args":["build/index.js"]}'
See the official Claude Code MCP documentation for more details.
There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json
file so that it is available in all of your projects.
If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json
file.
To add a global MCP server go to Cursor Settings > Tools & Integrations and click "New MCP Server".
When you click that button the ~/.cursor/mcp.json
file will be opened and you can add your server like this:
{
"mcpServers": {
"code-review": {
"command": "node",
"args": [
"build/index.js"
]
}
}
}
To add an MCP server to a project you can create a new .cursor/mcp.json
file or add it to the existing one. This will look exactly the same as the global MCP server example above.
Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.
The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.
You can also explicitly ask the agent to use the tool by mentioning the tool name and describing what the function does.
To add this MCP server to Claude Desktop:
1. Find your configuration file:
~/Library/Application Support/Claude/claude_desktop_config.json
%APPDATA%\Claude\claude_desktop_config.json
~/.config/Claude/claude_desktop_config.json
2. Add this to your configuration file:
{
"mcpServers": {
"code-review": {
"command": "node",
"args": [
"build/index.js"
]
}
}
}
3. Restart Claude Desktop for the changes to take effect