gemini-bridge

gemini-bridge

A lightweight MCP server bridging AI agents to Google's Gemini AI via official CLI

Category
访问服务器

README

Gemini Bridge

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

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
  • 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
  • Universal MCP Compatibility: Works with any MCP-compatible AI coding assistant

🚀 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

🌐 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

<details> <summary><strong>Claude Code</strong> (Default)</summary>

# 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

</details>

<details> <summary><strong>Cursor</strong></summary>

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: SettingsCursor SettingsMCPAdd new global MCP server

</details>

<details> <summary><strong>VS Code</strong></summary>

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

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

Alternative: Through Extensions

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

</details>

<details> <summary><strong>Windsurf</strong></summary>

Add to your Windsurf MCP configuration:

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

</details>

<details> <summary><strong>Cline</strong> (VS Code Extension)</summary>

  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-bridge": {
      "command": "uvx",
      "args": ["gemini-bridge"],
      "env": {}
    }
  }
}

</details>

<details> <summary><strong>Void</strong></summary>

Go to: SettingsMCPAdd MCP Server

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

</details>

<details> <summary><strong>Cherry Studio</strong></summary>

  1. Navigate to Settings → MCP Servers → Add Server
  2. Fill in the server details:
    • Name: gemini-bridge
    • Type: STDIO
    • Command: uvx
    • Arguments: ["gemini-bridge"]
  3. Save the configuration

</details>

<details> <summary><strong>Augment</strong></summary>

Using the UI:

  1. Click hamburger menu → SettingsTools
  2. Click + Add MCP button
  3. Enter command: uvx gemini-bridge
  4. Name: Gemini Bridge

Manual Configuration:

"augment.advanced": { 
  "mcpServers": [ 
    { 
      "name": "gemini-bridge", 
      "command": "uvx", 
      "args": ["gemini-bridge"],
      "env": {}
    }
  ]
}

</details>

<details> <summary><strong>Roo Code</strong></summary>

  1. Go to Settings → MCP Servers → Edit Global Config
  2. Add to mcp_settings.json:
{
  "mcpServers": {
    "gemini-bridge": {
      "command": "uvx",
      "args": ["gemini-bridge"],
      "env": {}
    }
  }
}

</details>

<details> <summary><strong>Zencoder</strong></summary>

  1. Go to Zencoder menu (...) → ToolsAdd Custom MCP
  2. Add configuration:
{
  "command": "uvx",
  "args": ["gemini-bridge"],
  "env": {}
}
  1. Hit the Install button

</details>

<details> <summary><strong>Alternative Installation Methods</strong></summary>

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": {}
}

</details>

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:

<details> <summary><strong>Claude Code</strong></summary>

# Add with custom timeout (120 seconds)
claude mcp add gemini-bridge -s user --env GEMINI_BRIDGE_TIMEOUT=120 -- uvx gemini-bridge

</details>

<details> <summary><strong>Manual Configuration (mcp_settings.json)</strong></summary>

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

</details>

Timeout Options:

  • Default: 60 seconds (if not configured)
  • Range: Any positive integer (seconds)
  • 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 (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
├── 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 can be created in the docs/ directory

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

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选