gemini-bridge
Gemini Bridge provides MCP tools to interact with Google's Gemini AI through the official CLI.
Run direct queries to Gemini using
consult_geminiwith a query and working directory, optionally choosing a model and timeout.Analyze files by sending prompts plus file paths via
consult_gemini_with_files, using inline snippets orat_commandfor CLI-side file resolution.Perform web-search-assisted queries via
web_search, with best-effort automatic web search by Gemini.Use model aliases such as flash, pro, flash-lite, auto, etc., and override the default 60-second timeout per call or via env var.
Integrate with MCP-compatible clients like Claude Code, Cursor, VS Code, and others.
Benefit from stateless operation, error handling, and safeguards for large inline file transfers.
Enables AI coding assistants to interact with Google's Gemini AI through the official CLI, providing tools for general queries and file analysis with support for both flash and pro models
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@gemini-bridge explain this Python function: def calculate_total(items): return sum(item['price'] for item in items)"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
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>=2,<3and Gemini CLIEasy 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+)
Related MCP server: Globalping
š 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-bridgeAlternative: 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-bridgeDevelopment 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 srcGlobal 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-bridgeType:
STDIOCommand:
uvxArguments:
["gemini-bridge"]
Save the configuration
Using the UI:
Click hamburger menu ā Settings ā Tools
Click + Add MCP button
Enter command:
uvx gemini-bridgeName: 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 extensionsRecommended: 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
geminicommandStateless: 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 toolingSimple 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 --versionIntegration 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 --versionConnection 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.
Available Tools
3 toolsconsult_geminiA
Send a query directly to the Gemini CLI.
Args:
query: Prompt text forwarded verbatim to the CLI.
directory: Working directory used for command execution.
model: Optional model alias (``flash``, ``pro``) or full Gemini model id.
timeout_seconds: Optional per-call timeout override in seconds.
Returns:
Gemini's response text or an explanatory error string.
Inputs: query (required), directory (required), model, timeout_seconds. Returns: result
consult_gemini_with_filesA
Send a query to the Gemini CLI with file context.
Args:
query: Prompt text forwarded to the CLI.
directory: Working directory used for resolving relative file paths.
files: File paths to include alongside the prompt. Paths must resolve
inside ``directory``; entries pointing outside it are skipped.
model: Optional model alias (``flash``, ``pro``) or full Gemini model id.
timeout_seconds: Optional per-call timeout override in seconds.
mode: ``"inline"`` streams truncated snippets; ``"at_command"`` emits
``@path`` directives so Gemini CLI resolves files itself.
Returns:
Gemini's response or an explanatory error string with any warnings.
Inputs: query (required), directory (required), mode, files, +2 more. Returns: result
web_searchA
Ask Gemini queries with web search context.
Note: This uses Gemini CLI's automatic web search capability.
The model determines when to search based on query context.
Best-effort web search - not guaranteed for every query.
Args:
query: Search query or question to look up on the web
directory: Working directory for command execution
model: Optional model alias (flash, pro, or custom)
timeout_seconds: Optional per-call timeout override in seconds
Returns:
Gemini's response with potential web sources
Inputs: query (required), model, directory, timeout_seconds. Returns: result
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelogā¦
TDQS
Scored across 3 tools
The three tools are mostly distinguishable: consult_gemini is plain, consult_gemini_with_files adds file context, and web_search adds search context. The overlap between the two consult_* tools is realāthey differ only by file argumentsābut the file/web/plain split gives an agent a reasonable basis for selection.
Two tools follow a clean consult_gemini / consult_gemini_with_files pattern, and web_search is a readable verb_noun name. The only deviation is web_search not carrying the consult_ prefix, but it describes a genuinely different capability so it still reads consistently.
Three tools is well-scoped for a thin bridge to a single CLI. Each tool maps to a distinct query mode rather than padding the surface, though the small count sits at the lower edge of the ideal range.
For a Gemini CLI passthrough the surface covers the main workflows: plain queries, file-context queries, and web-grounded queries. Minor gaps exist (no streaming/session continuity or config/inspection tool), but agents can accomplish the core task set without dead ends.
Maintenance
Related MCP Connectors
MCP server for AI dialogue using various LLM models via AceDataCloud
An MCP server that provides agents access to the KeldynAI platform
MCP server for OpenAI API (chat completions, image generation, embeddings) via AceDataCloud
MCP server for GLM chat completions using Zhipu AI models via AceDataCloud
Related MCP Servers
- FlicenseBqualityDmaintenanceA lightweight MCP server that provides a unified interface to various LLM providers including OpenAI, Anthropic, Google Gemini, Groq, DeepSeek, and Ollama.6734-

Globalpingofficial
FlicenseNot gradedqualityCmaintenanceRemote MCP server that gives LLMs access to run network commands67-- AlicenseAqualityFmaintenanceA lightweight MCP server that enables AI coding assistants to interact with Google's Gemini AI through the official CLI.3MIT
- AlicenseNot gradedqualityNot gradedmaintenanceAn MCP server that lets Claude query Google's Gemini CLI as a sub-agent. Get second opinions, verify information, and cross-reference answers between AI models.MIT