Logo van Gemini CLI

Gemini CLI

Organisatie
DiversioTeam

Integrates with the unofficial Google Gemini CLI, allowing file access within configured directories.

UitgeverDiversioTeam
Repositorygemini-cli-mcp
TaalPython
Forks
5
Sterren
12
Beschikbare tools
0
Transporttypestdio
Categorieën
LicentieMIT
Links
  • Koppel tools aan AI-workflows

    Gemini CLI biedt MCP-functionaliteit die compatibele AI-clients en agenten kunnen gebruiken.

  • 0 beschikbare tools

    Bekijk hieronder de aanroepbare acties, inclusief namen en beschrijvingen als de server die beschikbaar stelt.

  • Configuratie om direct te kopiëren

    Gebruik de installatievoorbeelden om deze server in je favoriete MCP-client te configureren.

  • Indicatoren van opensource-interesse

    12 sterren en 5 forks in de gekoppelde repository.

Gemini CLI MCP Server

CI codecov Python 3.10-3.13 License: MIT Ruff

A Model Context Protocol (MCP) server that wraps the Gemini CLI, allowing AI assistants like Claude to use Gemini for research and analysis tasks.

Disclaimer: This is an unofficial, community-developed tool that wraps the Google Gemini CLI. It is not affiliated with, endorsed by, or sponsored by Google. All Google and Gemini trademarks, service marks, and logos are the property of Google LLC. This project is licensed under the MIT License.

Important: This tool requires that you have the Gemini CLI installed and authenticated on your system. See the Prerequisites section for details.

Features

  • gemini_prompt: Send prompts to Gemini and get responses
  • gemini_research: Research topics with optional file context
  • gemini_analyze_code: Analyze code files for reviews, explanations, optimizations, security, or testing
  • gemini_summarize: Summarize content from text or files

Installation

Quick Start (Recommended)

bash
# Install from GitHub (latest)
uvx --from git+https://github.com/DiversioTeam/gemini-cli-mcp gemini-mcp

# Or from PyPI (when published)
uvx gemini-mcp

Development Installation

bash
git clone https://github.com/DiversioTeam/gemini-cli-mcp
cd gemini-cli-mcp
uv sync
uv run gemini-mcp

Prerequisites

1. Python 3.10-3.13

Ensure you have Python 3.10, 3.11, 3.12, or 3.13 installed. The project is tested on all these versions.

2. Gemini CLI Installation and Authentication

This MCP server requires the Gemini CLI to be installed and authenticated:

  1. Install Gemini CLI: Follow the official installation instructions for your platform
  2. Authenticate: Run gemini auth login and follow the prompts
  3. Verify: Test that it works by running gemini -p "Hello, world!"

If you see an authentication error, make sure you've completed the login process.

3. MCP-compatible Client

You'll need an MCP-compatible client such as:

  • Claude Desktop
  • Other MCP-compatible AI assistants

Usage

First Time Setup

Before running the server, verify your setup:

bash
# Check if everything is configured correctly
gemini-mcp setup

This will check:

  • Gemini CLI installation
  • Authentication status
  • Environment configuration

If you see authentication errors, run:

bash
gemini auth login

Running the Server

bash
# Method 1: Run from current directory (for development)
uv run gemini-mcp

# Method 2: Run using uvx from GitHub
uvx --from git+https://github.com/DiversioTeam/gemini-cli-mcp gemini-mcp

# Method 3: Run if installed globally
gemini-mcp

# With debug logging
LOG_LEVEL=DEBUG gemini-mcp

Configuring with Claude Code (CLI)

Method 1: Using the CLI (Recommended)

bash
# Install from GitHub (use -- separator for proper argument parsing)
claude mcp add gemini uvx -- --from git+https://github.com/DiversioTeam/gemini-cli-mcp.git gemini-mcp

# Or install from PyPI when published
claude mcp add gemini uvx -- gemini-mcp

Method 2: Manual Configuration

Add this to ~/.config/claude-code/mcp-settings.json:

json
{
  "servers": {
    "gemini": {
      "command": "uvx",
      "args": ["--from", "git+https://github.com/DiversioTeam/gemini-cli-mcp.git", "gemini-mcp"]
    }
  }
}

Configuring with Claude Desktop

Add this to your Claude Desktop configuration:

macOS: ~/Library/Application Support/Claude/claude_desktop_config.json Windows: %APPDATA%\Claude\claude_desktop_config.json Linux: ~/.config/claude/claude_desktop_config.json

json
{
  "mcpServers": {
    "gemini": {
      "command": "uvx",
      "args": ["--from", "git+https://github.com/DiversioTeam/gemini-cli-mcp.git", "gemini-mcp"],
      "env": {
        "LOG_LEVEL": "INFO"
      }
    }
  }
}

Available Tools

gemini_prompt

Send a simple prompt to Gemini.

Parameters:

  • prompt (required): The prompt to send
  • model (optional): The Gemini model to use (default: gemini-2.5-pro)
  • context (optional): Additional context to prepend to the prompt

gemini_research

Research a topic with optional file context.

Parameters:

  • topic (required): The research topic or question
  • files (optional): List of file paths to include as context
  • model (optional): The Gemini model to use

gemini_analyze_code

Analyze code files for various purposes.

Parameters:

  • files (required): List of code files to analyze
  • analysis_type (required): Type of analysis - one of:
    • review: Code review for issues and improvements
    • explain: Detailed explanation of the code
    • optimize: Performance and maintainability suggestions
    • security: Security vulnerability analysis
    • test: Test case suggestions
  • specific_question (optional): Additional specific question
  • model (optional): The Gemini model to use

gemini_summarize

Summarize content from text or files.

Parameters:

  • content (optional): Text content to summarize
  • files (optional): Files to summarize (alternative to content)
  • summary_type (optional): Type of summary - one of:
    • brief: 2-3 sentence summary (default)
    • detailed: Comprehensive summary
    • bullet_points: Bullet point format
    • executive: Executive summary for decision makers
  • model (optional): The Gemini model to use

Note: Either content or files must be provided.

Security

This MCP server implements several security measures:

File Access Control

  • Sandboxed file access: By default, file access is restricted to the current working directory
  • Path validation: All file paths are validated to prevent directory traversal attacks
  • Configurable allowed directories: You can specify allowed directories via:
    • Constructor parameter: GeminiMCPServer(allowed_directories=["/path/to/safe/dir"])
    • Environment variable: GEMINI_MCP_ALLOWED_DIRS=/path1:/path2:/path3

Input Sanitization

  • All user inputs are properly sanitized before being passed to the CLI
  • Command injection is prevented by using subprocess with argument lists (never shell=True)
  • File paths are resolved and validated before use

Best Practices

  • Always run the server with minimal required permissions
  • Regularly update both the MCP server and Gemini CLI
  • Monitor logs for any suspicious activity

Development

Setting up the Development Environment

  1. Clone the repository:

    bash
    git clone https://github.com/DiversioTeam/gemini-cli-mcp.git
    cd gemini-cli-mcp
  2. Install development dependencies:

    bash
    uv sync --all-extras --dev
  3. Install pre-commit hooks:

    bash
    uv run pre-commit install

Local Testing with Claude Code

You can add the server for local testing with Claude Code CLI:

bash
# Method 1: Add from local directory (for development)
claude mcp add gemini-local -- uv run gemini-mcp

# Method 2: Add from PyPI (when published)
claude mcp add gemini uvx -- gemini-mcp

# Method 3: Add from GitHub (development version)
claude mcp add gemini uvx -- --from git+https://github.com/DiversioTeam/gemini-cli-mcp.git gemini-mcp

# Then you can test the functionality immediately
# Example: Send prompts, research topics, analyze code, etc.

Running Tests

bash
# Run all tests with coverage
uv run pytest

# Run specific test file
uv run pytest tests/test_tools.py

# Run with verbose output
uv run pytest -v

Code Quality

bash
# Run linting
uv run ruff check .

# Run formatting
uv run ruff format .

# Run type checking
uv run mypy src/

# Run security checks
uv run ruff check --select S .

Troubleshooting

Quick Diagnostics

Run the setup check to diagnose common issues:

bash
gemini-mcp setup

Common Issues

  1. "Gemini CLI not found in PATH"

    • Ensure Gemini CLI is installed: which gemini
    • Add Gemini to your PATH if needed
    • Follow the installation guide for your platform
  2. Authentication errors

    • The server will detect if you're not authenticated
    • Run gemini auth login to authenticate
    • Check if your credentials have expired
    • The error message will guide you on what to do
  3. File access errors

    • Check that files are within allowed directories
    • Use absolute paths or ensure relative paths are correct
    • Set GEMINI_MCP_ALLOWED_DIRS for custom directories
  4. "Command not found" errors

    • Run gemini-mcp setup to check your installation
    • Ensure you've installed the package: uv pip install -e .

Debug Logging

Enable debug logging to see detailed information:

bash
LOG_LEVEL=DEBUG gemini-mcp

Contributing

We welcome contributions! Please:

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Make your changes and add tests
  4. Ensure all tests pass and code quality checks succeed
  5. Commit your changes (git commit -m 'Add amazing feature')
  6. Push to the branch (git push origin feature/amazing-feature)
  7. Open a Pull Request

License

This project is licensed under the MIT License - see the LICENSE file for details.

Acknowledgments

  • Built on top of the Model Context Protocol
  • Integrates with Google's Gemini CLI (unofficial integration)
  • Inspired by the MCP ecosystem and community

Gebruik Gemini CLI MCP met meerdere AI-modellen

TypingMind koppelt MCP-tools aan de werkruimte. Zodra Gemini CLI is verbonden, kun je deze dus met verschillende AI-modellen in TypingMind gebruiken, zonder de verbinding voor elk model apart in te stellen. Deze MCP-integratie draait lokaal via de TypingMind MCP-connector op je apparaat.

Installatiehandleiding voor de lokale connector

Gebruik dit als de MCP-server toegang nodig heeft tot lokale bestanden, apps of privébronnen op je computer.

1

Open de MCP-instellingen

Ga in TypingMind naar Instellingen, Geavanceerde instellingen en vervolgens Model Context Protocol. Kies daar Connector instellen.

  1. Open TypingMind in je browser.
  2. Klik op het pictogram Instellingen.
  3. Ga naar Geavanceerde instellingen.
  4. Open het gedeelte Model Context Protocol.
  5. Klik op Connector instellen en kies Dit apparaat.
Instelscherm voor de TypingMind MCP-connector met Dit apparaat geselecteerd
2

Voer de connectoropdracht uit

Kies Dit apparaat, kopieer de opdracht uit TypingMind en voer deze uit in Terminal. Laat het proces draaien zolang je MCP gebruikt.

  1. Kopieer de installatieopdracht die TypingMind toont.
  2. Open Terminal op macOS of Windows Terminal op Windows.
  3. Plak de opdracht en voer deze uit.
  4. Keur de pakketinstallatie goed als Terminal vraagt of je wilt doorgaan.
  5. Laat het proces in het Terminal-venster draaien zolang je MCP-tools gebruikt.
3

Voeg Gemini CLI toe als server

Klik op Servers bewerken zodra de connectorstatus Gereed is en plak de MCP-serverconfiguratie.

  1. Wacht tot de connectorstatus Gereed aangeeft.
  2. Klik op Servers bewerken.
  3. Plak de MCP-serverconfiguratie van Gemini CLI.
  4. Sla de serverlijst op.
  5. Vernieuw om te controleren of de connector nog steeds klaar is voor gebruik.
MCP-instellingen van TypingMind met een actieve server en de knop Servers bewerken
{
  "mcpServers": {
    "gemini-cli-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "<mcp-server-package>"
      ]
    }
  }
}
4

Gebruik de verbinding met verschillende modellen

Sla de serverlijst op, open Plug-ins en schakel de MCP-tools van Gemini CLI in. Selecteer vervolgens een ondersteund AI-model in TypingMind en gebruik de tools in de chat of wijs ze toe aan een AI-agent.

  1. Open de pagina Plug-ins in TypingMind.
  2. Schakel de MCP-tools van Gemini CLI in.
  3. Start een chat en kies het AI-model dat je wilt gebruiken.
  4. Gebruik de MCP-tools in een chat of wijs ze toe aan een AI-agent.
  5. Schakel wanneer nodig over naar een ander AI-model zonder opnieuw verbinding te maken met MCP.
TypingMind-chat met ingeschakelde MCP-tools en een geselecteerd AI-model
Kun je Gemini CLI gebruiken om me hiermee te helpen?
Gemini CLI
Zeker. Ik heb het gelezen.
Dit vond ik met Gemini CLI.

Veelgestelde vragen

Waarvoor wordt de MCP-server Gemini CLI gebruikt?

Gemini CLI is een MCP-server waarmee compatibele AI-clients verbinding kunnen maken met externe tools en context. In TypingMind hoef je deze MCP-server maar één keer toe te voegen om de tools beschikbaar te maken in je AI-werkruimte.

Kan ik Gemini CLI MCP met meerdere AI-modellen in TypingMind gebruiken?

Ja. TypingMind verbindt MCP-tools op werkruimteniveau. Daardoor kun je Gemini CLI gebruiken met verschillende AI-modellen, zoals Claude, ChatGPT, Gemini of andere modellen die je in TypingMind hebt ingesteld, zonder de MCP-server voor elk model afzonderlijk in te stellen.

Waarom Gemini CLI MCP gebruiken met TypingMind?

TypingMind is een van de beste interfaces voor chats met LLM's, omdat het meerdere AI-modellen, prompts, plug-ins, AI-agenten, API-sleutels en MCP-tools samenbrengt in één werkruimte. Als Gemini CLI verbonden is, kun je de MCP-tools ervan gebruiken met je favoriete modellen en je chatworkflow overzichtelijk houden in TypingMind.

Hoe verbind ik Gemini CLI MCP met TypingMind?

Gemini CLI werkt via de lokale MCP-connector van TypingMind. Dit is de beste optie als de MCP-server toegang nodig heeft tot lokale bestanden, desktopapps, opdrachtregeltools of privébronnen op je computer.

Welke tools biedt Gemini CLI MCP in TypingMind?

Gemini CLI biedt MCP-functies die je kunt inschakelen via de pagina Plug-ins in TypingMind. Je kunt ze gebruiken in chats of toewijzen aan AI-agenten.

Moet ik mijn API-sleutels delen met TypingMind om Gemini CLI MCP te gebruiken?

Nee. TypingMind werkt in de eerste plaats lokaal en laat je de controle houden over je modelaanbieders, API-sleutels, prompts en MCP-configuratie. Als Gemini CLI authenticatie vereist, voeg je bij het maken van de verbinding de vereiste headers, OAuth-instellingen of lokale configuratie voor die MCP-server toe.

Gerelateerde MCP-servers

Toon alles

Maak nu je eigen AI-werkruimte

Schrijf je in voor onze nieuwsbrief en blijf op de hoogte van nieuwe functies en toekomstige weggeefacties 👇