Skip to main content
Glama
spotmaxtech

gemini-search

by spotmaxtech

gemini-search-mcp

An MCP server that lets AI assistants search the web with Google Search via Gemini grounding. It returns a summarized answer with inline citations ([1], [2,3]) and a list of source URLs.

Inspired by yukukotani/mcp-gemini-google-search, rewritten with these fixes:

  • Citation markers are placed using UTF-8 byte offsets (as Gemini reports them), so they land correctly in Chinese / Japanese / emoji text.

  • Missing credentials are reported as a tool error instead of crashing the server at startup.

  • Requests have a timeout and honor MCP cancellation.

  • Errors are returned as isError tool results so the model can see and react to them.

Tool

Param

Type

Description

query

string (required)

The search query or question.

Related MCP server: Deno Gemini Grounding MCP Server

Usage

Requires Node.js >= 20.

Installed directly from GitHub (built automatically on install via prepare):

{
  "mcpServers": {
    "gemini-search": {
      "command": "npx",
      "args": ["-y", "github:spotmaxtech/gemini-search-mcp"],
      "env": {
        "GEMINI_API_KEY": "your-api-key"
      }
    }
  }
}

Pin a version with a tag or commit, e.g. github:spotmaxtech/gemini-search-mcp#v0.1.0.

Claude Code:

claude mcp add gemini-search -e GEMINI_API_KEY=your-api-key -- npx -y github:spotmaxtech/gemini-search-mcp

Configuration

Variable

Default

Description

GEMINI_API_KEY

-

Google AI Studio API key. Required unless using Vertex AI.

GEMINI_PROVIDER

-

Set to vertex to use Vertex AI.

VERTEX_PROJECT_ID

-

GCP project ID. Required when GEMINI_PROVIDER=vertex.

VERTEX_LOCATION

us-central1

Vertex AI location.

GEMINI_MODEL

gemini-2.5-flash

Gemini model to use.

GEMINI_TIMEOUT_MS

60000

Request timeout in milliseconds.

RESOLVE_SOURCE_URLS

true

Replace Google grounding redirect links with the real page URLs (reads only the redirect header, 3s timeout per link). Set to false to skip.

Vertex AI uses Application Default Credentials (e.g. gcloud auth application-default login).

Development

npm install        # also builds via prepare
npm test           # unit tests
npm run typecheck
npm run build
GEMINI_API_KEY=... npm run inspect   # open MCP Inspector

The Inspector does not pass your shell environment to the server process; npm run inspect forwards the variables above explicitly via -e.

License

MIT

Related MCP Connectors

Related MCP Servers

  • A
    license
    B
    quality
    C
    maintenance
    Provides Google Search functionality for AI models using Gemini's built-in Grounding with Google Search feature, returning real-time web search results with source citations.
    1
    91 npm
    83
    Apache 2.0
  • A
    license
    Not graded
    quality
    D
    maintenance
    Provides Google search grounding capabilities for Gemini AI models through MCP, enabling AI assistants to perform web searches with Gemini's grounding API for more accurate and up-to-date responses.
    MIT
  • A
    license
    Not graded
    quality
    D
    maintenance
    Enables web search using Google Gemini with search grounding and question-answering on local documents, with support for chunked document reading.
    50 npm
    33 PyPI
    1
    MIT
  • A
    license
    Not graded
    quality
    C
    maintenance
    Enables AI tools to perform real-time Google Search with grounded answers and inline citations, free with a Google account.
    4
    MIT