Skip to main content

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

Project description

Gemini Bridge

PyPI Version MIT License Python 3.10+ MCP Compatible CI Status

A lightweight MCP (Model Context Protocol) server that enables Claude Code to interact with Google's Gemini AI through the official CLI. Designed for simplicity, reliability, and seamless integration.

โœจ Features

  • Direct Gemini CLI Integration: Zero API costs using official Gemini CLI
  • Simple MCP Tools: Two core functions for basic queries and file analysis
  • 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

๐Ÿš€ 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-bridge

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

Alternative: From Source

# Clone the repository
git clone https://github.com/shelakh/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-bridge -s user -- uvx gemini-bridge

Development Installation

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

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

๐Ÿ› ๏ธ 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 (default: current directory)
  • model (string, optional): Model to use - "flash" or "pro" (default: "flash")

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" or "pro" (default: "flash")

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"
)

๐Ÿ“‹ 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"]
)

๐Ÿ—๏ธ Architecture

Core Design

  • CLI-First: Direct subprocess calls to gemini command
  • Stateless: Each tool call is independent with no session state
  • Fixed Timeout: 60-second maximum execution time
  • 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
โ”œโ”€โ”€ start_server_uvx.sh         # Production startup script
โ”œโ”€โ”€ start_server_dev.sh         # Development startup script
โ”œโ”€โ”€ 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
  • Discussions: Join the community discussion
  • Documentation: Additional docs available in the docs/ directory

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_bridge-1.0.0.tar.gz (6.9 kB view details)

Uploaded Source

Built Distribution

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

gemini_bridge-1.0.0-py3-none-any.whl (7.6 kB view details)

Uploaded Python 3

File details

Details for the file gemini_bridge-1.0.0.tar.gz.

File metadata

  • Download URL: gemini_bridge-1.0.0.tar.gz
  • Upload date:
  • Size: 6.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for gemini_bridge-1.0.0.tar.gz
Algorithm Hash digest
SHA256 1ce48477abad1e99258e06b1b4738a5f8f725901b4a561b794f5908eba528ccc
MD5 e647bf7f196980af6f5b9c414c9656a7
BLAKE2b-256 62705fcfe32e5887778c0fc965505884e4288fe5031ab5366d68bd809ee9c1ed

See more details on using hashes here.

File details

Details for the file gemini_bridge-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: gemini_bridge-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 7.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for gemini_bridge-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 99608b1a9b2db41c4f71ca32702946172e8d01d3bc0aa13e6d1a6649e5729122
MD5 a0c3fbb3decdd36259ce347d75de851f
BLAKE2b-256 6ef71ed1a2389bd4074278a79f53c6a96492030c59930a331314a0ce1de5e95e

See more details on using hashes here.

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