Labsco
cnosuke logo

MCP Gemini Grounded Search

โ˜… 8

from cnosuke

A Go-based MCP server providing grounded search functionality using Google's Gemini API.

๐Ÿ”ฅ๐Ÿ”ฅ๐Ÿ”ฅโœ“ VerifiedAccount requiredNeeds API keys

MCP Gemini Grounded Search

MCP Gemini Grounded Search is a Go-based MCP server that provides grounded search functionality using Google's Gemini API. MCP clients such as Claude Desktop and Claude Code can perform real-time web searches and retrieve up-to-date information with source attribution.

Features

  • MCP Compliance: JSON-RPC based interface for tool execution per the MCP specification
  • Grounded Search: Gemini API generates answers with source attributions
  • Two Transport Modes: stdio (for Claude Desktop / Claude Code) and Streamable HTTP
  • Flexible Configuration: config file, environment variables, or command-line flags
docker pull cnosuke/mcp-gemini-grounded-search:latest

docker run -i --rm -e GEMINI_API_KEY="your-api-key" cnosuke/mcp-gemini-grounded-search:latest server

Using with Claude Desktop (Docker)

Add an entry to your claude_desktop_config.json:

{
  "mcpServers": {
    "gemini-search": {
      "command": "docker",
      "args": ["run", "-i", "--rm", "-e", "GEMINI_API_KEY=your-api-key", "cnosuke/mcp-gemini-grounded-search:latest", "server"]
    }
  }
}

Using with Claude Code (Docker)

claude mcp add-json mcp-gemini-grounded-search '{
  "command": "docker",
  "args": [
    "run", "-i", "--rm",
    "-e", "GEMINI_API_KEY",
    "-e", "GEMINI_MODEL_NAME",
    "-e", "GEMINI_THINKING_LEVEL",
    "cnosuke/mcp-gemini-grounded-search:latest",
    "server"
  ],
  "env": {
    "GEMINI_MODEL_NAME": "gemini-3.1-pro-preview",
    "GEMINI_THINKING_LEVEL": "LOW",
    "GEMINI_API_KEY": "<your-gemini-api-key>"
  }
}'

Streamable HTTP Mode

The httpserver subcommand starts an HTTP server compatible with the MCP Streamable HTTP transport.

HTTP_AUTH_TOKEN=secret GEMINI_API_KEY=your-key \
  ./bin/mcp-gemini-grounded-search httpserver --config config.yml

# Health check (no auth required)
curl http://localhost:8080/health

# MCP endpoint (auth required)
curl -H "Authorization: Bearer secret" http://localhost:8080/mcp

HTTP-specific settings can be configured entirely via environment variables โ€” no need to put secrets in config.yml.

Command-Line Options

server subcommand (stdio)

./bin/mcp-gemini-grounded-search server [options]
FlagShortDescription
--config-cPath to config file (default: config.yml)
--log-lLog file path
--debug-dEnable debug logging
--api-key-kGemini API key
--model-mGemini model name
--thinking-levelMINIMAL / LOW / MEDIUM / HIGH

httpserver subcommand (Streamable HTTP)

./bin/mcp-gemini-grounded-search httpserver [options]
FlagShortDescription
--config-cPath to config file (default: config.yml)

All HTTP settings (port, auth_token, etc.) are configured via environment variables or config.yml.

MCP Tools

Performs a web search using the Gemini API and returns a grounded answer with sources.

Parameters:

ParameterTypeRequiredDescription
questionstringYesNatural language question to search
max_tokennumberNoMax tokens for the response
thinking_levelstringNoOverride thinking level for this call

Response:

{
  "text": "Generated answer text",
  "groundings": [
    {
      "title": "Source title",
      "domain": "example.com",
      "url": "https://example.com/article"
    }
  ]
}

Logging

  • Set log in config.yml or LOG_PATH env var to write logs to a file
  • If log is empty, no log file is produced
  • Set debug: true or DEBUG=true for verbose logging