Skip to main content

MCP server for AI-powered code reviews using Google Gemini with contextual awareness

Project description

Gemini Code Review MCP

PyPI version License: MIT Python MCP Gemini

Gemini Code Review MCP

🚀 AI-powered code reviews that understand your project's context and development progress

Transform your git diffs into actionable insights with contextual awareness of your project guidelines, task progress, and coding standards.

📚 Table of Contents

Why Use This?

  • 🎯 Context-Aware Reviews: Automatically includes your CLAUDE.md guidelines and project standards
  • 📊 Progress Tracking: Understands your task lists and development phases
  • 🤖 AI Agent Integration: Seamless MCP integration with Claude Code and Cursor
  • 🔄 Flexible Workflows: GitHub PR reviews, project analysis, or custom scopes
  • ⚡ Smart Defaults: Auto-detects what to review based on your project state

🚀 Quick Start

# 1. Get your Gemini API key
# Visit: https://ai.google.dev/gemini-api/docs/api-key

# 2. Add to Claude Code
claude mcp add gemini-reviewer \
  -e GEMINI_API_KEY=your_key_here \
  -- uvx gemini-code-review-mcp

# 3. Use in your AI agent
# "Generate a code review for my project"

Optional: GitHub PR Reviews

# Add GitHub token for PR analysis
claude mcp add gemini-reviewer \
  -e GEMINI_API_KEY=your_key_here \
  -e GITHUB_TOKEN=your_github_token \
  -- uvx gemini-code-review-mcp

📋 Available MCP Tools

Tool Purpose Key Options
generate_ai_code_review Complete AI code review project_path, model, scope
generate_pr_review GitHub PR analysis github_pr_url, project_path
generate_code_review_context Build review context project_path, scope, enable_gemini_review
generate_meta_prompt Create contextual prompts project_path, text_output
📖 Detailed Tool Examples

AI Code Review

// Quick project review
{
  tool_name: "generate_ai_code_review",
  arguments: {
    project_path: "/path/to/project",
    model: "gemini-2.5-pro"  // Optional: use advanced model
  }
}

GitHub PR Review

// Analyze GitHub pull request
{
  tool_name: "generate_pr_review",
  arguments: {
    github_pr_url: "https://github.com/owner/repo/pull/123"
  }
}

Common Workflows

Quick Project Review

Human: Generate a code review for my project

Claude: I'll analyze your project and generate a comprehensive review.

[Uses generate_ai_code_review with project_path]

GitHub PR Review

Human: Review this PR: https://github.com/owner/repo/pull/123

Claude: I'll fetch the PR and analyze the changes.

[Uses generate_pr_review with github_pr_url]

Custom Model Review

Human: Generate a detailed review using Gemini 2.5 Pro

Claude: I'll use Gemini 2.5 Pro for a more detailed analysis.

[Uses generate_ai_code_review with model="gemini-2.5-pro"]

⚙️ Configuration

Environment Variables

Variable Required Default Description
GEMINI_API_KEY - Your Gemini API key
GITHUB_TOKEN - GitHub token for PR reviews (create one)
GEMINI_MODEL gemini-2.0-flash AI model selection
GEMINI_TEMPERATURE 0.5 Creativity (0.0-2.0)

Automatic Configuration Discovery

The tool automatically discovers and includes:

  • 📁 CLAUDE.md files at project/user/enterprise levels
  • 📝 Cursor rules (.cursorrules, .cursor/rules/*.mdc)
  • 🔗 Import syntax (@path/to/file.md) for modular configs

✨ Key Features

  • 🤖 Smart Context - Automatically includes CLAUDE.md, task lists, and project structure
  • 🎯 Flexible Scopes - Review PRs, recent changes, or entire projects
  • Model Selection - Choose between Gemini 2.0 Flash (speed) or 2.5 Pro (depth)
  • 🔄 GitHub Integration - Direct PR analysis with full context
  • 📊 Progress Aware - Understands development phases and task completion

🖥️ CLI Usage

Alternative: Command-line interface for development/testing

Installation

# Quick start with uvx (no install needed)
uvx gemini-code-review-mcp /path/to/project

# Or install globally
pip install gemini-code-review-mcp

Commands

# Basic review
generate-code-review /path/to/project

# Advanced options
generate-code-review . \
  --scope full_project \
  --model gemini-2.5-pro

# Meta-prompt only
generate-meta-prompt --project-path . --stream

Supported File Formats

  • 📋 Task Lists: /tasks/tasks-*.md - Track development phases
  • 📄 PRDs: /tasks/prd-*.md - Project requirements
  • 📦 Configs: CLAUDE.md, .cursorrules - Coding standards

🆘 Troubleshooting

  • Missing API key? → Get one at ai.google.dev
  • MCP not working? → Run claude mcp list to verify installation
  • Old version cached? → Run uv cache clean

📦 Development

# Setup
git clone https://github.com/yourusername/gemini-code-review-mcp
cd gemini-code-review-mcp
pip install -e ".[dev]"

# Test
pytest              # Run tests
make lint          # Check code style
make test-cli      # Test CLI commands

📏 License

MIT License - see LICENSE file for details.

👥 Credits

Built with ❤️ by Nico Bailon.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

gemini_code_review_mcp-0.3.9.tar.gz (418.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

gemini_code_review_mcp-0.3.9-py3-none-any.whl (93.2 kB view details)

Uploaded Python 3

File details

Details for the file gemini_code_review_mcp-0.3.9.tar.gz.

File metadata

  • Download URL: gemini_code_review_mcp-0.3.9.tar.gz
  • Upload date:
  • Size: 418.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.8

File hashes

Hashes for gemini_code_review_mcp-0.3.9.tar.gz
Algorithm Hash digest
SHA256 e1c8df75cb798558d70d3a87b06bc2fcd4ad86a3f5c4e85c43f361d04668b3c6
MD5 57f05f22fa26076ce1f4ab5d5469181d
BLAKE2b-256 9b280667aca600771899aee7592bf0c98310fedd0a351d5be9e8fb6becbac2bc

See more details on using hashes here.

File details

Details for the file gemini_code_review_mcp-0.3.9-py3-none-any.whl.

File metadata

File hashes

Hashes for gemini_code_review_mcp-0.3.9-py3-none-any.whl
Algorithm Hash digest
SHA256 958cd21f5a87d3f06b2341639ecfbf42ae922c7be8c7b97abdac86d57667f671
MD5 92a746216175195a9db2c16c8acad85e
BLAKE2b-256 fac9bbbe5fd3eb699aef7006be2243731ef8f03d8007c3d7ee33ff04f0c4a93b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page