Home / MCP / Gemini MCP Server

Gemini MCP Server

Provides access to Gemini’s analysis and sandbox capabilities via MCP for large files and codebases.

javascript
Installation
Add the following to your MCP client configuration file.

Configuration

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

You can extend your Claude-based workflow with Gemini’s MCP server to access Gemini’s powerful analysis and sandbox capabilities directly from your MCP client. This enables you to analyze large files, reason about codebases, and run safe sandboxed tests without leaving your conversational environment.

How to use

Set up the Gemini MCP server as a local stdio service so your MCP client can invoke it like any other command. Use it to ask Gemini to analyze code, summarize large directories, or perform web-like searches across your project using the natural language prompts with the @ syntax for files.

What you can do with the Gemini MCP server: analyze files or directories, ask for explanations of code, run sandboxed tests, and request general knowledge answers. Use the provided slash commands or the local command path to interact with Gemini through your MCP client.

Start by adding Gemini as an MCP server integration so your client can call it directly. The recommended setup runs Gemini through NPX, which keeps things lightweight and avoids global installations.

How to install

Prerequisites: you need Node.js 16 or higher and an environment that can run npm/npx.

One-line setup to register the MCP server with your client:

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

Verify the MCP is active inside Claude Code by invoking the MCP command at the prompt:

/mcp

If you prefer importing from Claude Desktop, configure the CLI integration and then import it into Claude Code.

Configuration

Register the MCP server in your client so Gemini is available for analysis and sandboxing.

For NPX usage (recommended) add this to your Claude Desktop config:

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

If you installed Gemini MCP tool globally, use this configuration instead:

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

Configuration file locations for Claude Desktop are shown here for convenience and may vary by platform. After updating the configuration, restart your terminal session to apply changes.

Examples

Natural language prompts you can use with Gemini through the MCP server include: “explain index.html with Gemini”, “summarize the project using Gemini”, and “search Gemini for latest trends in the codebase.”

Using the Gemini CLI within Claude Code, type the Gemini command prompt to fetch results and insights directly inside your workflow.

Notes and troubleshooting

If you encounter issues with command resolution, verify that your MCP server configuration uses the full NPX invocation and includes the correct arguments. Ensure your environment has access to npm/npx and that the Gemini MCP tool is available in your project.

Security and usage tips

When using sandbox mode, Gemini runs code execution in isolation. Use it to safely test changes or scripts without affecting your main environment.

Available tools

ask-gemini

Asks Gemini for its perspective on a prompt. Use the @ syntax to reference files or ask general questions.

sandbox

Safely tests code or scripts in Gemini's sandbox environment.

sandbox-test

Safely executes code or commands in Gemini's sandbox mode for isolated testing.

Ping

Echoes back a message to verify the MCP connection.

Help

Displays the Gemini CLI help text for available commands.

/analyze

Analyzes files or directories or answers general questions using Gemini.