Skip to main content
Glama
eLyiN
by eLyiN

Gemini Bridge

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

Ein leichtgewichtiger MCP-Server (Model Context Protocol), der es KI-Programmierassistenten ermöglicht, über das offizielle CLI mit Googles Gemini-KI zu interagieren. Funktioniert mit Claude Code, Cursor, VS Code und anderen MCP-kompatiblen Clients. Entwickelt für Einfachheit, Zuverlässigkeit und nahtlose Integration.

✨ Funktionen

  • Direkte Gemini CLI-Integration: Keine API-Kosten durch Nutzung des offiziellen Gemini CLI

  • Drei MCP-Tools: Grundlegende Abfragen, Dateianalyse und Websuchfunktionen

  • Zustandsloser Betrieb: Keine Sitzungen, kein Caching oder komplexes Zustandsmanagement

  • Produktionsbereit: Robuste Fehlerbehandlung mit konfigurierbaren 60-Sekunden-Timeouts

  • Minimale Abhängigkeiten: Erfordert nur mcp>=1.0.0 und das Gemini CLI

  • Einfache Bereitstellung: Unterstützung für uvx und traditionelle pip-Installation

  • Universelle MCP-Kompatibilität: Funktioniert mit jedem MCP-kompatiblen KI-Programmierassistenten

  • Modernes Python: Verwendet pathlib und moderne Typ-Hinweise (Python 3.10+)

Related MCP server: Globalping

🚀 Schnellstart

Voraussetzungen

  1. Gemini CLI installieren:

    npm install -g @google/gemini-cli
  2. Bei Gemini authentifizieren:

    gemini auth login
  3. Installation überprüfen:

    gemini --version

Installation

🎯 Empfohlen: 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: Aus dem Quellcode

# 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

Entwicklungsinstallation

# 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-Unterstützung

Gemini Bridge funktioniert mit jedem MCP-kompatiblen KI-Programmierassistenten – derselbe Server unterstützt mehrere Clients durch verschiedene Konfigurationsmethoden.

Unterstützte MCP-Clients

  • Claude Code ✅ (Standard)

  • Cursor ✅

  • VS Code ✅

  • Windsurf ✅

  • Cline ✅

  • Void ✅

  • Cherry Studio ✅

  • Augment ✅

  • Roo Code ✅

  • Zencoder ✅

  • Jeder MCP-kompatible Client ✅

Konfigurationsbeispiele

# 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

Globale Konfiguration (~/.cursor/mcp.json):

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

Projektspezifisch (.cursor/mcp.json in Ihrem Projekt):

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

Gehen Sie zu: Settings → Cursor Settings → MCP → Add new global MCP server

Konfiguration (.vscode/mcp.json in Ihrem Arbeitsbereich):

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

Alternative: Über Erweiterungen

  1. Erweiterungsansicht öffnen (Strg+Umschalt+X)

  2. Nach MCP-Erweiterungen suchen

  3. Benutzerdefinierten Server hinzufügen mit dem Befehl: uvx gemini-bridge

Fügen Sie dies zu Ihrer Windsurf MCP-Konfiguration hinzu:

{
  "mcpServers": {
    "gemini-bridge": {
      "command": "uvx",
      "args": ["gemini-bridge"],
      "env": {}
    }
  }
}
  1. Öffnen Sie Cline und klicken Sie in der oberen Navigation auf MCP Servers

  2. Wählen Sie den Tab Installed → Advanced MCP Settings

  3. Fügen Sie dies zu cline_mcp_settings.json hinzu:

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

Gehen Sie zu: Settings → MCP → Add MCP Server

{
  "mcpServers": {
    "gemini-bridge": {
      "command": "uvx",
      "args": ["gemini-bridge"],
      "env": {}
    }
  }
}
  1. Navigieren Sie zu Settings → MCP Servers → Add Server

  2. Füllen Sie die Serverdetails aus:

    • Name: gemini-bridge

    • Type: STDIO

    • Command: uvx

    • Arguments: ["gemini-bridge"]

  3. Speichern Sie die Konfiguration

Über die Benutzeroberfläche:

  1. Klicken Sie auf das Hamburger-Menü → Settings → Tools

  2. Klicken Sie auf den Button + Add MCP

  3. Geben Sie den Befehl ein: uvx gemini-bridge

  4. Name: Gemini Bridge

Manuelle Konfiguration:

"augment.advanced": { 
  "mcpServers": [ 
    { 
      "name": "gemini-bridge", 
      "command": "uvx", 
      "args": ["gemini-bridge"],
      "env": {}
    }
  ]
}
  1. Gehen Sie zu Settings → MCP Servers → Edit Global Config

  2. Fügen Sie dies zu mcp_settings.json hinzu:

{
  "mcpServers": {
    "gemini-bridge": {
      "command": "uvx",
      "args": ["gemini-bridge"],
      "env": {}
    }
  }
}
  1. Gehen Sie zum Zencoder-Menü (...) → Tools → Add Custom MCP

  2. Fügen Sie die Konfiguration hinzu:

{
  "command": "uvx",
  "args": ["gemini-bridge"],
  "env": {}
}
  1. Klicken Sie auf den Install-Button

Für pip-basierte Installationen:

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

Für Entwicklung/lokales Testen:

{
  "command": "python",
  "args": ["-m", "src"],
  "env": {},
  "cwd": "/path/to/gemini-bridge"
}

Für npm-artige Installation (falls erforderlich):

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

Universelle Verwendung

Sobald die Konfiguration mit einem Client erfolgt ist, verwenden Sie dieselben zwei Tools:

  1. Allgemeine Fragen stellen: "Welche Authentifizierungsmuster werden in dieser Codebasis verwendet?"

  2. Spezifische Dateien analysieren: "Überprüfe diese Authentifizierungsdateien auf Sicherheitsprobleme"

Die Serverimplementierung ist identisch – nur die Client-Konfiguration unterscheidet sich!

⚙️ Konfiguration

Timeout-Konfiguration

Standardmäßig verwendet Gemini Bridge ein 60-Sekunden-Timeout für alle CLI-Operationen. Für längere Abfragen (große Dateien, komplexe Analysen) können Sie ein benutzerdefiniertes Timeout über die Umgebungsvariable GEMINI_BRIDGE_TIMEOUT konfigurieren.

Beispielkonfigurationen:

# 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-Optionen:

  • Standard: 60 Sekunden (falls nicht konfiguriert)

  • Bereich: Jede positive Ganzzahl (Sekunden)

  • Überschreibung pro Aufruf: Geben Sie timeout_seconds für ein Tool für einmalige Erweiterungen an

  • Empfohlen: 120-300 Sekunden für die Analyse großer Dateien

  • Ungültige Werte: Rückfall auf 60 Sekunden mit Warnung

🛠️ Verfügbare Tools

consult_gemini

Direkte CLI-Brücke für einfache Abfragen.

Parameter:

  • query (string): Die Frage oder der Prompt, der an Gemini gesendet werden soll

  • directory (string): Arbeitsverzeichnis für die Abfrage

  • model (string, optional): Zu verwendendes Modell - "flash", "pro", "flash-lite", "2.5-lite", "3-pro", "3-flash", "3.1-pro", "3.1-flash-lite" oder "auto" (Standard: "flash")

  • timeout_seconds (int, optional): Überschreiben des Ausführungs-Timeouts für diese Anfrage

Beispiel:

consult_gemini(
    query="Find authentication patterns in this codebase",
    directory="/path/to/project",
    model="flash"
)

consult_gemini_with_files

CLI-Brücke mit Dateianhängen für detaillierte Analysen.

Parameter:

  • query (string): Die Frage oder der Prompt, der an Gemini gesendet werden soll

  • directory (string): Arbeitsverzeichnis für die Abfrage

  • files (list): Liste der Dateipfade relativ zum Verzeichnis

  • model (string, optional): Zu verwendendes Modell - "flash", "pro", "flash-lite", "2.5-lite", "3-pro", "3-flash", "3.1-pro", "3.1-flash-lite" oder "auto" (Standard: "flash")

  • timeout_seconds (int, optional): Überschreiben des Ausführungs-Timeouts für diese Anfrage

  • mode (string, optional): Entweder "inline" (Standard), um Dateiinhalte zu streamen, oder "at_command", damit das Gemini CLI @path-Referenzen selbst auflöst

Beispiel:

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
)

Tipp: Beim Scannen großer Bäume wechseln Sie zu mode="at_command", damit das Gemini CLI das File-Globbing und die Kürzung nativ übernimmt.

Stellen Sie Gemini Fragen mit Websuchkontext. Verwendet die automatische Websuche des Gemini CLI, wenn das Modell feststellt, dass dies erforderlich ist. Best-Effort-Funktionalität - nicht für jede Abfrage garantiert.

Parameter:

  • query (string): Suchanfrage oder Frage, die im Web nachgeschlagen werden soll

  • directory (string): Arbeitsverzeichnis für die Befehlsausführung

  • model (string, optional): Zu verwendendes Modell - "flash", "pro", "flash-lite", "2.5-lite", "3-pro", "3-flash", "3.1-pro", "3.1-flash-lite" oder "auto" (Standard: "flash")

  • timeout_seconds (int, optional): Überschreiben des Ausführungs-Timeouts für diese Anfrage

Beispiel:

web_search(
    query="latest Python version and new features",
    model="flash"
)

📋 Anwendungsbeispiele

Grundlegende Codeanalyse

# Simple research query
consult_gemini(
    query="What authentication patterns are used in this project?",
    directory="/Users/dev/my-project"
)

Detaillierte Dateiüberprüfung

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

Analyse mehrerer Dateien

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

Websuche

# Get current information from the web
web_search(
    query="latest Python version and new features in 3.13",
    model="flash"
)

Sicherheitsvorkehrungen für große Dateien

  • Inline-Übertragungen sind auf ca. 256 KB pro Datei und 512 KB pro Anfrage begrenzt, um Hänger zu vermeiden.

  • Übergroße Dateien werden auf Kopf-/Fußzeilen-Snippets gekürzt, mit einer Warnung in der MCP-Antwort.

  • Passen Sie die Obergrenzen mit Umgebungsvariablen an (GEMINI_BRIDGE_MAX_INLINE_TOTAL_BYTES usw.) oder bevorzugen Sie mode="at_command" für größere Payloads.

🏗️ Architektur

Kerndesign

  • CLI-First: Direkte Subprozessaufrufe an den gemini-Befehl

  • Zustandslos: Jeder Tool-Aufruf ist unabhängig ohne Sitzungszustand

  • Adaptives Timeout: Standardmäßig 60 Sekunden, aber pro Anfrage oder über Umgebungsvariable überschreibbar

  • Anhang-Schutzmechanismen: Der Inline-Modus erzwingt leichtgewichtige Limits; der @-Modus delegiert an die Gemini CLI-Tools

  • Einfache Fehlerbehandlung: Klare Fehlermeldungen mit Fail-Fast-Ansatz

Projektstruktur

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

🔧 Entwicklung

Lokales Testen

# Install in development mode
pip install -e .

# Run directly
python -m src

# Test CLI availability
gemini --version

Integration mit Claude Code

Der Server integriert sich automatisch in Claude Code, wenn er ordnungsgemäß über das MCP-Protokoll konfiguriert ist.

🔍 Fehlerbehebung

CLI nicht verfügbar

# Install Gemini CLI
npm install -g @google/gemini-cli

# Authenticate
gemini auth login

# Test
gemini --version

Verbindungsprobleme

  • Überprüfen Sie, ob das Gemini CLI ordnungsgemäß authentifiziert ist

  • Überprüfen Sie die Netzwerkkonnektivität

  • Stellen Sie sicher, dass die Claude Code MCP-Konfiguration korrekt ist

  • Überprüfen Sie, ob sich der gemini-Befehl in Ihrem PATH befindet

Häufige Fehlermeldungen

  • "CLI not available": Gemini CLI ist nicht installiert oder nicht im PATH

  • "Authentication required": Führen Sie gemini auth login aus

  • "Timeout after 60 seconds": Die Abfrage hat zu lange gedauert, versuchen Sie, sie in kleinere Teile zu zerlegen

🤝 Mitwirken

Wir freuen uns über Beiträge aus der Community! Bitte lesen Sie unsere Contributing Guidelines für Details zum Einstieg.

Kurzanleitung für Beiträge

  1. Forken Sie das Repository

  2. Erstellen Sie einen Feature-Branch

  3. Nehmen Sie Ihre Änderungen vor

  4. Fügen Sie ggf. Tests hinzu

  5. Senden Sie einen Pull Request

📄 Lizenz

Dieses Projekt ist unter der MIT-Lizenz lizenziert - siehe die LICENSE-Datei für Details.

🔄 Versionsverlauf

Siehe CHANGELOG.md für einen detaillierten Versionsverlauf.

🆘 Support

  • Issues: Melden Sie Fehler oder fordern Sie Funktionen über GitHub Issues an

  • Diskussionen: Treten Sie der Community-Diskussion bei

  • Dokumentation: Zusätzliche Dokumente können im docs/-Verzeichnis erstellt werden


Fokus: Eine einfache, zuverlässige Brücke zwischen Claude Code und Gemini-KI über das offizielle CLI.

Available Tools

3 tools
consult_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.
ParametersJSON Schema
NameRequiredDescriptionDefault
modelNo
queryYes
directoryYes
timeout_secondsNo

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

A4.1/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description discloses that the query is 'forwarded verbatim to the CLI', explains optional parameters (model, timeout), and describes the return value as 'Gemini's response text or an explanatory error string'. This provides sufficient behavioral context for a query tool.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is well-structured with Args/Returns sections and no extraneous content. It is concise but includes necessary parameter details. Minor tightening could improve it, but overall effective.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's moderate complexity (4 params, 2 required) and presence of an output schema (implied by return description), the description covers the key behavioral aspects. It explains inputs, optional overrides, and return value, making it complete enough for effective use.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has 0% description coverage, so the description carries the burden. It explains all four parameters: query (prompt text), directory (working directory), model (optional alias or ID), timeout_seconds (per-call override). This adds meaning beyond the schema's raw type definitions.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states 'Send a query directly to the Gemini CLI', specifying the verb (send) and resource (Gemini CLI). The name 'consult_gemini' and sibling tools 'consult_gemini_with_files' and 'web_search' help distinguish its purpose as a direct query without file context.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description does not explicitly mention when to use this tool vs. 'consult_gemini_with_files' or 'web_search'. It only implies usage for direct queries without files, lacking alternative guidance.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

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.
ParametersJSON Schema
NameRequiredDescriptionDefault
modeNoinline
filesNo
modelNo
queryYes
directoryYes
timeout_secondsNo

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

A4/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description carries the full burden and does well: it discloses that files outside the working directory are silently skipped, that errors are returned as explanatory strings with warnings, and that per-call timeouts are possible. It stops short of stating auth/network prerequisites or what triggers truncation limits.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Front-loaded one-line summary followed by structured Args/Returns sections; each parameter line earns its place. The Returns block partially duplicates the output schema but is short enough not to be wasteful.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a 6-parameter external-CLI tool, all parameters and the path-safety rule are covered, and an output schema exists so return values need little prose. The main gap is the absent routing guidance versus consult_gemini and no discussion of limits when many/large files are passed.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0% and the schema even lacks enum metadata, so the description must compensate fully — and it does, defining mode values ('inline' streams truncated snippets vs 'at_command' emits @path directives), model aliases (flash/pro), the path-resolution constraint on files, and the purpose of directory and timeout overrides.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

States a specific verb and resource ('Send a query to the Gemini CLI with file context'), which clearly separates it from the sibling consult_gemini that lacks file context. It is clear, but it never explicitly contrasts itself with that sibling or names when file context is needed.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No explicit when-to-use/when-not guidance or named alternative is given; the agent must infer from the tool name that files-bearing queries belong here rather than in consult_gemini. The mode explanation implies usage patterns but does not state selection criteria.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

  1. 1 tool updatev1.3.0
    • Addedweb_search
  2. 2 tool updatesv1.0.0
    • Changedconsult_gemini1 field changed
      • addedInput schema / properties / timeout_seconds
        Added value: +{
        +  "anyOf": [
        +    {
        +      "type": "integer"
        +    },
        +    {
        +      "type": "null"
        +    }
        +  ],
        +  "default": null,
        +  "title": "Timeout Seconds"
        +}
    • Changedconsult_gemini_with_files2 fields changed
      • addedInput schema / properties / mode
        Added value: +{
        +  "default": "inline",
        +  "title": "Mode",
        +  "type": "string"
        +}
      • addedInput schema / properties / timeout_seconds
        Added value: +{
        +  "anyOf": [
        +    {
        +      "type": "integer"
        +    },
        +    {
        +      "type": "null"
        +    }
        +  ],
        +  "default": null,
        +  "title": "Timeout Seconds"
        +}
  3. 2 tool updates
    • First observedconsult_gemini
    • First observedconsult_gemini_with_files

TDQS

A4.1/5.0

Scored across 3 tools

Disambiguation4/5

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.

Naming Consistency4/5

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.

Tool Count4/5

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.

Completeness4/5

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

ActivityMaintained
ResponsivenessUnresponsive

Related MCP Connectors

Related MCP Servers