Skip to main content

Lightweight MCP server bridging Claude Code to Google's Gemini AI via official CLI

This project has been archived.

The maintainers of this project have marked this project as archived. No new releases are expected.

Project description

Gemini MCP Bridge

CI Status PyPI Version MIT License Python 3.10+ MCP Compatible Gemini CLI

Forked from eLyiN/gemini-bridge - This is a customized fork of the original Gemini Bridge project, rebranded as "Gemini MCP Bridge" for distinct package identity.

A lightweight MCP (Model Context Protocol) server that enables AI coding assistants to interact with Google's Gemini AI through the official CLI. Works with Claude Code, Cursor, VS Code, and other MCP-compatible clients. Designed for simplicity, reliability, and seamless integration.

โœจ Features

  • Direct Gemini CLI Integration: Zero API costs using official Gemini CLI
  • Three MCP Tools: Basic queries, file analysis, and web search capabilities
  • Stateless Operation: No sessions, caching, or complex state management
  • Production Ready: Robust error handling with configurable 60-second timeouts
  • Minimal Dependencies: Only requires mcp>=1.0.0 and Gemini CLI
  • Easy Deployment: Support for both uvx and traditional pip installation
  • Universal MCP Compatibility: Works with any MCP-compatible AI coding assistant
  • Modern Python: Uses pathlib and modern type hints (Python 3.10+)

๐Ÿš€ Quick Start

Prerequisites

  1. Install Gemini CLI:

    npm install -g @google/gemini-cli
    
  2. Authenticate with Gemini:

    gemini auth login
    
  3. Verify installation:

    gemini --version
    

Installation

๐ŸŽฏ Recommended: PyPI Installation

# Install from PyPI
pip install gemini-mcp-bridge

# Add to Claude Code with uvx (recommended)
claude mcp add gemini-mcp-bridge -s user -- uvx gemini-mcp-bridge

Alternative: From Source

# Clone the repository
git clone https://github.com/FojleRabbiRabib/gemini-bridge.git
cd gemini-bridge

# Build and install locally
uvx --from build pyproject-build
pip install dist/*.whl

# Add to Claude Code
claude mcp add gemini-mcp-bridge -s user -- uvx gemini-mcp-bridge

Development Installation

# Clone and install in development mode
git clone https://github.com/FojleRabbiRabib/gemini-bridge.git
cd gemini-bridge
pip install -e .

# Add to Claude Code (development)
claude mcp add gemini-mcp-bridge-dev -s user -- python -m src

๐ŸŒ Multi-Client Support

Gemini Bridge works with any MCP-compatible AI coding assistant - the same server supports multiple clients through different configuration methods.

Supported MCP Clients

  • Claude Code โœ… (Default)
  • Cursor โœ…
  • VS Code โœ…
  • Windsurf โœ…
  • Cline โœ…
  • Void โœ…
  • Cherry Studio โœ…
  • Augment โœ…
  • Roo Code โœ…
  • Zencoder โœ…
  • Any MCP-compatible client โœ…

Configuration Examples

Claude Code (Default)
# Recommended installation
claude mcp add gemini-mcp-bridge -s user -- uvx gemini-mcp-bridge

# Development installation
claude mcp add gemini-mcp-bridge-dev -s user -- python -m src
Cursor

Global Configuration (~/.cursor/mcp.json):

{
  "mcpServers": {
    "gemini-mcp-bridge": {
      "command": "uvx",
      "args": ["gemini-mcp-bridge"],
      "env": {}
    }
  }
}

Project-Specific (.cursor/mcp.json in your project):

{
  "mcpServers": {
    "gemini-mcp-bridge": {
      "command": "uvx",
      "args": ["gemini-mcp-bridge"],
      "env": {}
    }
  }
}

Go to: Settings โ†’ Cursor Settings โ†’ MCP โ†’ Add new global MCP server

VS Code

Configuration (.vscode/mcp.json in your workspace):

{
  "servers": {
    "gemini-mcp-bridge": {
      "type": "stdio",
      "command": "uvx",
      "args": ["gemini-mcp-bridge"]
    }
  }
}

Alternative: Through Extensions

  1. Open Extensions view (Ctrl+Shift+X)
  2. Search for MCP extensions
  3. Add custom server with command: uvx gemini-mcp-bridge
Windsurf

Add to your Windsurf MCP configuration:

{
  "mcpServers": {
    "gemini-mcp-bridge": {
      "command": "uvx",
      "args": ["gemini-mcp-bridge"],
      "env": {}
    }
  }
}
Cline (VS Code Extension)
  1. Open Cline and click MCP Servers in the top navigation
  2. Select Installed tab โ†’ Advanced MCP Settings
  3. Add to cline_mcp_settings.json:
{
  "mcpServers": {
    "gemini-mcp-bridge": {
      "command": "uvx",
      "args": ["gemini-mcp-bridge"],
      "env": {}
    }
  }
}
Void

Go to: Settings โ†’ MCP โ†’ Add MCP Server

{
  "mcpServers": {
    "gemini-mcp-bridge": {
      "command": "uvx",
      "args": ["gemini-mcp-bridge"],
      "env": {}
    }
  }
}
Cherry Studio
  1. Navigate to Settings โ†’ MCP Servers โ†’ Add Server
  2. Fill in the server details:
    • Name: gemini-mcp-bridge
    • Type: STDIO
    • Command: uvx
    • Arguments: ["gemini-mcp-bridge"]
  3. Save the configuration
Augment

Using the UI:

  1. Click hamburger menu โ†’ Settings โ†’ Tools
  2. Click + Add MCP button
  3. Enter command: uvx gemini-mcp-bridge
  4. Name: Gemini Bridge

Manual Configuration:

"augment.advanced": { 
  "mcpServers": [ 
    { 
      "name": "gemini-mcp-bridge", 
      "command": "uvx", 
      "args": ["gemini-mcp-bridge"],
      "env": {}
    }
  ]
}
Roo Code
  1. Go to Settings โ†’ MCP Servers โ†’ Edit Global Config
  2. Add to mcp_settings.json:
{
  "mcpServers": {
    "gemini-mcp-bridge": {
      "command": "uvx",
      "args": ["gemini-mcp-bridge"],
      "env": {}
    }
  }
}
Zencoder
  1. Go to Zencoder menu (...) โ†’ Tools โ†’ Add Custom MCP
  2. Add configuration:
{
  "command": "uvx",
  "args": ["gemini-mcp-bridge"],
  "env": {}
}
  1. Hit the Install button
Alternative Installation Methods

For pip-based installations:

{
  "command": "gemini-mcp-bridge",
  "args": [],
  "env": {}
}

For development/local testing:

{
  "command": "python",
  "args": ["-m", "src"],
  "env": {},
  "cwd": "/path/to/gemini-bridge"
}

For npm-style installation (if needed):

{
  "command": "npx",
  "args": ["gemini-mcp-bridge"],
  "env": {}
}

Universal Usage

Once configured with any client, use the same two tools:

  1. Ask general questions: "What authentication patterns are used in this codebase?"
  2. Analyze specific files: "Review these auth files for security issues"

The server implementation is identical - only the client configuration differs!

โš™๏ธ Configuration

Timeout Configuration

By default, Gemini Bridge uses a 60-second timeout for all CLI operations. For longer queries (large files, complex analysis), you can configure a custom timeout using the GEMINI_BRIDGE_TIMEOUT environment variable.

Example configurations:

Claude Code
# Add with custom timeout (120 seconds)
claude mcp add gemini-mcp-bridge -s user --env GEMINI_BRIDGE_TIMEOUT=120 -- uvx gemini-mcp-bridge
Manual Configuration (mcp_settings.json)
{
  "mcpServers": {
    "gemini-mcp-bridge": {
      "command": "uvx",
      "args": ["gemini-mcp-bridge"],
      "env": {
        "GEMINI_BRIDGE_TIMEOUT": "120"
      }
    }
  }
}

Timeout Options:

  • Default: 60 seconds (if not configured)
  • Range: Any positive integer (seconds)
  • Per-call override: Supply timeout_seconds to either tool for one-off extensions
  • Recommended: 120-300 seconds for large file analysis
  • Invalid values: Fall back to 60 seconds with warning

๐Ÿ› ๏ธ Available Tools

consult_gemini

Direct CLI bridge for simple queries.

Parameters:

  • query (string): The question or prompt to send to Gemini
  • directory (string): Working directory for the query
  • model (string, optional): Model to use - "flash", "pro", "flash-lite", "2.5-lite", "3-pro", "3-flash", "3.1-pro", "3.1-flash-lite", or "auto" (default: "flash")
  • timeout_seconds (int, optional): Override the execution timeout for this request

Example:

consult_gemini(
    query="Find authentication patterns in this codebase",
    directory="/path/to/project",
    model="flash"
)

consult_gemini_with_files

CLI bridge with file attachments for detailed analysis.

Parameters:

  • query (string): The question or prompt to send to Gemini
  • directory (string): Working directory for the query
  • files (list): List of file paths relative to the directory
  • model (string, optional): Model to use - "flash", "pro", "flash-lite", "2.5-lite", "3-pro", "3-flash", "3.1-pro", "3.1-flash-lite", or "auto" (default: "flash")
  • timeout_seconds (int, optional): Override the execution timeout for this request
  • mode (string, optional): Either "inline" (default) to stream file contents or "at_command" to let Gemini CLI resolve @path references itself

Example:

consult_gemini_with_files(
    query="Analyze these auth files and suggest improvements",
    directory="/path/to/project",
    files=["src/auth.py", "src/models.py"],
    model="pro",
    timeout_seconds=180
)

Tip: When scanning large trees, switch to mode="at_command" so the Gemini CLI handles file globbing and truncation natively.

web_search

Ask Gemini queries with web search context. Uses Gemini CLI's automatic web search when the model determines it's needed. Best-effort functionality - not guaranteed for every query.

Parameters:

  • query (string): Search query or question to look up on the web
  • directory (string): Working directory for command execution
  • model (string, optional): Model to use - "flash", "pro", "flash-lite", "2.5-lite", "3-pro", "3-flash", "3.1-pro", "3.1-flash-lite", or "auto" (default: "flash")
  • timeout_seconds (int, optional): Override the execution timeout for this request

Example:

web_search(
    query="latest Python version and new features",
    model="flash"
)

๐Ÿ“‹ Usage Examples

Basic Code Analysis

# Simple research query
consult_gemini(
    query="What authentication patterns are used in this project?",
    directory="/Users/dev/my-project"
)

Detailed File Review

# Analyze specific files
consult_gemini_with_files(
    query="Review these files and suggest security improvements",
    directory="/Users/dev/my-project",
    files=["src/auth.py", "src/middleware.py"],
    model="pro"
)

Multi-file Analysis

# Compare multiple implementation files
consult_gemini_with_files(
    query="Compare these database implementations and recommend the best approach",
    directory="/Users/dev/my-project",
    files=["src/db/postgres.py", "src/db/sqlite.py", "src/db/redis.py"],
    mode="at_command"
)

Web Search

# Get current information from the web
web_search(
    query="latest Python version and new features in 3.13",
    model="flash"
)

Large File Safeguards

  • Inline transfers cap at ~256 KB per file and ~512 KB per request to avoid hangs.
  • Oversized files are truncated to head/tail snippets with a warning in the MCP response.
  • Tune the caps with environment variables (GEMINI_BRIDGE_MAX_INLINE_TOTAL_BYTES, etc.) or prefer mode="at_command" for bigger payloads.

๐Ÿ—๏ธ Architecture

Core Design

  • CLI-First: Direct subprocess calls to gemini command
  • Stateless: Each tool call is independent with no session state
  • Adaptive Timeout: Defaults to 60 seconds but overridable per request or via env var
  • Attachment Guardrails: Inline mode enforces lightweight limits; @ mode delegates to Gemini CLI tooling
  • Simple Error Handling: Clear error messages with fail-fast approach

Project Structure

gemini-bridge/
โ”œโ”€โ”€ src/
โ”‚   โ”œโ”€โ”€ __init__.py              # Entry point
โ”‚   โ”œโ”€โ”€ __main__.py              # Module execution entry point
โ”‚   โ””โ”€โ”€ mcp_server.py            # Main MCP server implementation
โ”œโ”€โ”€ .github/                     # GitHub templates and workflows
โ”œโ”€โ”€ pyproject.toml              # Python package configuration
โ”œโ”€โ”€ README.md                   # This file
โ”œโ”€โ”€ CONTRIBUTING.md             # Contribution guidelines
โ”œโ”€โ”€ CODE_OF_CONDUCT.md          # Community standards
โ”œโ”€โ”€ SECURITY.md                 # Security policies
โ”œโ”€โ”€ CHANGELOG.md               # Version history
โ””โ”€โ”€ LICENSE                    # MIT license

๐Ÿ”ง Development

Local Testing

# Install in development mode
pip install -e .

# Run directly
python -m src

# Test CLI availability
gemini --version

Integration with Claude Code

The server automatically integrates with Claude Code when properly configured through the MCP protocol.

๐Ÿ” Troubleshooting

CLI Not Available

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

# Authenticate
gemini auth login

# Test
gemini --version

Connection Issues

  • Verify Gemini CLI is properly authenticated
  • Check network connectivity
  • Ensure Claude Code MCP configuration is correct
  • Check that the gemini command is in your PATH

Common Error Messages

  • "CLI not available": Gemini CLI is not installed or not in PATH
  • "Authentication required": Run gemini auth login
  • "Timeout after 60 seconds": Query took too long, try breaking it into smaller parts

๐Ÿค Contributing

We welcome contributions from the community! Please read our Contributing Guidelines for details on how to get started.

Quick Contributing Guide

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Add tests if applicable
  5. Submit a pull request

๐Ÿ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

๐Ÿ”„ Version History

See CHANGELOG.md for detailed version history.

๐Ÿ†˜ Support

  • Issues: Report bugs or request features via GitHub Issues
  • Original Project: For upstream issues, visit eLyiN/gemini-bridge
  • Documentation: Additional docs can be created in the docs/ directory

Original Author: Shelakh - Creator of Gemini Bridge Fork Maintainer: Fojle Rabbi (Rabib) - Maintainer of Gemini MCP Bridge fork

Focus: A simple, reliable bridge between Claude Code and Gemini AI through the official CLI.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

gemini_mcp_bridge-1.4.0.tar.gz (15.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

gemini_mcp_bridge-1.4.0-py3-none-any.whl (12.8 kB view details)

Uploaded Python 3

File details

Details for the file gemini_mcp_bridge-1.4.0.tar.gz.

File metadata

  • Download URL: gemini_mcp_bridge-1.4.0.tar.gz
  • Upload date:
  • Size: 15.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for gemini_mcp_bridge-1.4.0.tar.gz
Algorithm Hash digest
SHA256 62b2c2de0491291e0c5dd62b6c675ec706c9ddbbd08fb7f38e91461fb36ff21d
MD5 217af1fd2bd40e0f91072d80f54d0925
BLAKE2b-256 8a2ae45298917f85a51b124dd19d3c394a9c3df45eb7f07410f4fb999da4f860

See more details on using hashes here.

Provenance

The following attestation bundles were made for gemini_mcp_bridge-1.4.0.tar.gz:

Publisher: release.yml on FojleRabbiRabib/gemini-bridge

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file gemini_mcp_bridge-1.4.0-py3-none-any.whl.

File metadata

File hashes

Hashes for gemini_mcp_bridge-1.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e584b3c4c11f0d64d880f6f4bcbad7c6ce2d282afffb644961df5e3a01981662
MD5 cc6ff0deb8a76b9d0a0fa64893fc92cb
BLAKE2b-256 7e53d28c3d18c09f307c7d3ae5a9d2476e14aa104912db89ef5924ba32aa275e

See more details on using hashes here.

Provenance

The following attestation bundles were made for gemini_mcp_bridge-1.4.0-py3-none-any.whl:

Publisher: release.yml on FojleRabbiRabib/gemini-bridge

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page