Gemini Grounding MCP server

Integrates with Google's Gemini API grounding feature to provide web search and summarization with synthesized answers and inline citations rather than raw search results.
Back to servers
Setup instructions
Provider
ml0-1337
Release date
Jun 26, 2025
Language
Go
Stats
36 stars

The Gemini AI MCP Server is a tool that provides AI-powered web search and summarization using the Gemini API. Unlike traditional search tools, it synthesizes information to provide comprehensive answers with citations rather than just returning raw results.

Prerequisites

  • Go 1.21 or later
  • Gemini API access (either API key or OAuth credentials)

Installation

Build from Source

git clone https://github.com/ml0-1337/mcp-gemini-grounding.git
cd mcp-gemini-grounding
make build

To see all available commands:

make help

Install Globally

# From source
make install

# Or using go install directly
go install github.com/ml0-1337/mcp-gemini-grounding/cmd/gemini-grounding@latest

Configuration

Authentication Methods

The server supports two authentication methods:

  1. OAuth Credentials (Preferred)

    • Uses credentials from ~/.gemini/oauth_creds.json
    • Created when you authenticate with the Gemini CLI
  2. API Key (Fallback)

    • Set the GEMINI_API_KEY environment variable
    • Get your API key from Google AI Studio

Setting Up with Claude Code

Important: When configuring, always use the full absolute path to the binary.

Local Scope Configuration (Project-specific)

Using CLI:

# If installed globally
claude mcp add gemini-grounding

# Or with full absolute path (required)
claude mcp add gemini-grounding /full/path/to/mcp-gemini-grounding

Manual Configuration:

  1. Open your project in Claude Code
  2. Click on the MCP servers icon in the bottom status bar
  3. Select "Add MCP Server..."
  4. Choose "gemini" and configure:
{
  "mcpServers": {
    "gemini-grounding": {
      "command": "/path/to/mcp-gemini-grounding",
      "env": {
        "GEMINI_API_KEY": "$GEMINI_API_KEY"
      }
    }
  }
}

Project Scope Configuration (Team-shared)

Using CLI:

# If installed globally
claude mcp add gemini-grounding -s project

# Or with full absolute path
claude mcp add gemini-grounding -s project /full/path/to/mcp-gemini

Manual Configuration:

  1. Create a .mcp.json file in your project root:
{
  "mcpServers": {
    "gemini-grounding": {
      "command": "mcp-gemini-grounding",
      "env": {
        "GEMINI_API_KEY": "$GEMINI_API_KEY"
      }
    }
  }
}
  1. Commit this file to version control
  2. Each team member sets their GEMINI_API_KEY environment variable locally

User Scope Configuration (Global)

Using CLI:

# If installed globally
claude mcp add gemini-grounding -s user

# Or with full absolute path
claude mcp add gemini-grounding -s user /full/path/to/mcp-gemini

Manual Configuration:

  1. Open Claude Code settings
  2. Navigate to MCP Servers configuration
  3. Add to your user settings:
{
  "mcpServers": {
    "gemini-grounding": {
      "command": "gemini",
      "env": {
        "GEMINI_API_KEY": "$GEMINI_API_KEY"
      }
    }
  }
}

Setting Environment Variables

After adding the server, set your API key:

# macOS/Linux
export GEMINI_API_KEY="your-api-key-here"

# Windows (PowerShell)
$env:GEMINI_API_KEY="your-api-key-here"

# Windows (Command Prompt)
set GEMINI_API_KEY=your-api-key-here

For permanent configuration, add the export to your shell profile.

Usage

Once configured, the google_search tool will be available in Claude Code. You can prompt Claude to search for information:

  • "Search for the latest news about AI"
  • "Find information about quantum computing"
  • "What are the current trends in web development?"

Output Format

The tool returns search results with:

  • Main content with inline citations (e.g., [1], [2])
  • List of sources with titles and URLs

Example output:

Web search results for "quantum computing":

Quantum computing is a rapidly evolving field[1]. Recent breakthroughs have shown promise for practical applications[2].

Sources:
[1] Quantum Computing Explained - MIT (https://mit.edu/quantum)
[2] Latest Quantum Breakthroughs - Nature (https://nature.com/quantum)

Troubleshooting

Authentication Errors

  1. Check OAuth credentials exist:

    ls ~/.gemini/oauth_creds.json
    
  2. Or ensure API key is set:

    echo $GEMINI_API_KEY
    

Connection Issues

  • Ensure you have internet connectivity
  • Check if Gemini API is accessible in your region
  • Verify your API key or OAuth credentials are valid

No Results

  • Try different search queries
  • Check the Gemini API status
  • Ensure you have not exceeded rate limits

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-grounding" '{"command":"mcp-gemini-grounding","env":{"GEMINI_API_KEY":"$GEMINI_API_KEY"}}'

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-grounding": {
            "command": "mcp-gemini-grounding",
            "env": {
                "GEMINI_API_KEY": "$GEMINI_API_KEY"
            }
        }
    }
}

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-grounding": {
            "command": "mcp-gemini-grounding",
            "env": {
                "GEMINI_API_KEY": "$GEMINI_API_KEY"
            }
        }
    }
}

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