enotkrutoy/CodeReviewAgent
Code Review Agent
 
A professional-grade code review agent that leverages AI to provide comprehensive code analysis and actionable recommendations. Built for the Gradio MCP Hackathon, this tool helps developers improve code quality through automated reviews powered by advanced AI models.

๐ Features
- Multi-Language Support: Analyzes code in 15+ programming languages including Python, JavaScript, TypeScript, Java, C++, and more
- Enterprise-Grade UI: Professional Gradio interface with modern design and intuitive workflow
- Advanced Analysis: Comprehensive insights on security vulnerabilities, performance bottlenecks, and code quality issues
- GitHub Integration: Support for both public and private GitHub repositories with secure token authentication
- MCP Server: Functions as a Model Context Protocol (MCP) server, allowing LLMs to use this tool for code review operations
- Professional Reporting: Detailed reports with actionable recommendations organized by priority
- Customizable Reviews: Select specific languages to focus the review on parts of your codebase that matter most
๐๏ธ Architecture
The system follows a robust 4-layer architecture designed for extensibility and maintainability:
- Presentation Layer: Gradio-based UI with professional dashboard and intuitive controls
- Application Layer: Core business logic and review engine with modular components
- Service Layer: External integrations and analysis services with clean interfaces
- MCP Layer: Implements the Model Context Protocol (MCP) server functionality, allowing LLMs to use this tool for code review operations through standardized communication
๐ Requirements
- Python 3.8+
- Git
- Internet connection for AI model access
- GitHub token (optional, for private repositories)
๐ง Installation
# Clone the repository
git clone https://huggingface.co/spaces/c1r3x/code-review-agent
cd code-review-agent
# Install dependencies
pip install -r requirements.txt
# Set up environment variables (optional)
cp sample.env .env
# Edit .env with your configuration๐ Usage
python src/main.pyThen open your browser to http://localhost:7860 to access the Code Review Agent.
Analyzing a Repository
- Enter the GitHub repository URL in the input field
- Optionally enter your GitHub token for private repositories
- Select the programming languages to focus the review on
- Click "Submit" to start the analysis
- View the comprehensive report with actionable recommendations
๐ณ Docker Deployment
# Build and run with Docker Compose
docker-compose up -dAccess the application at http://localhost:7860
๐ MCP Server Functionality
This application functions as a Model Context Protocol (MCP) server, allowing Large Language Models (LLMs) to use it as a tool for code review operations:
- MCP Integration: Exposes code review capabilities through standardized MCP endpoints
- LLM Tool Usage: Can be called by LLMs like Claude, GPT-4, and others that support the MCP protocol
- Tool Operations: Provides repository analysis, code review, and report generation as MCP operations
- Structured Responses: Returns analysis results in structured formats compatible with LLM processing
To use this as an MCP server with your LLM:
- Deploy the application using the instructions above
- Configure your MCP client to connect to the server endpoint
- The LLM can then use the code review capabilities through MCP tool calls
๐งช Testing
# Run the test suite
python -m pytest tests/๐ Project Structure
โโโ .gitignore # Git ignore file
โโโ Dockerfile # Docker configuration
โโโ LICENSE # MIT License file
โโโ README.md # Project documentation
โโโ app.py # Entry point for Hugging Face Spaces
โโโ docker-compose.yml # Docker Compose configuration
โโโ modal_deploy.py # Modal deployment configuration
โโโ requirements.txt # Python dependencies
โโโ sample.env # Sample environment variables
โโโ setup.py # Package setup configuration
โโโ src/ # Source code directory
โ โโโ __init__.py # Package initialization
โ โโโ core/ # Core application logic
โ โ โโโ __init__.py
โ โ โโโ agent_manager.py # Agent orchestration
โ โ โโโ language_detector.py # Language detection
โ โโโ main.py # Main application entry point
โ โโโ mcp/ # MCP server implementation
โ โ โโโ __init__.py
โ โ โโโ ai_review.py # AI review integration
โ โโโ services/ # Service layer components
โ โ โโโ __init__.py
โ โ โโโ code_analyzer.py # Code analysis
โ โ โโโ performance_analyzer.py # Performance analysis
โ โ โโโ report_generator.py # Report generation
โ โ โโโ repository_service.py # Repository operations
โ โ โโโ security_scanner.py # Security scanning
โ โโโ ui/ # User interface components
โ โโโ __init__.py
โ โโโ components/ # UI components
โ โโโ gradio_app.py # Gradio application
โ โโโ styles/ # UI styling
โโโ tests/ # Test directory
โโโ test_agent_manager.py
โโโ test_ai_review.py
โโโ test_code_analyzer.py
โโโ test_language_detector.py
โโโ test_performance_analyzer.py
โโโ test_report_generator.py
โโโ test_repository_service.py
โโโ test_security_scanner.py๐ค Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
๐ License
This project is licensed under the MIT License - see the LICENSE file for details.
