MCP Gemini Grounded Search is a Go-based MCP server implementation that provides grounded search functionality using Google's Gemini API, allowing MCP clients (e.g., Claude Desktop) to perform web searches and retrieve up-to-date information with sources.
- MCP Compliance: Provides a JSON‐RPC based interface for tool execution according to the MCP specification.
- Grounded Search: Uses Gemini API to generate search results with source information (attributions).
- Customizable: Configure through config file, environment variables, or command line options.
- Docker (recommended)
For local development:
- Go 1.24 or later
- Gemini API key
docker pull cnosuke/mcp-gemini-grounded-search:latest
docker run -i --rm -e GEMINI_API_KEY="your-api-key" cnosuke/mcp-gemini-grounded-search:latestTo integrate with Claude Desktop using Docker, add an entry to your claude_desktop_config.json file:
{
"mcpServers": {
"gemini-search": {
"command": "docker",
"args": ["run", "-i", "--rm", "-e", "GEMINI_API_KEY=your-api-key", "cnosuke/mcp-gemini-grounded-search:latest"]
}
}
}Alternatively, you can build and run the Go binary directly:
# Build the server
make bin/mcp-gemini-grounded-search
# Run the server
./bin/mcp-gemini-grounded-search server --api-key="your-api-key"To integrate with Claude Desktop using the Go binary, add an entry to your claude_desktop_config.json file:
{
"mcpServers": {
"gemini-search": {
"command": "./bin/mcp-gemini-grounded-search",
"args": ["server"],
"env": {
"LOG_PATH": "mcp-gemini-grounded-search.log",
"DEBUG": "false",
"GEMINI_API_KEY": "your-api-key",
"GEMINI_MODEL_NAME": "gemini-2.5-flash-preview-04-17"
}
}
}
}The server is configured via a YAML file (default: config.yml). For example:
log: 'path/to/mcp-gemini-grounded-search.log' # Log file path, if empty no log will be produced
debug: false # Enable debug mode for verbose logging
gemini:
api_key: "your-api-key" # Gemini API key
model_name: "gemini-2.5-flash-preview-04-17" # Gemini model to useYou can override configurations using environment variables:
LOG_PATH: Path to log fileDEBUG: Enable debug mode (true/false)GEMINI_API_KEY: Gemini API keyGEMINI_MODEL_NAME: Gemini model name
Logging behavior is controlled through configuration:
- If
logis set in the config file, logs will be written to the specified file - If
logis empty, no logs will be produced - Set
debug: truefor more verbose logging
MCP clients interact with the server by sending JSON‐RPC requests to execute various tools. The following MCP tools are supported:
search: Performs a web search using the Gemini API and returns results with source information.-
Parameters:
query(string, required): The search querymax_token(number, optional): Maximum number of tokens for the generated response
-
Response format:
{ "text": "Generated text content", "groundings": [ { "title": "Source title", "domain": "Source domain", "url": "Source URL" }, ... ] }
-
When starting the server, you can specify various settings:
./bin/mcp-gemini-grounded-search server [options]Options:
--config,-c: Path to the configuration file (default: "config.yml")--log,-l: Path to log file (overrides config file)--debug,-d: Enable debug mode (overrides config file)--api-key,-k: Gemini API key (overrides config file)--model,-m: Gemini model name (overrides config file)
Contributions are welcome! Please fork the repository and submit pull requests for improvements or bug fixes. For major changes, open an issue first to discuss your ideas.
This project is licensed under the MIT License.
Author: cnosuke ( x.com/cnosuke )