Major enhancements for Claude Code integration: Temperature Optimization: - Chat: 0.5 (balanced accuracy/creativity for development discussions) - Code Analysis: 0.2 (high precision for code reviews and debugging) Enhanced Developer Context: - Rewritten system prompt focusing on Claude Code augmentation - Emphasizes precision, best practices, and actionable solutions - Positions Gemini as an extension for large context tasks Claude Code-Centric Documentation: - README completely rewritten for Claude Code users - Clear configuration instructions with file paths - Practical examples for common development scenarios - Quick start guide with natural language usage Key improvements: - Lower temperatures for more accurate, deterministic responses - Developer-first approach in all interactions - Clear positioning as Claude's extended context handler - Comprehensive setup guide for Claude Desktop integration The server is now fully optimized to act as a specialized developer assistant that seamlessly extends Claude Code's capabilities. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
169 lines
4.8 KiB
Markdown
169 lines
4.8 KiB
Markdown
# Gemini MCP Server for Claude Code
|
|
|
|
A specialized Model Context Protocol (MCP) server that extends Claude Code's capabilities with Google's Gemini 2.5 Pro Preview, featuring a massive 1M token context window for handling large codebases and complex analysis tasks.
|
|
|
|
## 🎯 Purpose
|
|
|
|
This server acts as a developer assistant that augments Claude Code when you need:
|
|
- Analysis of files too large for Claude's context window
|
|
- Deep architectural reviews across multiple files
|
|
- Extended thinking and complex problem solving
|
|
- Performance analysis of large codebases
|
|
- Security audits requiring full codebase context
|
|
|
|
## 🚀 Quick Start for Claude Code
|
|
|
|
### 1. Configure in Claude Desktop
|
|
|
|
Add to your Claude Desktop configuration file:
|
|
|
|
**macOS**: `~/Library/Application Support/Claude/claude_desktop_config.json`
|
|
**Windows**: `%APPDATA%\Claude\claude_desktop_config.json`
|
|
|
|
```json
|
|
{
|
|
"mcpServers": {
|
|
"gemini": {
|
|
"command": "/path/to/gemini-mcp-server/venv/bin/python",
|
|
"args": ["/path/to/gemini-mcp-server/gemini_server.py"],
|
|
"env": {
|
|
"GEMINI_API_KEY": "your-gemini-api-key-here"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
```
|
|
|
|
### 2. Restart Claude Desktop
|
|
|
|
After adding the configuration, restart Claude Desktop. You'll see "gemini" in the MCP servers list.
|
|
|
|
### 3. Start Using Natural Language
|
|
|
|
Just talk to Claude naturally:
|
|
- "Use Gemini to analyze this large file..."
|
|
- "Ask Gemini to review the architecture of these files..."
|
|
- "Have Gemini check this codebase for security issues..."
|
|
|
|
## 💻 Developer-Optimized Features
|
|
|
|
### Automatic Developer Context
|
|
When no custom system prompt is provided, Gemini automatically operates with deep developer expertise, focusing on:
|
|
- Clean code principles
|
|
- Performance optimization
|
|
- Security best practices
|
|
- Architectural patterns
|
|
- Testing strategies
|
|
- Modern development practices
|
|
|
|
### Optimized Temperature Settings
|
|
- **General chat**: 0.5 (balanced accuracy with some creativity)
|
|
- **Code analysis**: 0.2 (high precision for code review)
|
|
|
|
### Large Context Window
|
|
- Handles up to 1M tokens (~4M characters)
|
|
- Perfect for analyzing entire codebases
|
|
- Maintains context across multiple large files
|
|
|
|
## 🛠️ Available Tools
|
|
|
|
### `chat`
|
|
General-purpose developer conversations with Gemini.
|
|
|
|
**Example uses:**
|
|
```
|
|
"Ask Gemini about the best approach for implementing a distributed cache"
|
|
"Use Gemini to explain the tradeoffs between different authentication strategies"
|
|
```
|
|
|
|
### `analyze_code`
|
|
Specialized tool for analyzing large files or multiple files that exceed Claude's limits.
|
|
|
|
**Example uses:**
|
|
```
|
|
"Use Gemini to analyze /src/core/engine.py and identify performance bottlenecks"
|
|
"Have Gemini review these files together: auth.py, users.py, permissions.py"
|
|
```
|
|
|
|
### `list_models`
|
|
Lists available Gemini models (defaults to 2.5 Pro Preview).
|
|
|
|
## 📋 Installation
|
|
|
|
1. Clone the repository:
|
|
```bash
|
|
git clone https://github.com/BeehiveInnovations/gemini-mcp-server.git
|
|
cd gemini-mcp-server
|
|
```
|
|
|
|
2. Create virtual environment:
|
|
```bash
|
|
python3 -m venv venv
|
|
source venv/bin/activate # On Windows: venv\Scripts\activate
|
|
```
|
|
|
|
3. Install dependencies:
|
|
```bash
|
|
pip install -r requirements.txt
|
|
```
|
|
|
|
4. Set your Gemini API key:
|
|
```bash
|
|
export GEMINI_API_KEY="your-api-key-here"
|
|
```
|
|
|
|
## 🔧 Advanced Configuration
|
|
|
|
### Custom System Prompts
|
|
Override the default developer prompt when needed:
|
|
```python
|
|
{
|
|
"prompt": "Review this code",
|
|
"system_prompt": "You are a security expert. Focus only on vulnerabilities."
|
|
}
|
|
```
|
|
|
|
### Temperature Control
|
|
Adjust for your use case:
|
|
- `0.1-0.3`: Maximum precision (debugging, security analysis)
|
|
- `0.4-0.6`: Balanced (general development tasks)
|
|
- `0.7-0.9`: Creative solutions (architecture design, brainstorming)
|
|
|
|
### Model Selection
|
|
While defaulting to `gemini-2.5-pro-preview-06-05`, you can specify other models:
|
|
- `gemini-1.5-pro-latest`: Stable alternative
|
|
- `gemini-1.5-flash`: Faster responses
|
|
- Use `list_models` to see all available options
|
|
|
|
## 🎯 Claude Code Integration Examples
|
|
|
|
### When Claude hits token limits:
|
|
```
|
|
Claude: "This file is too large for me to analyze fully..."
|
|
You: "Use Gemini to analyze the entire file and identify the main components"
|
|
```
|
|
|
|
### For architecture reviews:
|
|
```
|
|
You: "Use Gemini to analyze all files in /src/core/ and create an architecture diagram"
|
|
```
|
|
|
|
### For performance optimization:
|
|
```
|
|
You: "Have Gemini profile this codebase and suggest the top 5 performance improvements"
|
|
```
|
|
|
|
## 📝 Notes
|
|
|
|
- Gemini 2.5 Pro Preview may occasionally block certain prompts due to safety filters
|
|
- The server automatically falls back gracefully when this happens
|
|
- Token estimation: ~4 characters per token
|
|
- All file paths should be absolute paths
|
|
|
|
## 🤝 Contributing
|
|
|
|
This server is designed specifically for Claude Code users. Contributions that enhance the developer experience are welcome!
|
|
|
|
## 📄 License
|
|
|
|
MIT License - feel free to customize for your development workflow. |