Lightweight MCP server bridging Claude Code to Google's Gemini AI via official CLI
Project description
Gemini Bridge
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.0and Gemini CLI - Easy Deployment: Support for both uvx and traditional pip installation
๐ Quick Start
Prerequisites
-
Install Gemini CLI:
npm install -g @google/gemini-cli
-
Authenticate with Gemini:
gemini auth login
-
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 Geminidirectory(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 Geminidirectory(string): Working directory for the queryfiles(list): List of file paths relative to the directorymodel(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
geminicommand - 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
geminicommand 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
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests if applicable
- 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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1ce48477abad1e99258e06b1b4738a5f8f725901b4a561b794f5908eba528ccc
|
|
| MD5 |
e647bf7f196980af6f5b9c414c9656a7
|
|
| BLAKE2b-256 |
62705fcfe32e5887778c0fc965505884e4288fe5031ab5366d68bd809ee9c1ed
|
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
99608b1a9b2db41c4f71ca32702946172e8d01d3bc0aa13e6d1a6649e5729122
|
|
| MD5 |
a0c3fbb3decdd36259ce347d75de851f
|
|
| BLAKE2b-256 |
6ef71ed1a2389bd4074278a79f53c6a96492030c59930a331314a0ce1de5e95e
|