Bridge Gemini AI to Your IDE
Connect MCP-compatible coding clients to Gemini CLI for questions, file analysis, and best-effort web-assisted queries.
1.3.1Add to Favorites
Why it matters
Integrate Google Gemini AI directly into your development environment without API costs. Leverage Gemini's capabilities for code generation, review, and analysis through familiar IDEs like VS Code and Cursor.
Outcomes
What it gets done
Interact with Gemini AI via official CLI for zero-cost queries.
Utilize specialized tools for simple queries and file analysis.
Seamlessly integrate with MCP-compatible clients like Claude Code, Cursor, and VS Code.
Configure custom timeouts and manage file transfer limits for robust operation.
Source
Get it from source
Spark does not host a copy of it.
Open sourceReports
Agent outcome reports
No reports yet
Capabilities
Tools your agent gets
Direct CLI bridge for simple Gemini AI queries
CLI bridge with attached files for detailed analysis of specific files
Overview
Gemini Bridge is a stateless MCP server that invokes the official Gemini CLI. It exposes tools for general questions, analysis with file attachments, and best-effort web search context. Use it to add Gemini consultation to an MCP-compatible coding client. It requires an installed, authenticated Gemini CLI; large attachments and slow queries need appropriate limits and timeouts.
What it does
Gemini Bridge connects MCP-compatible coding clients to Google's Gemini through the official Gemini CLI. It runs CLI subprocesses instead of maintaining sessions or a response cache, so each tool call is independent. The server exposes general consultation, file-assisted analysis, and queries that can use web search context. Distribution uses the MIT license. Its Python requirement is 3.10 or newer, with mcp>=1.0.0 and the Gemini CLI as dependencies.
When to use - and when NOT to
Use the bridge to ask about authentication patterns, review selected files, compare implementations, or request research while staying within a coding client's MCP workflow. Web search is best effort: the CLI decides when to use it, so search context is not guaranteed for every request. This stateless design suits independent consultations rather than a workflow that depends on persistent server-side conversation history.
For large trees, at_command mode lets Gemini CLI handle file references, globbing, and truncation. Inline transfers have approximate safeguards of 256 KB per file and 512 KB per request; oversized files are reduced to head and tail snippets with a warning. The maximum-inline-size environment settings can tune these caps.
Capabilities
The consult_gemini tool accepts a query and working directory. The consult_gemini_with_files tool adds a list of paths relative to that directory and a mode selection: inline streams file contents, while at_command delegates @path resolution to Gemini CLI. The tools support optional model selection and a per-request timeout_seconds override. The documented model aliases include flash, pro, flash-lite, 2.5-lite, 3-pro, 3-flash, 3.1-pro, 3.1-flash-lite, and auto; flash is the default.
The web_search tool accepts a query, directory, optional model, and optional timeout. It asks Gemini for search-assisted answers while retaining the CLI's discretion over whether a search occurs.
The default CLI timeout is 60 seconds. GEMINI_BRIDGE_TIMEOUT sets a different positive integer in seconds, and an individual call can override it. Invalid environment values fall back to 60 seconds with a warning. The documentation suggests 120-300 seconds for complex analysis or large files. Timeout failures can also be addressed by breaking a query into smaller parts.
How to install
Install the official Gemini CLI, authenticate it, and verify that its command is available in PATH before configuring the bridge. The documented setup uses npm for the CLI, gemini auth login for authentication, and gemini --version for a check. The bridge itself is available through PyPI with pip; uvx is the recommended launch method for Claude Code:
claude mcp add gemini-bridge -s user -- uvx gemini-bridge
Other clients use the same server implementation with their own configuration format. Cursor supports global or project MCP JSON configuration. VS Code uses its workspace servers configuration or an MCP extension. Windsurf, Cline, Void, Cherry Studio, Augment, Roo Code, and Zencoder have documented configuration examples. These typically specify uvx as the command and gemini-bridge as its argument. A pip installation can launch the gemini-bridge executable directly; source and development installations are also described.
When a client cannot connect, check CLI installation, authentication, network connectivity, PATH, and MCP configuration. Errors distinguish an unavailable CLI, required authentication, and an operation exceeding its timeout.
Who it's for
The bridge is for users of Claude Code, Cursor, VS Code, and other MCP-compatible coding clients who want access to Gemini CLI consultation from those environments.
Source README
Gemini Bridge
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.0and 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
Install Gemini CLI:
npm install -g @google/gemini-cliAuthenticate with Gemini:
gemini auth loginVerify 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
🌐 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
# Recommended installation
claude mcp add gemini-bridge -s user -- uvx gemini-bridge
# Development installation
claude mcp add gemini-bridge-dev -s user -- python -m src
Global Configuration (~/.cursor/mcp.json):
{
"mcpServers": {
"gemini-bridge": {
"command": "uvx",
"args": ["gemini-bridge"],
"env": {}
}
}
}
Project-Specific (.cursor/mcp.json in your project):
{
"mcpServers": {
"gemini-bridge": {
"command": "uvx",
"args": ["gemini-bridge"],
"env": {}
}
}
}
Go to: Settings → Cursor Settings → MCP → Add new global MCP server
Configuration (.vscode/mcp.json in your workspace):
{
"servers": {
"gemini-bridge": {
"type": "stdio",
"command": "uvx",
"args": ["gemini-bridge"]
}
}
}
Alternative: Through Extensions
- Open Extensions view (Ctrl+Shift+X)
- Search for MCP extensions
- Add custom server with command:
uvx gemini-bridge
Add to your Windsurf MCP configuration:
{
"mcpServers": {
"gemini-bridge": {
"command": "uvx",
"args": ["gemini-bridge"],
"env": {}
}
}
}
- Open Cline and click MCP Servers in the top navigation
- Select Installed tab → Advanced MCP Settings
- Add to
cline_mcp_settings.json:
{
"mcpServers": {
"gemini-bridge": {
"command": "uvx",
"args": ["gemini-bridge"],
"env": {}
}
}
}
Go to: Settings → MCP → Add MCP Server
{
"mcpServers": {
"gemini-bridge": {
"command": "uvx",
"args": ["gemini-bridge"],
"env": {}
}
}
}
- Navigate to Settings → MCP Servers → Add Server
- Fill in the server details:
- Name:
gemini-bridge - Type:
STDIO - Command:
uvx - Arguments:
["gemini-bridge"]
- Name:
- Save the configuration
Using the UI:
- Click hamburger menu → Settings → Tools
- Click + Add MCP button
- Enter command:
uvx gemini-bridge - Name: Gemini Bridge
Manual Configuration:
"augment.advanced": {
"mcpServers": [
{
"name": "gemini-bridge",
"command": "uvx",
"args": ["gemini-bridge"],
"env": {}
}
]
}
- Go to Settings → MCP Servers → Edit Global Config
- Add to
mcp_settings.json:
{
"mcpServers": {
"gemini-bridge": {
"command": "uvx",
"args": ["gemini-bridge"],
"env": {}
}
}
}
- Go to Zencoder menu (...) → Tools → Add Custom MCP
- Add configuration:
{
"command": "uvx",
"args": ["gemini-bridge"],
"env": {}
}
- Hit the Install button
For pip-based installations:
{
"command": "gemini-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-bridge"],
"env": {}
}
Universal Usage
Once configured with any client, use the same two tools:
- Ask general questions: "What authentication patterns are used in this codebase?"
- 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:
# Add with custom timeout (120 seconds)
claude mcp add gemini-bridge -s user --env GEMINI_BRIDGE_TIMEOUT=120 -- uvx gemini-bridge
{
"mcpServers": {
"gemini-bridge": {
"command": "uvx",
"args": ["gemini-bridge"],
"env": {
"GEMINI_BRIDGE_TIMEOUT": "120"
}
}
}
}
Timeout Options:
- Default: 60 seconds (if not configured)
- Range: Any positive integer (seconds)
- Per-call override: Supply
timeout_secondsto 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 Geminidirectory(string): Working directory for the querymodel(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 Geminidirectory(string): Working directory for the queryfiles(list): List of file paths relative to the directorymodel(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 requestmode(string, optional): Either"inline"(default) to stream file contents or"at_command"to let Gemini CLI resolve@pathreferences 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 webdirectory(string): Working directory for command executionmodel(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 prefermode="at_command"for bigger payloads.
🏗️ Architecture
Core Design
- CLI-First: Direct subprocess calls to
geminicommand - 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
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 can be created in the
docs/directory
Focus: A simple, reliable bridge between Claude Code and Gemini AI through the official CLI.
FAQ
Common questions
Discussion
Questions & comments · 0
Sign In Sign in to leave a comment.