Enables web search capabilities powered by Google's Gemini API, allowing LLMs to perform intelligent web searches and return synthesized responses with citations.
Note
The MCP server is currently available under https://gemini-mcp-server-231532712093.europe-west1.run.app/mcp/
. It is deployed to Google Cloud Run and can be authenticated using an AI Studio API key. see examples/test_remote.py for an example on how to use the server with the google-genai
client.
Gemini MCP Server
A Model Context Protocol server that provides access to Google's Gemini API. This server enables LLMs to perform intelligent web searches, generate content, and access other Gemini features. It supports both STDIO and streamable-http transport modes and can be run locally or remotely. If you use STDIO mode it will try to use the GEMINI_API_KEY
environment variable. If you use streamable-http mode it will try to use the Bearer token in the Authorization header.
Available Tools:
- web_search - Performs a web search using Gemini and returns synthesized results with citations
query
(string, required): The search query to executeinclude_citations
(boolean, optional): Whether to include citations in the response. Default isFalse
.
- use_gemini - Delegates a task to a specified Gemini 2.5 model (Pro or Flash).
prompt
(string, required): The prompt or task for Gemini.model
(string, optional): The Gemini model to use. Default isgemini-2.5-flash-preview-05-20
.
Installation
Authentication
- STDIO mode: Uses
GEMINI_API_KEY
environment variable - HTTP mode: Requires Bearer token in Authorization header
Running the Server
STDIO Mode (Local/Direct Integration)
HTTP Mode (Network Access)
The server will start on http://0.0.0.0:8000/mcp/
Deployment
You can deploy the Gemini MCP Server as Remote MCP Server to Google Cloud Run to make it available easily available to any client.
To deploy the server, run the following command from your terminal, replacing [PROJECT-ID]
and [REGION]
with your Google Cloud project ID and desired region:
The command will build the Docker image, push it to Google Artifact Registry, and deploy it to Cloud Run. After the deployment is complete, you will get a URL for your service. We will allow unauthenticated access to the service this means that anyone with the URL can send requests to the server, which it self is protected by an Authorization header. If you want to secure the service you can follow the instructions in the Cloud Run documentation.
cleanup
Usage Examples
Add to your mcpServers
configuration:
STDIO Mode:
HTTP Mode:
or check out the example in the examples/test_remote.py file.
With MCP Inspector
Start the server with streamable-http and test your server using the MCP inspector. Alternatively start inspector and run the server with stdio.
Web Search Tool Example
With include_citations
set to False
:
With include_citations
set to True
:
Use Gemini Tool Response Example
Testing
To run the tests, run the following command from the root directory:
Note: You need to set the GEMINI_API_KEY
environment variable to run the tests.
License
This project is licensed under the MIT License.
This server cannot be installed
hybrid server
The server is able to function both locally and remotely, depending on the configuration or use case.
A Model Context Protocol server that enables LLMs to perform web searches using Google's Gemini API and return synthesized responses with citations.
Related MCP Servers
- AsecurityAlicenseAqualityA Model Context Protocol server that enables LLMs to perform web searches using Google's Custom Search API through a standardized interface.Last updated -123TypeScriptMIT License
- -securityFlicense-qualityA Model Context Protocol server that enables LLMs to perform Google searches via the Serper API, allowing models to retrieve current information from the web.Last updated -2Python
- AsecurityFlicenseAqualityA Model Context Protocol server that provides web search capabilities using Google Custom Search API and webpage content extraction functionality.Last updated -2101JavaScript
- -securityAlicense-qualityA Model Context Protocol server that enables AI assistants to perform web searches using Google Search API, returning up to 20 search results in JSON format.Last updated -PythonApache 2.0