Gemini MCP Server

Gemini MCP Server

A Model Context Protocol server that enables Claude to collaborate with Google's Gemini AI models, providing tools for question answering, code review, brainstorming, test generation, and explanations.

Category
Visit Server

README

Gemini MCP Server

A Model Context Protocol (MCP) server that enables Claude to collaborate with Google's Gemini AI models.

Features

  • 🤖 Multiple Gemini Tools: Ask questions, review code, brainstorm ideas, generate tests, and get explanations
  • 🔄 Dual-Model Support: Automatic fallback from experimental to stable models
  • Configurable Models: Easy switching between different Gemini variants
  • 🛡️ Reliable: Never lose functionality with automatic model fallback
  • 📊 Transparent: Shows which model was used for each response

Quick Start

1. Prerequisites

2. Installation

# Clone the repository
git clone https://github.com/lbds137/gemini-mcp-server.git
cd gemini-mcp-server

# Install dependencies
pip install -r requirements.txt

# Copy and configure environment
cp .env.example .env
# Edit .env and add your GEMINI_API_KEY

3. Configuration

Edit .env to configure your models:

# Your Gemini API key (required)
GEMINI_API_KEY=your_api_key_here

# Model configuration (optional - defaults shown)
GEMINI_MODEL_PRIMARY=gemini-2.5-pro-preview-06-05
GEMINI_MODEL_FALLBACK=gemini-1.5-pro
GEMINI_MODEL_TIMEOUT=10000

4. Development Setup

For development with PyCharm or other IDEs:

# Create virtual environment
python -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate

# Install in development mode
pip install -e .

# Run tests
python -m pytest

5. Register with Claude

# Install to MCP location
./scripts/install.sh

# Or manually register
claude mcp add gemini-collab python3 ~/.claude-mcp-servers/gemini-collab/server.py

Available Tools

ask_gemini

General questions and problem-solving assistance.

gemini_code_review

Get code review feedback focusing on security, performance, and best practices.

gemini_brainstorm

Collaborative brainstorming for architecture and design decisions.

gemini_test_cases

Generate comprehensive test scenarios for your code.

gemini_explain

Get clear explanations of complex code or concepts.

server_info

Check server status and model configuration.

Model Configurations

Best Quality (Default)

GEMINI_MODEL_PRIMARY=gemini-2.5-pro-preview-06-05
GEMINI_MODEL_FALLBACK=gemini-1.5-pro

Best Performance

GEMINI_MODEL_PRIMARY=gemini-2.5-flash-preview-05-20
GEMINI_MODEL_FALLBACK=gemini-2.0-flash

Most Cost-Effective

GEMINI_MODEL_PRIMARY=gemini-2.0-flash
GEMINI_MODEL_FALLBACK=gemini-2.0-flash-lite

Development

Project Structure

gemini-mcp-server/
├── src/
│   └── gemini_mcp/
│       ├── __init__.py
│       └── server.py      # Main server with DualModelManager
├── tests/
│   └── test_server.py
├── scripts/
│   ├── install.sh       # Quick installation script
│   ├── update.sh        # Update deployment script
│   └── dev-link.sh      # Development symlink script
├── docs/
│   └── BUILD_YOUR_OWN_MCP_SERVER.md
├── .claude/
│   └── settings.json    # Claude Code permissions
├── .env                 # Your configuration (git-ignored)
├── .env.example         # Example configuration
├── .gitignore
├── CLAUDE.md           # Instructions for Claude Code
├── LICENSE
├── README.md           # This file
├── docs/
│   ├── BUILD_YOUR_OWN_MCP_SERVER.md
│   ├── DUAL_MODEL_CONFIGURATION.md # Dual-model setup guide
│   ├── PYCHARM_SETUP.md
│   └── TESTING.md
├── requirements.txt
├── setup.py
├── package.json        # MCP registration metadata
└── package-lock.json

Running Tests

python -m pytest tests/ -v

Contributing

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

Updating

To update your local MCP installation after making changes:

./scripts/update.sh

This will copy the latest version to your MCP servers directory.

Troubleshooting

Server not found

# Check registration
claude mcp list

# Re-register if needed
./scripts/install.sh

API Key Issues

# Verify environment variable
echo $GEMINI_API_KEY

# Test directly
python -c "import google.generativeai as genai; genai.configure(api_key='$GEMINI_API_KEY'); print('✅ API key works')"

Model Availability

Some models may not be available in all regions. Check the fallback model in logs if primary fails consistently.

License

MIT License - see LICENSE file for details.

Acknowledgments

Recommended Servers

playwright-mcp

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.

Official
Featured
TypeScript
Magic Component Platform (MCP)

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.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

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.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

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.

Official
Featured
TypeScript
Kagi MCP Server

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.

Official
Featured
Python
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

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.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured