MCP Code Review Agent
Uses OpenAI's Codex API to perform AI-powered code reviews with multiple analysis personas.
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., "@MCP Code Review Agentreview modified code with Codex analysis"
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.
MCP Code Review Agent
Personal Use Repository
This is a personal repository for my own use. Feel free to use it if you find it helpful.
A sophisticated code review tool built with the Model Context Protocol (MCP) framework, designed to improve code quality through multiple AI-powered analysis strategies with distinct personas and expertise areas.
๐ Prerequisites
Codex CLI Login & Permissions
This tool requires Codex CLI to be installed and authenticated. You need to log in to Codex and have the necessary permissions to use the AI-powered analysis features.
Required Steps:
Install Codex CLI (if not already installed)
Login to Codex using your credentials
Ensure proper permissions for AI analysis features
Codex CLI Resources:
Note: Without proper Codex CLI authentication, the AI-powered analysis strategies (Codex, Toxic Architect, Accessibility Expert) will not function. Only the static analysis strategy will be available.
Related MCP server: Debate Agent MCP
๐ Quick Start
Installation
# Clone and build the tool locally (package not yet published to npm)
git clone https://github.com/lodado/MCP-Code-Review-Agent
cd MCP-Code-Review-Agent
npm install
npm run build
npm link
Basic Usage
# Get balanced AI review (Codex)
echo '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"codex_review","arguments":{"reviewType":"modified","analysisType":"codex"}}}' | node mcp-code-review-agent
# Get accessibility expert review
echo '{"jsonrpc":"2.0","id":2,"method":"tools/call","params":{"name":"codex_review","arguments":{"reviewType":"full","analysisType":"accessibility"}}}' | node mcp-code-review-agent
# Get brutally honest architect review (prepare for tough love!)
echo '{"jsonrpc":"2.0","id":3,"method":"tools/call","params":{"name":"codex_review","arguments":{"reviewType":"full","analysisType":"toxic-architect"}}}' | node mcp-code-review-agent๐ค AI Review Agents & Personas
This tool features multiple AI agents, each with distinct personalities and expertise areas, providing comprehensive code review from different perspectives.
1. Codex Analysis (codex) - The Generalist
Persona: Balanced AI code reviewer
Expertise: Comprehensive analysis across all areas
Style: Professional, thorough, and constructive
Focus: Security, performance, architecture, and logic issues
Best for: General code quality improvement
2. Toxic Architect (toxic-architect) - The Perfectionist
Persona: Brutally honest senior architect with zero tolerance for poor code
Expertise: SOLID principles, Clean Architecture, design patterns
Style: Sarcastic, condescending, but technically accurate
Focus: Architectural flaws, SOLID violations, design pattern misuse
Best for: When you need tough love and architectural discipline
3. Web Accessibility Expert (accessibility) - The Inclusive Designer
Persona: Senior Frontend Publisher with 10+ years of accessibility experience
Expertise: WCAG compliance, semantic web, React accessibility
Style: Professional, detail-oriented, user-focused
Focus: Web accessibility, inclusive design, semantic HTML
Best for: Frontend code, especially React/TypeScript components
4. Static Analyzer (static) - The Rule Enforcer
Persona: Consistent, rule-based code analyzer
Expertise: TypeScript patterns, code metrics, complexity analysis
Style: Systematic, objective, fast
Focus: Code metrics, complexity, basic patterns
Best for: Quick feedback and consistent rule enforcement
5. Hybrid Analysis (hybrid) - The Team Player
Persona: Combines multiple analysis approaches
Expertise: Best of all worlds
Style: Comprehensive and balanced
Focus: Multiple perspectives in one review
Best for: When you want comprehensive coverage
๐ Detailed Usage
Method 1: Direct Execution (Development)
# Get balanced AI review (Codex)
echo '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"codex_review","arguments":{"reviewType":"modified","analysisType":"codex"}}}' | node dist/index.js
# Get accessibility expert review
echo '{"jsonrpc":"2.0","id":2,"method":"tools/call","params":{"name":"codex_review","arguments":{"reviewType":"full","analysisType":"accessibility"}}}' | node dist/index.js
# Get brutally honest architect review (prepare for tough love!)
echo '{"jsonrpc":"2.0","id":3,"method":"tools/call","params":{"name":"codex_review","arguments":{"reviewType":"full","analysisType":"toxic-architect"}}}' | node dist/index.js
# Get quick static analysis
echo '{"jsonrpc":"2.0","id":4,"method":"tools/call","params":{"name":"codex_review","arguments":{"reviewType":"modified","analysisType":"static"}}}' | node dist/index.js
# Get comprehensive hybrid review
echo '{"jsonrpc":"2.0","id":5,"method":"tools/call","params":{"name":"codex_review","arguments":{"reviewType":"full","analysisType":"hybrid"}}}' | node dist/index.jsMethod 2: Global Installation (Production)
After running npm link, you can use the tool globally from any directory:
# Install globally (run once after npm link)
npm link
# Now you can use it from anywhere:
# Get balanced AI review (Codex)
echo '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"codex_review","arguments":{"reviewType":"modified","analysisType":"codex"}}}' | mcp-code-review-agent
# Get accessibility expert review
echo '{"jsonrpc":"2.0","id":2,"method":"tools/call","params":{"name":"codex_review","arguments":{"reviewType":"full","analysisType":"accessibility"}}}' | mcp-code-review-agent
# Get brutally honest architect review
echo '{"jsonrpc":"2.0","id":3,"method":"tools/call","params":{"name":"codex_review","arguments":{"reviewType":"full","analysisType":"toxic-architect"}}}' | mcp-code-review-agent
# Get quick static analysis
echo '{"jsonrpc":"2.0","id":4,"method":"tools/call","params":{"name":"codex_review","arguments":{"reviewType":"modified","analysisType":"static"}}}' | mcp-code-review-agent
# Get comprehensive hybrid review
echo '{"jsonrpc":"2.0","id":5,"method":"tools/call","params":{"name":"codex_review","arguments":{"reviewType":"full","analysisType":"hybrid"}}}' | mcp-code-review-agentMethod 3: MCP Client Integration
If you're using an MCP client (like Cursor, Claude Desktop, etc.), the tool will be automatically available as codex_review with the following parameters:
{
"name": "codex_review",
"arguments": {
"repositoryPath": "/path/to/your/repo",
"reviewType": "modified",
"analysisType": "codex",
"includeSuggestions": true,
"outputFormat": "text",
"noEmoji": false
}
}When to Use Each Agent
Codex: Daily development, general code quality
Toxic Architect: When you need architectural discipline and tough feedback
Accessibility Expert: Frontend development, React components, user-facing code
Static Analyzer: Quick feedback, CI/CD pipelines, consistent rule enforcement
Hybrid: Comprehensive reviews, important milestones, final checks
Parameters
repositoryPath: Path to Git repository (default: current directory)reviewType: Type of files to review (full,staged,modified)analysisType: Analysis strategy (codex,static,hybrid,accessibility,toxic-architect)includeSuggestions: Include improvement suggestions (default:true)outputFormat: Output format (text,json)noEmoji: Disable emoji in output
Environment Variables
DEFAULT_REPO_PATH: Default repository pathDEFAULT_INCLUDE_SUGGESTIONS: Default suggestion inclusionDEFAULT_USE_CODEX: Default Codex usage (deprecated)DEFAULT_ANALYSIS_TYPE: Default analysis typeNO_EMOJI: Disable emoji globally
๐ค AI Provider & MCP Connection
Current AI Provider: OpenAI Codex
This tool currently uses OpenAI Codex as the primary AI provider for intelligent code analysis. The Codex integration provides sophisticated code understanding and review capabilities across multiple programming languages.
Note: The tool is designed to be provider-agnostic and can be extended to support other AI providers in the future.
MCP (Model Context Protocol) Connection
This tool is built as an MCP server that can be connected to MCP-compatible clients. Here's how to connect:
For MCP-Compatible IDEs/Editors
Clone and build the tool locally (package not yet published to npm):
git clone https://github.com/lodado/MCP-Code-Review-Agent cd MCP-Code-Review-Agent npm install npm run build npm linkFuture: Once published to npm, you'll be able to install with:
npm install -g mcp-code-review-agentConfigure your MCP client (e.g., codex, Claude Desktop):
{ "mcpServers": { "code-review-agent": { "command": "mcp-code-review-agent", "args": [] } } }Use the tool through your MCP client's interface
โ ๏ธ Cursor IDE Limitation
Important: Due to permission restrictions in Cursor IDE, this MCP tool may not work properly when connected through Cursor's MCP integration. The tool requires file system access and Git operations that may be restricted by Cursor's security model.
Workaround: Use the tool directly via command line or through other MCP-compatible clients that have appropriate permissions.
๐ Key Capabilities
Multi-Persona Reviews: Get feedback from different AI personalities and expertise areas
Parallel Processing: Multiple files analyzed concurrently using
p-limitPath Security: Safe path validation preventing directory traversal attacks
File Filtering: Intelligent filtering based on file type, size, and complexity
Git Integration: Seamless integration with Git repositories
Multiple Output Formats: Text and JSON output support
Configurable Analysis: Customizable analysis parameters and limits
Personal Code Quality Journey: Continuous improvement through AI-powered feedback
๐ฏ Purpose & Goals
This project was created to explore the potential of AI-powered code review using different specialized personas. The goal is to demonstrate how various AI agents with distinct personalities and expertise can provide comprehensive code quality improvements from multiple perspectives.
Why This Project Exists
Personal Code Quality Improvement: Use MCP agents to continuously improve code quality through automated reviews
Multi-Perspective Analysis: Leverage different AI personas (senior architect, accessibility expert, etc.) to get diverse feedback
Learning Tool: Understand how different AI personalities approach code review and what insights they provide
MCP Framework Exploration: Experiment with the Model Context Protocol for building AI-powered development tools
The Vision
Imagine having a team of expert code reviewers available 24/7, each with their own specialty:
A brutally honest senior architect who catches SOLID violations and architectural flaws
A web accessibility expert who ensures inclusive design
An AI-powered generalist who provides comprehensive analysis
A rule-based analyzer for consistent, fast feedback
This tool makes that vision a reality through MCP agents with distinct personas and expertise areas.
๐๏ธ Architecture Overview
This project implements a Clean Architecture pattern with clear separation of concerns. The architecture was designed based on comprehensive code review feedback from MCP agents - I had no involvement in the architectural decisions!
Architecture Layers
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Presentation Layer โ โ CLI output, JSON reports
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ Application Layer โ โ Use Case orchestration
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ Domain Layer โ โ Business logic, port interfaces
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ Infrastructure Layer โ โ Git, FS, AI Provider implementations
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโThe architecture follows Clean Architecture principles with clear separation of concerns, making it easy to add new analysis strategies and maintain the codebase.
๐ Project Structure
src/
โโโ domain/ # Domain Layer
โ โโโ ports.ts # Port interfaces (contracts)
โ โโโ entities.ts # Business entities and logic
โโโ application/ # Application Layer
โ โโโ CodeReviewUseCase.ts # Main business orchestration
โ โโโ AnalysisOrchestrator.ts # Analysis strategy coordination
โโโ infrastructure/ # Infrastructure Layer
โ โโโ git/
โ โ โโโ NodeGitClient.ts # Git operations adapter
โ โโโ filesystem/
โ โ โโโ NodeFileSystem.ts # File system operations adapter
โ โโโ ai/
โ โ โโโ CodexClient.ts # AI provider adapter
โ โโโ path/
โ โโโ SafePathPolicy.ts # Path security validation
โโโ presentation/ # Presentation Layer
โ โโโ CliReporter.ts # Text output formatter
โ โโโ JsonReporter.ts # JSON output formatter
โโโ strategies/ # Analysis Strategies
โ โโโ CodeAnalysisStrategy.ts # Abstract base strategy
โ โโโ CodexAnalysisStrategy.ts # AI-powered analysis
โ โโโ WebAccessibilityAnalysisStrategy.ts # Accessibility-focused
โ โโโ ToxicArchitectAnalysisStrategy.ts # Architecture-focused
โ โโโ TypeScriptStaticAnalysisStrategy.ts # Rule-based analysis
โ โโโ AnalysisStrategyFactory.ts # Strategy factory
โโโ composition/ # Dependency Injection
โ โโโ container.ts # DI container and wiring
โโโ config/ # Configuration
โ โโโ analysisConfig.ts # Analysis settings
โโโ tools/ # MCP Tools
โโโ CodexReviewTool.ts # Main MCP tool (thin wrapper)๐๏ธ Architecture Details
Domain Layer
The domain layer contains the core business logic and defines the contracts (ports) that external dependencies must implement.
Key Components:
ports.ts: Interface definitions for all external dependenciesentities.ts: Business entities with domain logic
Application Layer
The application layer orchestrates the business logic and coordinates between different services.
Key Components:
CodeReviewUseCase: Main orchestration logicAnalysisOrchestrator: Manages analysis strategy selection and execution
Infrastructure Layer
The infrastructure layer provides concrete implementations of the domain interfaces.
Key Components:
NodeGitClient: Git operations using Node.js child processesNodeFileSystem: File system operations using Node.js fs moduleCodexClient: OpenAI Codex SDK integrationSafePathPolicy: Security-focused path validation
Presentation Layer
The presentation layer handles output formatting and user interface concerns.
Key Components:
CliReporter: Human-readable text outputJsonReporter: Machine-readable JSON output
๐ง Configuration
Analysis Configuration
export const defaultAnalysisConfig: AnalysisConfig = {
maxFileSize: 50 * 1024, // 50KB
maxLines: 2500, // Maximum lines per file
maxFunctions: 50, // Maximum functions per file
maxClasses: 10, // Maximum classes per file
concurrency: 3, // Parallel processing limit
supportedExtensions: [".ts", ".tsx"],
excludedPatterns: [
"\\.d\\.ts$",
"\\.(test|spec)\\.tsx?$",
"/node_modules/",
"/dist/",
"/build/",
],
};๐งช Testing
# Build the project
npm run build
# Test with different analysis strategies
npm test๐ Security Features
Path Traversal Protection: Prevents directory traversal attacks
File Size Limits: Prevents memory exhaustion from large files
Input Validation: Comprehensive input sanitization and validation
Safe Git Operations: Secure Git command execution
๐ Performance Features
Parallel Processing: Concurrent file analysis using
p-limitIntelligent Filtering: Skip unsuitable files early
Memory Management: Efficient file size and complexity checks
Caching: Dependency injection container with instance caching
๐ Development
Adding New Analysis Strategies
Create a new strategy class extending
CodeAnalysisStrategyImplement the required abstract methods
Register the strategy in
AnalysisStrategyFactoryUpdate the schema validation
Adding New Output Formats
Create a new reporter implementing
ReporterinterfaceRegister the reporter in the dependency container
Update the tool's output format handling
๐ค Contributing
This project follows clean architecture principles and SOLID design patterns. When contributing:
Maintain separation of concerns
Use dependency injection
Write tests for new features
Follow the existing code structure
๐ License
MIT License - see LICENSE file for details.
Note: This architecture was designed based on comprehensive code review feedback from MCP agents. The architectural decisions, design patterns, and code structure were all determined by the AI review process - I had no involvement in the architectural design!
This server cannot be installed
Maintenance
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
- 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/lodado/MCP-Code-Review-Agent'
If you have feedback or need assistance with the MCP directory API, please join our Discord server