Give Claude Code access to Google's Gemini AI models.
Gemini MCP Server for Claude Code
Give Claude Code access to Google's Gemini AI models. Get second opinions, compare approaches, and leverage Gemini's capabilities—all from within your Claude Code session.
Quick Start
# 1. Clone and build
git clone https://github.com/Raydius/gemini-for-claude-mcp.git
cd gemini-for-claude-mcp
npm install && npm run build
# 2. Add to Claude Code (replace with your actual path and API key)
claude mcp add gemini -e GEMINI_API_KEY=your-api-key -e GEMINI_DEFAULT_MODEL=gemini-3-pro-preview -- node $(pwd)/dist/app.js
# 3. Start Claude Code and try it out
claude
Then ask Claude:
"Ask Gemini to explain the tradeoffs between microservices and monoliths"
Features
- Built for Claude Code - Seamlessly integrates with your Claude Code workflow
- Streaming Responses - Enabled by default for real-time output
- Multi-turn Conversations - Maintain context across multiple Gemini queries
- Configurable Model - Set your preferred Gemini model via environment variable
- Token Counting - Estimate costs before making queries
- Type-Safe - Built with strict TypeScript
- Well-Tested - 100% domain layer test coverage
Prerequisites
- Claude Code - Installation guide
- Node.js 20+ - Download
- Gemini API Key - Get one from Google AI Studio
Installation & Setup
Step 1: Clone and Build
git clone https://github.com/Raydius/gemini-for-claude-mcp.git
cd gemini-for-claude-mcp
npm install
npm run build
Step 2: Add to Claude Code
Option A: Using the CLI (Recommended)
# Basic setup (substitute default model for any valid Gemini model designation string)
claude mcp add gemini \
-e GEMINI_API_KEY=your-api-key \
-e GEMINI_DEFAULT_MODEL=gemini-3-pro-preview \
-- node /absolute/path/to/gemini-for-claude-mcp/dist/app.js
Option B: Manual Configuration
Edit your Claude Code settings file (~/.claude.json):
{
"mcpServers": {
"gemini": {
"command": "node",
"args": ["/absolute/path/to/gemini-for-claude-mcp/dist/app.js"],
"env": {
"GEMINI_API_KEY": "your-api-key-here",
"GEMINI_DEFAULT_MODEL": "gemini-2.5-flash"
}
}
}
}
See Configuration for all available options and supported models.
Step 3: Verify Installation
Start Claude Code and verify the server is connected:
claude
Then ask:
"What Gemini models are available?"
If configured correctly, Claude will use the list_gemini_models tool and show you the available models.
Using with Claude Code
Once installed, you can ask Claude to use Gemini in natural language. Here are some examples:
Get a Second Opinion
You: I'm implementing a rate limiter. Can you ask Gemini for its approach?
Claude: I'll query Gemini for an alternative perspective on rate limiting...
[Uses query_gemini tool]
Gemini suggests using a token bucket algorithm. Here's the comparison:
- My approach: Sliding window...
- Gemini's approach: Token bucket with...
Compare Solutions
You: Here's my sorting algorithm. Have Gemini review it and compare approaches.
Claude: Let me get Gemini's analysis of your sorting implementation...
[Uses query_gemini tool]
Gemini's feedback: ...
Leverage Gemini's Strengths
You: Ask Gemini to analyze this mathematical proof for logical errors.
Claude: I'll have Gemini examine the proof...
[Uses query_gemini tool]
Check Token Usage Before Querying
You: How many tokens would this prompt use with Gemini?
Claude: Let me count the tokens...
[Uses count_gemini_tokens tool]
This text would use approximately 1,250 tokens.
Multi-turn Conversations
You: Start a conversation with Gemini about Rust's ownership model.
Claude: [Uses query_g
Tools (3)
query_geminiSends a prompt to the Gemini model to get a response, analysis, or comparison.count_gemini_tokensEstimates the number of tokens a prompt would use with Gemini.list_gemini_modelsLists the available Gemini models.Environment Variables
GEMINI_API_KEYrequiredYour Google AI Studio API keyGEMINI_DEFAULT_MODELThe default Gemini model to useConfiguration
{"mcpServers": {"gemini": {"command": "node", "args": ["/absolute/path/to/gemini-for-claude-mcp/dist/app.js"], "env": {"GEMINI_API_KEY": "your-api-key-here", "GEMINI_DEFAULT_MODEL": "gemini-2.5-flash"}}}}