
Gemini MCP Server
Enables comprehensive codebase analysis using Google's Gemini CLI and its massive context window. Supports file/directory analysis, security audits, architecture analysis, feature verification, and complete project overviews for large codebases that exceed other AI models' context limits.
README
Gemini MCP Server
An MCP (Model Context Protocol) server that provides tools for analyzing codebases using the Gemini CLI. This server leverages Gemini's massive context window to perform comprehensive codebase analysis, verification, and security audits.
Features
- File Analysis: Analyze specific files using Gemini's @ syntax
- Directory Analysis: Analyze entire directories and subdirectories
- All Files Analysis: Analyze complete projects using --all_files flag
- Implementation Verification: Check if specific features are implemented
- Security Audits: Perform security analysis for common vulnerabilities
- Architecture Analysis: Analyze codebase structure and patterns
Prerequisites
-
Gemini CLI: You must have the Gemini CLI installed and configured
# Using npx (no installation required) npx https://github.com/google-gemini/gemini-cli # Install Gemini CLI (example - check official docs for latest instructions) npm install -g @google/gemini-cli@latest # or brew install gemini-cli
-
Python 3.12+ and uv package manager
Installation
- Clone or download this project
- Install dependencies:
cd gemini-mcp uv sync
Usage
Running the MCP Server
# Run directly
uv run python -m gemini_mcp
# Or install and run
uv pip install -e .
gemini-mcp
Available Tools
1. gemini_analyze_files
Analyze specific files using Gemini CLI with @ syntax.
Parameters:
files
(array): List of file paths to analyzeprompt
(string): Analysis prompt to send to Geminiworking_directory
(optional): Directory to run command from
Example:
{
"name": "gemini_analyze_files",
"arguments": {
"files": ["src/main.py", "src/utils.py"],
"prompt": "Explain the purpose and structure of these files"
}
}
2. gemini_analyze_directories
Analyze entire directories using Gemini CLI.
Parameters:
directories
(array): List of directory paths to analyzeprompt
(string): Analysis prompt to send to Geminiworking_directory
(optional): Directory to run command from
Example:
{
"name": "gemini_analyze_directories",
"arguments": {
"directories": ["src", "tests"],
"prompt": "Analyze test coverage for the source code"
}
}
3. gemini_analyze_all_files
Analyze all files in the current directory using --all_files flag.
Parameters:
prompt
(string): Analysis prompt to send to Geminiworking_directory
(optional): Directory to run command from
Example:
{
"name": "gemini_analyze_all_files",
"arguments": {
"prompt": "Give me an overview of this entire project"
}
}
4. gemini_verify_implementation
Verify if specific features or patterns are implemented in the codebase.
Parameters:
feature_name
(string): Name of the feature to verifysearch_paths
(array): Directories/files to search inverification_prompt
(optional): Custom verification promptworking_directory
(optional): Directory to run command from
Example:
{
"name": "gemini_verify_implementation",
"arguments": {
"feature_name": "JWT authentication",
"search_paths": ["src", "middleware"]
}
}
5. gemini_security_audit
Perform security analysis of the codebase.
Parameters:
audit_type
(enum): Type of audit -sql_injection
,xss
,auth
,general
,input_validation
paths
(array): Paths to audit (files or directories)working_directory
(optional): Directory to run command from
Example:
{
"name": "gemini_security_audit",
"arguments": {
"audit_type": "sql_injection",
"paths": ["src/api", "src/database"]
}
}
6. gemini_architecture_analysis
Analyze codebase architecture and patterns.
Parameters:
analysis_type
(enum): Type of analysis -overview
,dependencies
,patterns
,structure
,coupling
paths
(array): Paths to analyzeworking_directory
(optional): Directory to run command from
Example:
{
"name": "gemini_architecture_analysis",
"arguments": {
"analysis_type": "overview",
"paths": ["src"]
}
}
Integration with Claude Code
Using claude mcp command (Recommended)
The easiest way to add this MCP server to Claude Code is using the built-in claude mcp
command with uv's script dependencies:
# Add the MCP server using uv script execution
claude mcp add gemini-mcp uv run /path/to/gemini-mcp/src/gemini_mcp/__init__.py
Or if you want to install it globally first:
cd /path/to/gemini-mcp
uv pip install -e .
claude mcp add gemini-mcp gemini-mcp
Manual Configuration
Alternatively, you can manually add it to your MCP configuration:
{
"mcpServers": {
"gemini-mcp": {
"command": "uv",
"args": ["run", "python", "-m", "gemini_mcp"],
"cwd": "/path/to/gemini-mcp"
}
}
}
Or if installed globally:
{
"mcpServers": {
"gemini-mcp": {
"command": "gemini-mcp"
}
}
}
Managing the MCP Server
# List all MCP servers
claude mcp list
# Remove the server if needed
claude mcp remove gemini-mcp
# Re-add after updates
claude mcp add gemini-mcp uv run /path/to/gemini-mcp/src/gemini_mcp/__init__.py
Using MCP Prompts
The server exposes prompts that can be used directly via slash commands:
# Analyze specific files
/mcp__gemini_mcp__analyze_files files=src/main.py,src/utils.py
# Security audit
/mcp__gemini_mcp__security_audit audit_type=sql_injection paths=src/api,src/database
# Architecture analysis
/mcp__gemini_mcp__architecture_analysis analysis_type=overview paths=src
# Verify if a feature is implemented
/mcp__gemini_mcp__verify_feature feature_name="JWT authentication" search_paths=src,middleware
# Get project overview
/mcp__gemini_mcp__project_overview
# Get focused project overview
/mcp__gemini_mcp__project_overview focus="API architecture"
Available Prompts
The MCP server exposes the following prompts:
-
analyze_files
- Analyze specific files with optional custom prompt- Arguments:
files
(required),prompt
(optional)
- Arguments:
-
security_audit
- Perform security audits- Arguments:
audit_type
(required: sql_injection, xss, auth, general, input_validation),paths
(required)
- Arguments:
-
architecture_analysis
- Analyze codebase architecture- Arguments:
analysis_type
(required: overview, dependencies, patterns, structure, coupling),paths
(required)
- Arguments:
-
verify_feature
- Verify if features are implemented- Arguments:
feature_name
(required),search_paths
(optional)
- Arguments:
-
project_overview
- Get comprehensive project overview- Arguments:
focus
(optional)
- Arguments:
Use Cases
Large Codebase Analysis
When analyzing large codebases that exceed Claude's context limits, use Gemini's massive context window:
- Full project overviews
- Cross-file dependency analysis
- Architecture documentation generation
Feature Verification
Check if specific features are implemented:
- Authentication systems
- Error handling patterns
- Security measures
- Design patterns
Security Audits
Perform comprehensive security analysis:
- SQL injection vulnerability scanning
- XSS vulnerability detection
- Authentication/authorization review
- Input validation analysis
Code Quality Assessment
Analyze code quality and structure:
- Architectural pattern compliance
- Code organization evaluation
- Coupling analysis
- Dependency management review
Development
Project Structure
gemini-mcp/
�� src/
�� gemini_mcp/
�� __init__.py # Main MCP server implementation
�� pyproject.toml # Project configuration
�� README.md # This file
Contributing
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests if applicable
- Submit a pull request
License
This project is licensed under the MIT License.
Troubleshooting
Common Issues
-
"Gemini CLI not found"
- Ensure Gemini CLI is installed and in your PATH
- Verify installation with
which gemini
-
API Key Issues
- Configure Gemini CLI with your API key:
gemini config set api-key YOUR_KEY
- Check if the key is valid with a simple test:
gemini -p "Hello"
- Configure Gemini CLI with your API key:
-
Permission Errors
- Ensure the working directory is accessible
- Check file permissions for the files you're trying to analyze
-
Large File Timeouts
- For very large codebases, consider analyzing specific subdirectories first
- Use the directory analysis tools to break down the analysis
Updates and Maintenance
For updates to this local MCP server:
# If this is a git repository
cd /path/to/gemini-mcp
git pull
uv sync
# Update dependencies
uv sync --upgrade
# If installed with -e flag, changes are automatically reflected
# Otherwise, reinstall after updates:
uv pip install -e .
Since this is installed in "editable" mode with -e
, code changes are automatically reflected without reinstalling.
Support
For issues specific to this MCP server, please check the logs and ensure:
- Gemini CLI is properly installed and configured
- File paths are correct and accessible
- Working directory permissions are set correctly
For Gemini CLI issues, refer to the official Gemini documentation.
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.