houseworthe/gemini-mcp-server
If you are the rightful owner of gemini-mcp-server and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.
A Model Context Protocol (MCP) server that integrates Google's Gemini AI capabilities into Claude Code for enhanced AI collaboration.
Gemini MCP Server for Claude Code
A Model Context Protocol (MCP) server that seamlessly integrates Google's Gemini AI capabilities into Claude Code, enabling powerful AI collaboration.
Features
This MCP server provides Claude with access to Gemini's capabilities through four powerful tools:
- Ask Gemini - Direct question-answering using Gemini's extensive knowledge base
- Code Review - Comprehensive code analysis with support for large codebases
- Brainstorming - Creative ideation and problem-solving assistance
- Large Content Analysis - Analyze extensive documents, logs, or codebases (optimized for 1M+ tokens)
Use Cases
Enhanced Code Development
# Claude can leverage Gemini for specialized tasks:
"Claude, ask Gemini to review this React component for performance optimizations"
"Use Gemini to analyze this entire codebase and identify potential security vulnerabilities"
Collaborative Problem Solving
# Combine Claude's reasoning with Gemini's knowledge:
"Ask Gemini about the latest best practices for microservices architecture"
"Have Gemini brainstorm solutions for scaling our database"
Large-Scale Analysis
# Process extensive content that benefits from Gemini's capabilities:
"Use Gemini to analyze these server logs and identify anomaly patterns"
"Ask Gemini to review this 10,000-line legacy codebase and suggest modernization strategies"
Quick Start
One-Line Installation
curl -sSL https://raw.githubusercontent.com/houseworthe/gemini-mcp-server/main/gemini-mcp/install.sh | bash
Manual Installation
-
Clone this repository:
git clone https://github.com/houseworthe/gemini-mcp-server.git cd gemini-mcp-server
-
Get your Gemini API key from Google AI Studio
-
Run the installer:
cd gemini-mcp ./install.sh
-
Enter your API key when prompted
Architecture
The server acts as a bridge between Claude Code and Google's Gemini API:
Claude Code <-> MCP Protocol <-> Gemini MCP Server <-> Gemini API
Key Components:
- Async JSON-RPC Handler: Processes MCP protocol messages
- Tool Registry: Manages available Gemini tools
- HTTP Client: Direct API communication with Gemini
- Error Handling: Graceful degradation and timeout management
Configuration
Environment Variables
Create a .env
file (see .env.example
):
GEMINI_API_KEY=your-api-key-here
Supported Models
gemini-1.5-flash
(default) - Fast responses for most queriesgemini-1.5-pro
- Automatically used for large content analysis
Development
Prerequisites
- Python 3.7+
- Claude CLI
- Gemini API key
Running Tests
python test_server.py
Project Structure
gemini-mcp-server/
āāā server.py # Main MCP server implementation
āāā test_server.py # Integration tests
āāā gemini-mcp/ # Distribution package
ā āāā server.py # Server for end-user installation
ā āāā install.sh # Installation script
ā āāā setup.sh # Claude MCP registration
ā āāā requirements.txt
āāā README.md
API Documentation
Available Tools
ask_gemini
Basic question-answering interface.
{
"question": "string" // Required: Your question for Gemini
}
gemini_code_review
Comprehensive code review with contextual understanding.
{
"code": "string", // Required: Code to review
"context": "string", // Optional: Additional context
"focus_areas": "string" // Optional: Specific areas to focus on
}
gemini_brainstorm
Creative ideation and problem-solving.
{
"topic": "string", // Required: Topic to brainstorm
"constraints": "string" // Optional: Any constraints or requirements
}
gemini_analyze_large
Analyze extensive content with intelligent summarization.
{
"content": "string", // Required: Large content to analyze
"analysis_type": "string", // Optional: Type of analysis (default: "general")
"questions": "string" // Optional: Specific questions to answer
}
Troubleshooting
Server Not Listed
If the server doesn't appear in claude mcp list
:
claude mcp remove gemini-collab
claude mcp add --scope user gemini-collab python3 ~/.claude-mcp-servers/gemini-collab/server.py
API Key Issues
- Ensure your API key is valid and has the necessary permissions
- Check that the
.env
file is in the correct location - Verify the key is set:
echo $GEMINI_API_KEY
Timeout Errors
The server has a 30-second timeout for API calls. For large content:
- Consider breaking it into smaller chunks
- Use the
gemini_analyze_large
tool which handles content intelligently
Contributing
We welcome contributions! Please see our for details.
Development Setup
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature
) - Commit your changes (
git commit -m 'Add amazing feature'
) - Push to the branch (
git push origin feature/amazing-feature
) - Open a Pull Request
Security
- API keys are stored locally and never transmitted except to Google's API
- All communication uses HTTPS
- The server runs with minimal permissions
- Regular security audits are performed
License
MIT License - see file for details.
Acknowledgments
- Built on the Model Context Protocol by Anthropic
- Powered by Google's Gemini AI
- Inspired by the AI development community
Support
- Issues: GitHub Issues
- Discussions: GitHub Discussions
- Documentation: Wiki
Made with ā¤ļø by the open source community