Get the FREE Ultimate OpenClaw Setup Guide →

gemini

MCP server from philschmid/gemini-mcp-server

Installation
Run this command in your terminal to add the MCP server to Claude Code.
Run in terminal:
Command
claude mcp add --transport http philschmid-gemini-mcp-server https://remote-mcp-test.com/mcp/ \
  --header "Authorization: Bearer YOUR_KEY"

How to use

The Gemini MCP Server exposes an interface to interact with Google''s Gemini API through the MCP (Model Context Protocol). It provides two transport modes: STDIO and streamable-http. In STDIO mode, you run the server locally and connect via standard input/output streams, using the GEMINI_API_KEY environment variable for authentication. In HTTP mode, you expose the server over network with an Authorization header to secure access. The available tools include web_search, which performs a Gemini-powered web search and returns synthesized results with optional citations, and use_gemini, which delegates tasks to Gemini 2.5 models (Pro or Flash) via a specified prompt and optional model selection. The server can be deployed remotely (e.g., on Google Cloud Run) for easy client access, and clients can interact through the MCP client libraries or simple HTTP requests. For local or remote usage, you can configure either an STDIO client or an HTTP client, and you can inspect interactions using the MCP Inspector if desired.

How to install

Prerequisites:

  • Python 3.8+ and pip
  • Optional: docker if you prefer containerized testing or deployment

Install the server package directly from GitHub:

pip install git+https://github.com/philschmid/gemini-mcp-server.git

If you plan to run via STDIO locally, ensure your environment provides a Gemini API key:

export GEMINI_API_KEY="your_gemini_api_key_here"

Run in STDIO mode:

GEMINI_API_KEY="$GEMINI_API_KEY" gemini-mcp --transport stdio

Run in HTTP (streamable-http) mode:

gemini-mcp --transport streamable-http

If you prefer deploying with Docker, build and run a container using your own workflow (refer to your cloud provider for deployment specifics).

Note: If you are testing locally, you may also specify the API key in the environment or pass it through your client configuration depending on the mode you use.

Additional notes

Tips and common issues:

  • In STDIO mode, ensure GEMINI_API_KEY is set in the environment before starting the server.
  • In HTTP mode, protect your endpoints with the Authorization header; anyone with the URL could access it if unauthenticated.
  • When using the web_search tool, you can toggle include_citations to get either concise results or results with sources and citations.
  • For use_gemini, you can specify the Gemini model with the model parameter; if omitted, a default model (gemini-2.5-flash-preview-05-20) is used.
  • If you encounter connectivity or authentication errors, verify network access, API key permissions, and that the correct transport (stdio vs http) matches your client configuration.
  • The example usage demonstrates both local stdio integration and remote HTTP access; adapt the mcpServers configuration in your client accordingly.

Related MCP Servers

Sponsor this space

Reach thousands of developers