Skip to main content
Glama
Gemini MCP Server

Gemini MCP Server

by taehun-kmu

Gemini MCP Server

MCP (Model Context Protocol) Server with Google Gemini CLI integration for AI second opinions and validation in development workflows.

Features

  • πŸ€– AI Second Opinions: Get alternative perspectives from Google's Gemini AI

  • πŸ” Automatic Uncertainty Detection: Triggers consultations when uncertainty is detected

  • ⚑ Rate Limiting: Built-in rate limiting to prevent API abuse

  • πŸ›‘οΈ Configurable Models: Support for different Gemini models

  • πŸ“Š Consultation Logging: Track all AI consultations with timestamps

Related MCP server: Gemini MCP Server for Claude Code

Quick Start

Run directly without installation:

# Run in current directory
uvx gemini-mcp-server

# Run with specific project root
uvx gemini-mcp-server --project-root /path/to/project

Local Development

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

# Install with uv
uv pip install -e .

# Run the server
gemini-mcp-server

Prerequisites

  1. Node.js 18+ - Required for Gemini CLI

  2. Python 3.8+ - Required for MCP server

  3. Gemini CLI - Install and authenticate:

# Install Gemini CLI
npm install -g @google/gemini-cli

# Authenticate (run once)
gemini

Configuration

Create a gemini-config.json file in your project root:

{
  "enabled": true,
  "auto_consult": true,
  "cli_command": "gemini",
  "timeout": 60,
  "rate_limit_delay": 2.0,
  "model": "gemini-2.5-flash",
  "log_consultations": true
}

Environment Variables

Override configuration with environment variables:

  • GEMINI_ENABLED: Enable/disable integration

  • GEMINI_AUTO_CONSULT: Enable/disable automatic consultation

  • GEMINI_CLI_COMMAND: CLI command (default: "gemini")

  • GEMINI_TIMEOUT: Command timeout in seconds

  • GEMINI_RATE_LIMIT: Delay between consultations

  • GEMINI_MODEL: Model to use (default: "gemini-2.5-flash")

MCP Tools

The server exposes three MCP tools:

  1. consult_gemini: Get second opinions from Gemini

    • query: The question or topic

    • context: Additional context

    • comparison_mode: Request structured comparison format

  2. gemini_status: Check integration status and statistics

  3. toggle_gemini_auto_consult: Enable/disable automatic consultation

    • enable: true/false or omit to toggle

Claude Code Integration

Configure Claude Code to use this MCP server by adding to your MCP configuration:

{
  "mcpServers": {
    "gemini": {
      "command": "uvx",
      "args": ["gemini-mcp-server"],
      "env": {
        "GEMINI_ENABLED": "true"
      }
    }
  }
}

Note: Add "--project-root", "/path/to/project" to args if you need to specify a different project directory.

Development

Project Structure

gemini-mcp-server/
β”œβ”€β”€ gemini_mcp/
β”‚   β”œβ”€β”€ __init__.py
β”‚   β”œβ”€β”€ __main__.py         # CLI entry point
β”‚   β”œβ”€β”€ gemini_integration.py  # Gemini integration logic
β”‚   └── server.py           # MCP server implementation
β”œβ”€β”€ pyproject.toml          # Package configuration
β”œβ”€β”€ README.md              # This file
β”œβ”€β”€ LICENSE                # MIT License
β”œβ”€β”€ setup-gemini-integration.sh  # Setup script
└── gemini-config.json     # Example configuration

Running Tests

# Install dev dependencies
uv pip install -e ".[dev]"

# Run tests
pytest

# Format code
ruff format gemini_mcp
ruff check gemini_mcp

License

MIT License - see LICENSE file for details.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      A
      quality
      D
      maintenance
      Integrates Google's Gemini AI models into Claude Code and other MCP clients to provide second opinions, code comparisons, and token counting. It supports streaming responses and multi-turn conversations directly within your existing AI development workflow.
      3
      Apache 2.0
    • A
      license
      A
      quality
      C
      maintenance
      Enables any MCP-capable coding agent to request an independent, read-only second opinion from a stronger model at consequential decision points such as planning, debugging, risk review, and handoff. It exposes consult, session-state, reset, and health tools over stdio or authenticated Streamable HTTP, with explicit context, structured validated advice, session continuity, call budgets, and secret redaction.
      5
      MIT