Integrates with Google's Gemini AI through the Gemini CLI to perform comprehensive codebase analysis and targeted component reviews using Gemini's 1M token context window
Gemini CLI MCP Server
A Model Context Protocol (MCP) server that integrates Gemini CLI with Claude Code for comprehensive codebase analysis using code2prompt.
Features
Comprehensive Codebase Review: Full architectural analysis using Gemini's 1M token context window
Targeted Component Analysis: Focused analysis on specific files/folders
Code2Prompt Integration: Efficient codebase context extraction with token optimization
OAuth Support: Works with your existing Gemini CLI OAuth authentication
Claude Code Sub-Agent: Specialized agent for intelligent analysis orchestration
Prerequisites
Required Tools
Node.js 18+ - For running the MCP server
Gemini CLI - Google's CLI tool with OAuth authentication
code2prompt - Rust CLI tool for codebase extraction
Claude Code - For sub-agent integration
Installation Steps
1. Install Gemini CLI
Authenticate with your Google account:
2. Install code2prompt
3. Install MCP Server Dependencies
Setup & Configuration
1. Build the MCP Server
2. Configure Claude Code MCP Settings
Add to your Claude Code MCP settings (usually ~/.config/claude-desktop/mcp_settings.json
):
3. Restart Claude Code
Restart Claude Code to load the new MCP server.
Available Tools
gemini_comprehensive_review
Performs a complete codebase architectural review using Gemini CLI.
Parameters:
workingDir
(string): Path to the codebase directoryexcludePatterns
(array, optional): Additional patterns to exclude
Usage Example:
gemini_targeted_analysis
Analyzes specific files or folders with focused insights.
Parameters:
workingDir
(string): Path to the codebase directorytargetPaths
(array): Specific files/folders to analyzeanalysisContext
(string, optional): Additional context for the analysis
Usage Example:
Claude Code Integration
Sub-Agent Usage
The gemini-code-analyzer
sub-agent is automatically available in Claude Code once the MCP server is configured.
Example Commands:
"Please analyze this entire codebase for architectural issues"
"Review the authentication module in src/auth/ for security vulnerabilities"
"Analyze the API endpoints in src/controllers/ for performance bottlenecks"
Manual Tool Access
You can also call the MCP tools directly through Claude Code's tool interface:
Use
/tools
to see available MCP toolsSelect
gemini_comprehensive_review
orgemini_targeted_analysis
Provide required parameters
Development
Running in Development Mode
Building for Production
Project Structure
Troubleshooting
Common Issues
"gemini command not found"
Ensure Gemini CLI is installed and in your PATH:
"code2prompt command not found"
Install code2prompt:
Authentication Issues
Re-authenticate with Gemini CLI:
MCP Server Not Connecting
Check Claude Code MCP settings configuration
Verify the server path is correct
Check console logs for errors
Restart Claude Code after configuration changes
Logging
The MCP server logs to stderr. Monitor logs when running:
Configuration Options
Excluding Files/Patterns
The comprehensive review automatically excludes common patterns:
node_modules/**
.git/**
*.log
dist/**
,build/**
.next/**
coverage/**
Add custom exclusions via the excludePatterns
parameter.
Token Management
code2prompt provides token counting for large codebases
Gemini CLI handles the 1M token context window automatically
Large codebases are efficiently processed through code2prompt's optimization
Security Considerations
Uses your existing Gemini CLI OAuth authentication
No API keys stored in the MCP server
Codebase content is sent to Gemini for analysis
Consider data sensitivity when analyzing proprietary code
License
MIT License - See LICENSE file for details
This server cannot be installed
local-only server
The server can only run on the client's local machine because it depends on local resources.
Enables comprehensive codebase analysis using Google's Gemini AI through CLI integration. Provides architectural reviews and targeted code analysis with code2prompt integration for efficient context extraction.
Related MCP Servers
- -securityFlicense-qualityProvides AI-powered assistance for coding problems using Google's Gemini AI, combined with Perplexity insights and Stack Overflow references, facilitating contextual analysis and automatic response archiving for improved troubleshooting.Last updated -13
- -securityAlicense-qualityConnects Claude Code with Google's Gemini AI, allowing users to ask Gemini questions, get code reviews, and brainstorm ideas directly within Claude Code.Last updated -228MIT License
- AsecurityAlicenseAqualityPairs Claude Code with Google's Gemini AI for complementary code analysis, enabling intelligent routing where Claude handles local-context operations while Gemini leverages its 1M token context for distributed system debugging and long-trace analysis.Last updated -1091MIT License
- AsecurityAlicenseAqualityA lightweight MCP server that enables AI agents to perform deep codebase analysis by leveraging Gemini's massive context window for cross-file analysis and intelligent file selection.Last updated -416MIT License