Gemini CLI MCP server

Integrates with Google's Gemini CLI to leverage massive token windows for analyzing large files and codebases, providing general queries, sandbox-mode code execution for safe testing, and structured response handling with behavioral flags for context control.
Back to servers
Setup instructions
Provider
jamubc
Release date
Jun 30, 2025
Language
JavaScript
Stats
887 stars

Gemini MCP Tool is a Model Context Protocol (MCP) server that enables AI assistants to interact with the Gemini CLI. This integration allows you to leverage Gemini's large token window for analyzing extensive files and codebases through Claude, using natural language commands with the @ syntax to reference files.

Prerequisites

Before getting started, make sure you have:

  1. Node.js (v16.0.0 or higher) installed
  2. Google Gemini CLI installed and configured

Installation

Quick Setup

Install the Gemini MCP Tool with a single command:

claude mcp add gemini-cli -- npx -y gemini-mcp-tool

Verify Installation

After installation, type /mcp inside Claude Code to verify the gemini-cli MCP is active.

Alternative: Import from Claude Desktop

If you already have the tool configured in Claude Desktop:

  1. Add this to your Claude Desktop config:
"gemini-cli": {
  "command": "npx",
  "args": ["-y", "gemini-mcp-tool"]
}
  1. Import to Claude Code:
claude mcp add-from-claude-desktop

Configuration

For NPX Usage (Recommended)

Add this configuration to your Claude Desktop config file:

{
  "mcpServers": {
    "gemini-cli": {
      "command": "npx",
      "args": ["-y", "gemini-mcp-tool"]
    }
  }
}

For Global Installation

If you installed the tool globally, use this configuration instead:

{
  "mcpServers": {
    "gemini-cli": {
      "command": "gemini-mcp"
    }
  }
}

Configuration File Locations

Find your Claude Desktop config file at:

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

Remember to restart your terminal session after updating the configuration.

Using Gemini MCP Tool

Basic Workflow

You can interact with Gemini in natural language or use Claude Code's interface:

  • Natural language: Type commands like "use gemini to explain index.html"
  • Claude Code: Type /gemini-cli to see available commands

Examples with File References

Use the @ syntax to reference files or directories:

  • ask gemini to analyze @src/main.js and explain what it does
  • use gemini to summarize @. the current directory
  • analyze @package.json and tell me about dependencies

General Questions

Ask Gemini questions without file references:

  • ask gemini to search for the latest tech news
  • use gemini to explain div centering
  • ask gemini about best practices for React development related to @file_im_confused_about

Using Sandbox Mode

Run code safely in Gemini's isolated environment:

  • use gemini sandbox to create and run a Python script that processes data
  • ask gemini to safely test @script.py and explain what it does
  • use gemini sandbox to install numpy and create a data visualization

Available Tools

For the AI Assistant

  • ask-gemini: Get Gemini's perspective on questions or file analysis

    • prompt (required): Your analysis request with optional @ file references
    • model (optional): Specify Gemini model (default: gemini-2.5-pro)
    • sandbox (optional): Set to true for safe code execution
  • sandbox-test: Execute code safely in Gemini's sandbox

    • prompt (required): Code testing request
    • model (optional): Specify Gemini model
  • Ping: Test tool that echoes back messages

  • Help: Display Gemini CLI help information

Slash Commands for Users

  • /analyze: Analyze files or ask questions using Gemini

    • prompt (required): Analysis request with optional @ file references
  • /sandbox: Test code in Gemini's safe environment

    • prompt (required): Code testing request
  • /help: View Gemini CLI help information

  • /ping: Test server connection

    • message (optional): Message to echo back

How to install this MCP server

For Claude Code

To add this MCP server to Claude Code, run this command in your terminal:

claude mcp add-json "gemini-cli" '{"command":"npx","args":["-y","gemini-mcp-tool"]}'

See the official Claude Code MCP documentation for more details.

For Cursor

There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json file so that it is available in all of your projects.

If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json file.

Adding an MCP server to Cursor globally

To add a global MCP server go to Cursor Settings > Tools & Integrations and click "New MCP Server".

When you click that button the ~/.cursor/mcp.json file will be opened and you can add your server like this:

{
    "mcpServers": {
        "gemini-cli": {
            "command": "npx",
            "args": [
                "-y",
                "gemini-mcp-tool"
            ]
        }
    }
}

Adding an MCP server to a project

To add an MCP server to a project you can create a new .cursor/mcp.json file or add it to the existing one. This will look exactly the same as the global MCP server example above.

How to use the MCP server

Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.

The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.

You can also explicitly ask the agent to use the tool by mentioning the tool name and describing what the function does.

For Claude Desktop

To add this MCP server to Claude Desktop:

1. Find your configuration file:

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

2. Add this to your configuration file:

{
    "mcpServers": {
        "gemini-cli": {
            "command": "npx",
            "args": [
                "-y",
                "gemini-mcp-tool"
            ]
        }
    }
}

3. Restart Claude Desktop for the changes to take effect

Want to 10x your AI skills?

Get a free account and learn to code + market your apps using AI (with or without vibes!).

Nah, maybe later