Skip to main content
Glama

πŸ” MCP-Powered AI Code Review Agent

An AI-powered code review agent that leverages Model Context Protocol (MCP) and Claude to provide intelligent, context-aware code reviews.

Python License MCP

✨ Features

  • πŸ€– AI-Powered Reviews: Uses Claude to provide intelligent code analysis

  • πŸ”§ MCP Integration: Built on Model Context Protocol for tool-augmented LLM reasoning

  • πŸ“Š Code Metrics: Cyclomatic complexity, line counts, maintainability index

  • 🎨 Style Checking: Detects common anti-patterns and style issues

  • πŸ“ Git Integration: Review diffs, check history, understand context

  • ⚑ Streaming Output: Real-time feedback as the AI analyzes your code

Related MCP server: Gemini MCP

πŸš€ Quick Start

Installation

# Clone the repository
git clone https://github.com/geethikakoya/mcp-code-agent.git
cd mcp-code-agent

# Create virtual environment
python -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate

# Install dependencies
pip install -e .

Set up API Key

# Get your API key from https://console.anthropic.com/
export ANTHROPIC_API_KEY=your_api_key_here

Usage

# Review a file
mcp-review review src/main.py

# Review with streaming output
mcp-review review --stream src/main.py

# Review git changes
mcp-review diff

# Explain what a file does
mcp-review explain src/utils.py

# Quick analysis (no AI, just metrics)
mcp-review analyze src/main.py

πŸ“– Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                    Code Review Agent                        β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚                                                             β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”      β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”      β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”‚
β”‚  β”‚  CLI     │─────▢│  Agent       │─────▢│  Claude API  β”‚  β”‚
β”‚  β”‚  (typer) │◀─────│  (reviewer)  │◀─────│  (LLM)       β”‚  β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜      β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜      β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β”‚
β”‚                           β”‚                                 β”‚
β”‚                           β–Ό                                 β”‚
β”‚                    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”                        β”‚
β”‚                    β”‚  MCP Tools   β”‚                        β”‚
β”‚                    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜                        β”‚
β”‚                           β”‚                                 β”‚
β”‚              β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”                   β”‚
β”‚              β–Ό            β–Ό            β–Ό                   β”‚
β”‚        β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”              β”‚
β”‚        β”‚  File   β”‚  β”‚   Git   β”‚  β”‚  Code   β”‚              β”‚
β”‚        β”‚  Tools  β”‚  β”‚  Tools  β”‚  β”‚ Analysisβ”‚              β”‚
β”‚        β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜              β”‚
β”‚                                                             β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

πŸ”§ MCP Tools

File Operations

Tool

Description

read_file

Read file contents with optional line range

list_directory

List files and directories

search_code

Regex search across codebase

Git Integration

Tool

Description

git_diff

Get diff of changes

git_log

Get commit history

get_changed_files

List modified files

Code Analysis

Tool

Description

calculate_complexity

Cyclomatic complexity (Python)

count_lines

LOC, comments, blanks

check_code_style

Style issues and anti-patterns

πŸ“ Example Output

πŸ” Reviewing: src/api/handler.py

πŸ“Š Metrics Summary
β€’ Lines of Code: 142
β€’ Cyclomatic Complexity: 8 (Moderate)
β€’ Maintainability Index: 65.2

πŸ”΄ Critical Issues
1. Line 45: SQL injection vulnerability - use parameterized queries

⚠️ Warnings
1. Line 23: Function too long (>50 lines) - consider splitting
2. Line 67: Magic number - extract to constant

πŸ’‘ Suggestions
1. Add type hints to function parameters
2. Consider using dataclass for UserData

βœ… What's Good
β€’ Good error handling in API endpoints
β€’ Consistent naming conventions

πŸ—οΈ Project Structure

mcp-code-agent/
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ mcp_server/           # MCP Server (exposes tools)
β”‚   β”‚   β”œβ”€β”€ server.py         # Main MCP server
β”‚   β”‚   └── tools/
β”‚   β”‚       β”œβ”€β”€ file_tools.py
β”‚   β”‚       β”œβ”€β”€ git_tools.py
β”‚   β”‚       └── analysis_tools.py
β”‚   β”‚
β”‚   β”œβ”€β”€ agent/                # AI Agent
β”‚   β”‚   β”œβ”€β”€ reviewer.py       # Code review logic
β”‚   β”‚   └── prompts.py        # System prompts
β”‚   β”‚
β”‚   └── cli/                  # CLI interface
β”‚       └── main.py
β”‚
β”œβ”€β”€ tests/
β”œβ”€β”€ pyproject.toml
β”œβ”€β”€ requirements.txt
└── README.md

πŸ”Œ Using as MCP Server

You can use this as a standalone MCP server with any MCP-compatible client:

# Run the MCP server
mcp-review server

Configure in your MCP client (e.g., Claude Desktop):

{
  "mcpServers": {
    "code-review": {
      "command": "python",
      "args": ["-m", "src.mcp_server.server"],
      "cwd": "/path/to/mcp-code-agent"
    }
  }
}

πŸ§ͺ Development

# Install dev dependencies
pip install -e ".[dev]"

# Run tests
pytest

# Format code
black src/
ruff check src/

πŸ“„ License

MIT License - see LICENSE for details.

πŸ‘€ Author

Geethika Koya


Built with ❀️ using Model Context Protocol and Claude

Maintenance

ActivityInactive
ResponsivenessNo issues

Related MCP Connectors

Related MCP Servers

  • A
    license
    B
    quality
    D
    maintenance
    An implementation of Claude Code as a Model Context Protocol server that enables using Claude's software engineering capabilities (code generation, editing, reviewing, and file operations) through the standardized MCP interface.
    8
    30
    187
    MIT
  • A
    license
    C
    quality
    F
    maintenance
    An AI-powered Model Context Protocol server for Claude Code that provides code intelligence tools including codebase analysis, task management, component generation, and deployment configuration.
    23
    16
    GPL 3.0