Skip to main content
Glama
praneybehl

Claude Code Review MCP

by praneybehl

revisión de código de Claude MCP

Un servidor MCP (Protocolo de Contexto de Modelo) que proporciona funciones de revisión de código mediante modelos OpenAI, Google y Anthropic. Sirve como herramienta de segunda opinión para la revisión de código y puede utilizarse con cualquier cliente MCP, como Claude Code, Claude Desktop, Cursor y Windsurf.

Características

  • Soporte de múltiples proveedores : aprovecha los modelos OpenAI, Gemini de Google y Claude de Anthropic para revisiones de código

  • Dos tipos de revisión : elija entre una revisión estructurada (con comentarios categorizados) o una revisión narrativa de formato libre.

  • Consciente del contexto : incluye la estructura del proyecto, los archivos relacionados, los mensajes de confirmación y las dependencias para revisiones más relevantes

  • Procesamiento de código inteligente : detecta automáticamente lenguajes de programación, maneja archivos grandes y formatea la salida adecuadamente.

  • Manejo robusto de errores : incluye lógica de reintento para fallas de API y recuperación de errores elegante

  • Compatible con MCP : funciona con cualquier cliente MCP (Claude Code, Claude Desktop, Cursor, Windsurf)

  • Fácil configuración : configuración sencilla mediante variables de entorno

Related MCP server: mcp-agent-review

Instalación

Instalación global

npm install -g claude-code-review-mcp

Uso con npx (sin instalación)

# Set environment variables separately
export OPENAI_API_KEY=<key>
npx -y claude-code-review-mcp

# Or use inline environment setting
OPENAI_API_KEY=<key> npx -y claude-code-review-mcp

# Or with Google API key
GOOGLE_API_KEY=<key> npx -y claude-code-review-mcp

# Or with Anthropic API key
ANTHROPIC_API_KEY=<key> npx -y claude-code-review-mcp

# Or use multiple API keys for more model options
OPENAI_API_KEY=<key> GOOGLE_API_KEY=<key> ANTHROPIC_API_KEY=<key> npx -y claude-code-review-mcp

Configuración

El servidor requiere al menos una de las siguientes claves API:

  • OPENAI_API_KEY : Su clave API de OpenAI

  • GOOGLE_API_KEY : Su clave API de Google Gemini

  • ANTHROPIC_API_KEY : Su clave de API antrópica

Configuración opcional:

  • PORT : Puerto del servidor (predeterminado: dinámico - se elegirá un puerto disponible)

  • HOST : Host del servidor (predeterminado: 127.0.0.1)

  • LOG_LEVEL : Nivel de registro (0=DEBUG, 1=INFO, 2=WARN, 3=ERROR; valor predeterminado: 1)

Modelos disponibles

Modelos OpenAI (requiere OPENAI_API_KEY)

  • gpt-4.1 - OpenAI GPT-4.1

  • o4-mini - OpenAI O4 Mini

  • o3-mini - OpenAI O3 Mini

Modelos de Google (requiere GOOGLE_API_KEY)

  • gemini-2.5-pro-preview-05-06 - Google Gemini 2.5 Pro

  • gemini-2.5-flash-preview-04-17 - Google Gemini 2.5 Flash

Modelos antrópicos (requiere ANTHROPIC_API_KEY)

  • claude-3-opus-20240229 - Claude 3 Opus antrópico

  • claude-3-sonnet-20240229 - Soneto antrópico de Claude 3

  • claude-3-haiku-20240307 - Haiku antrópico de Claude 3

Herramientas disponibles

El servidor MCP proporciona tres herramientas:

1. revisiónCódigoEstructurado

Proporciona una revisión de código detallada y estructurada con las siguientes secciones:

  • Resumen general

  • Calidad del código (fortalezas y debilidades)

  • Errores (con gravedad y soluciones sugeridas)

  • Sugerencias de mejora

  • Problemas de seguridad (si los hay)

2. revisiónCódigoFormaLibre

Proporciona una revisión del código narrativo en formato de texto libre, adecuado para impresiones generales y comentarios conversacionales.

3. listModels

Enumera todos los modelos disponibles según las claves API proporcionadas, incluidos los identificadores de modelo y los nombres legibles por humanos.

Integración con Claude Code

Para agregar este servidor MCP a Claude Code:

# Use environment variables properly (recommended approach)
claude mcp add code-review -s user -e OPENAI_API_KEY=<key> -e GOOGLE_API_KEY=<key> -e ANTHROPIC_API_KEY=<key> -- npx -y claude-code-review-mcp

# Alternative: Export the variables before adding the MCP
export OPENAI_API_KEY=<key>
export GOOGLE_API_KEY=<key>
export ANTHROPIC_API_KEY=<key>
claude mcp add code-review -s user -- npx -y claude-code-review-mcp

También puedes crear un comando de barra personalizado creando un archivo en .claude/commands/review-with.md :

I'll review your code using alternative LLM models. Model to use: $ARGUMENTS

Claude Code admite comandos de barra personalizados que puedes crear para interactuar fácilmente con el servidor MCP. Crea estos comandos en el directorio .claude/commands/ de tu proyecto para habilitar flujos de trabajo de revisión de código eficaces.

Configuración básica

Primero, crea el directorio de comandos si no existe:

mkdir -p .claude/commands

Comando de listado de modelos

Crea un comando para enumerar los modelos disponibles:

# Create the list-review-models.md file
cat > .claude/commands/list-review-models.md << 'EOF'
I'll check which alternative code review models are available through our MCP server.

First, I'll use the MCP server to list all available models for code review.
After that, I'll present the models in a clear table format with:
- Model ID (what you'll use when requesting a review)
- Provider (OpenAI or Google)
- Description (size and capabilities)
- Speed (relative performance)

This will help you choose the right model for your code review needs.
EOF

Comando básico de revisión de código

Cree un comando de revisión simple que acepte un nombre de modelo:

# Create the review-with.md file
cat > .claude/commands/review-with.md << 'EOF'
I'll review the code I've just worked on using an alternative LLM model to provide a second opinion.

First, I'll identify the code changes or file you want reviewed. If you don't specify a file, I'll look at recent changes.

Then, I'll send this code to be reviewed by the specified model through our MCP server.

Available models (run /project:list-review-models to see all options):
- OpenAI models (if configured): "gpt-4.1", "o4-mini", "o3-mini"
- Google models (if configured): "gemini-2.5-pro-preview-05-06", "gemini-2.5-flash-preview-04-17"

Model to use (leave blank for default): $ARGUMENTS
EOF

Comando de revisión estructurada

Crea un comando específico para revisiones estructuradas:

# Create the structured-review.md file
cat > .claude/commands/structured-review.md << 'EOF'
I'll perform a structured code review using an alternative LLM model.

This review will be organized into clear sections:
1. Overall summary
2. Code quality assessment (strengths and weaknesses)
3. Potential bugs with severity ratings (Low/Medium/High)
4. Specific improvement suggestions
5. Security considerations (if applicable)

If you don't specify a model, I'll use the default available model.

Model to use (optional): $ARGUMENTS
EOF

Comando de revisión de forma libre

Crear un comando para reseñas de estilo narrativo:

# Create the freeform-review.md file
cat > .claude/commands/freeform-review.md << 'EOF'
I'll provide a conversational, narrative-style code review using an alternative LLM model.

This will be a more holistic assessment of your code with flowing paragraphs rather than structured categories. This style works well for:
- General impressions
- High-level feedback
- More nuanced commentary on code style and approach

If you don't specify a model, I'll use the default available model.

Model to use (optional): $ARGUMENTS
EOF

Revisar comando de archivo específico

Crea un comando para revisar un archivo específico:

# Create the review-file.md file
cat > .claude/commands/review-file.md << 'EOF'
I'll review a specific file using an alternative LLM model.

Please provide the file path to review and optionally the model to use.
Format: [file_path] [model_name]

For example:
- "src/utils.js gemini-2.5-pro-preview-05-06" - Reviews utils.js with Gemini Pro
- "lib/auth.ts" - Reviews auth.ts with the default model

Input: $ARGUMENTS
EOF

Comandos de revisión específicos del enfoque

Crear comandos para revisiones especializadas:

# Create security review command
cat > .claude/commands/security-review.md << 'EOF'
I'll perform a security-focused code review using an alternative LLM model.

This review will specifically examine:
- Potential security vulnerabilities
- Input validation issues
- Authentication/authorization flaws
- Data protection concerns
- Injection vulnerabilities
- Secure coding best practices

If you don't specify a model, I'll use a model recommended for security analysis.

Model to use (optional): $ARGUMENTS
EOF
# Create performance review command
cat > .claude/commands/performance-review.md << 'EOF'
I'll perform a performance-focused code review using an alternative LLM model.

This review will specifically examine:
- Algorithm efficiency
- Memory usage
- Unnecessary computations
- Loop optimizations
- Data structure choices
- Caching opportunities
- Async/parallel processing considerations

If you don't specify a model, I'll use a model that's good at performance analysis.

Model to use (optional): $ARGUMENTS
EOF

Comando de Revisión Integral del Proyecto

Cree un comando para revisar el código con el contexto completo del proyecto:

# Create the project-review.md file
cat > .claude/commands/project-review.md << 'EOF'
I'll perform a comprehensive code review with full project context using an alternative LLM model.

This review will:
1. Analyze the code structure and organization
2. Consider related files and dependencies
3. Evaluate consistency with project patterns
4. Assess integration with existing components
5. Check alignment with project architecture

I'll gather project context, including directory structure and related files, to ensure a thorough, context-aware review.

Format: [file_to_review] [model_name]
Example: "src/components/Button.jsx gemini-2.5-pro-preview-05-06"

Input: $ARGUMENTS
EOF

Comando de revisión antes y después

Crea un comando para comparar cambios de código:

# Create the diff-review.md file
cat > .claude/commands/diff-review.md << 'EOF'
I'll review the changes you've made to a file using an alternative LLM model.

This will:
1. Identify what was changed between versions
2. Evaluate if the changes address the intended purpose
3. Check for any new issues introduced
4. Suggest potential improvements to the changes

I'll need to know which file to examine. If you've been working on a file with Claude Code, I'll automatically find the changes.

Model to use (optional): $ARGUMENTS
EOF

Uso de comandos de barra personalizados

Una vez creados estos comandos, puedes usarlos en Claude Code escribiendo /project: seguido del nombre del comando. Por ejemplo:

/project:list-review-models
/project:review-with gemini-2.5-pro-preview-05-06
/project:structured-review o4-mini
/project:security-review
/project:review-file src/utils.js gemini-2.5-flash-preview-04-17

Consejos para comandos personalizados

  • Descubrimiento de comandos : Escriba /project: en Claude Code para ver una lista de comandos disponibles

  • Modelos predeterminados : si no especifica un modelo, el comando utilizará el modelo predeterminado (normalmente o4-mini si está disponible)

  • Revisiones múltiples : puedes obtener múltiples perspectivas al ejecutar revisiones con diferentes modelos

  • Contexto del proyecto : para las revisiones más relevantes, utilice comandos que incluyan el contexto del proyecto

  • Enfoque especializado : utilice los comandos específicos de enfoque cuando tenga inquietudes particulares sobre seguridad, rendimiento, etc.

Ejemplo de flujo de trabajo

Un flujo de trabajo típico podría verse así:

  1. Trabaja en código con Claude Code

  2. Ejecute /project:list-review-models para ver las opciones disponibles

  3. Ejecute /project:structured-review gemini-2.5-pro-preview-05-06 para obtener una revisión estructurada del modelo de Google

  4. Comparar con las sugerencias de Claude

  5. Realizar mejoras basadas en ambas perspectivas

  6. Ejecute /project:diff-review para revisar los cambios

Estos comandos personalizados permiten una integración fluida entre Claude Code y el servidor claude-code-review-mcp, proporcionando "segundas opiniones" valiosas para su código.

Ejemplo de uso

Iniciar el servidor MCP

# Start with OpenAI API key (using exports, recommended)
export OPENAI_API_KEY=<key>
npx -y claude-code-review-mcp

# Or with inline environment variables
OPENAI_API_KEY=<key> npx -y claude-code-review-mcp

# Start with Google Gemini API key
export GOOGLE_API_KEY=<key>
npx -y claude-code-review-mcp

# Start with Anthropic Claude API key
export ANTHROPIC_API_KEY=<key>
npx -y claude-code-review-mcp

# Use multiple API keys for more model options
export OPENAI_API_KEY=<key>
export GOOGLE_API_KEY=<key>
export ANTHROPIC_API_KEY=<key>
npx -y claude-code-review-mcp

# Use custom port and host
export OPENAI_API_KEY=<key>
export PORT=8080 
export HOST=0.0.0.0
npx -y claude-code-review-mcp

Uso con clientes MCP

Una vez que el servidor esté en funcionamiento, puede conectarse a él desde cualquier cliente MCP, como Claude Code, Claude Desktop, Cursor o Windsurf, usando la URL del servidor. El servidor mostrará la URL y el puerto en sus registros de inicio (usando un puerto asignado dinámicamente para evitar conflictos).

Esquema de entrada

Todas las herramientas de revisión aceptan la siguiente entrada:

{
  code: string;  // Required: The code to review
  filename?: string;  // Optional: The filename with extension
  language?: string;  // Optional: Programming language
  model: string;  // Required: Model ID to use for review
  projectContext?: {  // Optional: Additional context
    projectStructure?: string;  // Directory structure
    relatedFiles?: Array<{  // Related code files
      name: string;  // Filename with path
      language?: string;  // File language
      content: string;  // File content
    }>;
    commitMessage?: string;  // Purpose of changes
    dependencies?: Record<string, string>;  // Project dependencies
  }
}

Esquema de salida

Resultado de la revisión estructurada

{
  review?: {  // Present on success
    summary: string;  // Overall assessment
    quality: {
      strengths: string[];  // Good aspects
      weaknesses: string[];  // Areas for improvement
    };
    bugs: Array<{
      description: string;  // Issue description
      severity: "Low" | "Medium" | "High";  // Impact level
      suggestion: string;  // How to fix
    }>;
    improvements: string[];  // Enhancement suggestions
    securityIssues?: string[];  // Security concerns if any
  };
  modelUsed: string;  // Human-readable model name
  error?: string;  // Present on error
  availableModels?: Record<string, string>;  // Present on error or listModels
}

Salida de revisión de formato libre

{
  reviewText?: string;  // Present on success
  modelUsed: string;  // Human-readable model name
  error?: string;  // Present on error
  availableModels?: Record<string, string>;  // Present on error or listModels
}

Salida de modelos de lista

{
  availableModels: Record<string, string>;  // Model ID to name mapping
  modelUsed: string;  // Always "None" for this tool
}

Integración de clientes MCP

Claude Code

  1. Agregue el servidor MCP:

claude mcp add code-review -s user npx -y claude-code-review-mcp
  1. Uso en el Código Claude:

/code-review:reviewCodeStructured --model o4-mini

Escritorio de Claude

En la configuración de Claude Desktop, configure el MCP de la siguiente manera:

"claude-code-review-mcp": {
  "command": "npx",
  "args": ["-y", "claude-code-review-mcp"],
  "env": {
    "OPENAI_API_KEY": "your-openai-key",
    "GOOGLE_API_KEY": "your-google-key",
    "ANTHROPIC_API_KEY": "your-anthropic-key"
  }
}

El servidor utiliza una desinfección avanzada de salida JSON para lograr una compatibilidad total con todos los clientes MCP, incluido Claude Desktop.

Cursor y Windsurf

Siga las pautas de configuración de MCP específicas para su cliente, utilizando el mismo comando y variables de entorno.

Solución de problemas

Problemas con la clave API

  • "El modelo X no está disponible" : asegúrese de haber proporcionado la clave API adecuada para el modelo.

  • No se proporcionan claves API : debe proporcionar al menos una de las siguientes: OPENAI_API_KEY, GOOGLE_API_KEY o ANTHROPIC_API_KEY.

  • Modelo sugerido : el servidor sugerirá modelos alternativos si el modelo solicitado no está disponible.

Limitación de velocidad y errores de API

  • Si encuentra límites de velocidad o errores de API, el mensaje de error indicará el problema.

  • Considere utilizar un modelo diferente si un proveedor está experimentando problemas.

Consideraciones de seguridad

  • Las claves API nunca se registran ni se exponen

  • El contenido del código se registra mínimamente para garantizar la privacidad.

  • Las dependencias se mantienen mínimas para reducir la superficie de seguridad.

  • El manejo de solicitudes incluye la validación y desinfección de entradas.

  • Los mensajes de error están diseñados para evitar la filtración de información confidencial.

Compatibilidad

  • Requiere Node.js 18.0.0 o posterior

  • Funciona en Linux, macOS y Windows (a través de WSL si es necesario)

  • Compatible con todos los clientes MCP (Claude Code, Claude Desktop, Cursor, Windsurf)

  • Manejo elegante de archivos de código grandes y contextos de proyecto

  • Mecanismo de reintento automático para fallas transitorias de API

Desarrollo

# Install dependencies
npm install

# Start in development mode
npm run dev

# Build for production
npm run build

# Start in production mode
npm run start

Licencia

Instituto Tecnológico de Massachusetts (MIT)

Colaboradores

  • Praney Behl (@praneybehl)

Available Tools

1 tool
perform_code_reviewA

Performs a code review using a specified LLM on git changes. Requires being run from the root of a git repository.

ParametersJSON Schema
NameRequiredDescriptionDefault
targetYesThe git target to review (e.g., 'staged', 'HEAD', or 'branch_diff').
taskDescriptionYesDescription of the task/feature/bugfix that led to these code changes.
llmProviderYesThe LLM provider to use (google, openai, anthropic).
modelNameYesThe specific model name from the provider (e.g., 'gemini-2.5-pro-preview-05-06', 'o4-mini', 'claude-3-7-sonnet-20250219').
reviewFocusNoSpecific areas or aspects to focus the review on (e.g., 'security vulnerabilities', 'performance optimizations', 'adherence to SOLID principles').
projectContextNoGeneral context about the project, its architecture, or coding standards.
diffBaseNoFor 'branch_diff' target, the base branch or commit SHA to compare against (e.g., 'main', 'develop', 'specific-commit-sha'). Required if target is 'branch_diff'.
maxTokensNoMaximum number of tokens to use for the LLM response. Defaults to 32000 if not specified.

TDQS

A3.6/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. While it mentions the git repository requirement, it doesn't describe what the tool actually does behaviorally - whether it makes API calls to LLMs, what format the review output takes, whether it modifies files, or any rate limits/authentication needs. For a complex 8-parameter tool with no annotations, this is a significant gap.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is extremely concise with just two sentences that both earn their place. The first sentence states the core purpose, and the second provides essential operational context. There's zero waste or redundancy.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a complex tool with 8 parameters performing code review via LLMs, the description is insufficiently complete. With no annotations, no output schema, and no behavioral details, it leaves critical gaps about what the tool actually produces, how it behaves, and what the user should expect. The description should explain the review output format and operational behavior.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The description provides no parameter-specific information beyond the git context hint. However, with 100% schema description coverage where all 8 parameters have clear descriptions in the schema itself, the baseline score of 3 is appropriate. The description doesn't add value beyond what's already documented in the structured schema.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose with specific verbs ('performs a code review') and resources ('using a specified LLM on git changes'). It distinguishes the tool's scope by specifying it works on git changes and requires being run from a git repository root, making it highly specific even without sibling tools for comparison.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides clear context about when to use the tool ('requires being run from the root of a git repository'), which is essential operational guidance. However, it doesn't mention when NOT to use it or suggest alternatives, which would be needed for a perfect score since there are no sibling tools to differentiate from.

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.

  1. 1 tool update
    • First observedperform_code_review

TDQS

A3.6/5.0
Disambiguation5/5

With only one tool, there is no possibility of ambiguity or overlap between tools. The tool's purpose is clearly defined and distinct by default.

Naming Consistency5/5

A single tool inherently has perfect naming consistency, as there are no other tools to compare it against. The name 'perform_code_review' follows a clear verb_noun pattern.

Tool Count2/5

A single tool for a code review server feels thin and incomplete for the domain. While it covers the core action, typical code review workflows might include additional operations like listing reviews, commenting, or approving changes.

Completeness2/5

The server is severely incomplete for code review functionality. It only performs reviews but lacks tools for managing reviews (e.g., get, update, delete), interacting with review comments, or handling review states, which are essential for a full code review workflow.

Maintenance

ActivityInactive
ResponsivenessUnresponsive

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

Related MCP Servers

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/praneybehl/code-review-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server