gemini-mcp
Provides a google_search tool that uses Google Search grounding via Gemini to perform web searches with real-time results and source citations.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@gemini-mcpWhat are the latest developments in quantum computing?"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Gemini CLI MCP Server
An MCP (Model Context Protocol) server that provides Google Search grounding capabilities using Gemini Code Assist. This server enables LLMs like Claude to perform web searches with citations and source attribution.
Features
Google Search Grounding: Get answers with real-time web search results
Source Citations: Responses include source URLs and citation mapping
Automatic Token Refresh: OAuth credentials are automatically refreshed when expired
Docker Support: Run as a containerized service with stdio or HTTP/SSE transport
Multiple Models: Support for various Gemini models
Related MCP server: gemini-grounding
Prerequisites
Python 3.11+
A Google account with access to Gemini Code Assist
A Google OAuth client (set
GOOGLE_OAUTH_CLIENT_IDandGOOGLE_OAUTH_CLIENT_SECRET) it is out there somewhere , search for it
Installation
Local Installation
Clone or download this directory
Create and activate a virtual environment:
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activateInstall dependencies:
pip install -r requirements.txtDocker Installation
Build the Docker image:
docker build -t gemini-mcp .Authentication Setup
Before using any scripts, you need to authenticate with Google.
Local Authentication
# Option A: export env vars
export GOOGLE_OAUTH_CLIENT_ID="...apps.googleusercontent.com"
export GOOGLE_OAUTH_CLIENT_SECRET="..."
python manual_auth.pyDocker Authentication
docker run -it --rm -e GOOGLE_OAUTH_CLIENT_ID="..." -e GOOGLE_OAUTH_CLIENT_SECRET="..." -p 8080:8080 -v ./config:/app/config gemini-mcpOn first run (when no credentials exist), the container will:
Display a URL to open in your browser for Google OAuth login
Guide you to paste the redirect URL back
Save your credentials to the config directory
Print your credential/project info
Start the MCP server in HTTP/SSE mode on port 8080
Important: Keep your credentials secure and never commit them to version control.
Docker Usage (HTTP/SSE)
The Docker container always starts the MCP server in HTTP/SSE mode.
Examples
# First run (interactive OAuth + start server)
docker run -it --rm -p 8080:8080 -v ./config:/app/config gemini-mcp
# Subsequent runs (no -it needed once credentials exist)
docker run -d -p 8080:8080 -v ./config:/app/config gemini-mcpAvailable Scripts
server.py - MCP Server
The main MCP server that exposes the google_search tool.
# Run directly (defaults to HTTP/SSE on :8080)
python server.py
# If you need stdio transport (some MCP clients), set:
MCP_TRANSPORT=stdio python server.pyThe server provides the following tool:
google_search(query, model): Search using Gemini with Google Search groundingquery: The search query or questionmodel: The model to use (default:gemini-2.5-flash)
search.py - CLI Search
A command-line interface for quick searches without running the full MCP server.
# Basic search
python search.py "What is the latest news about AI?"
# Specify a model
python search.py "Explain quantum computing" --model gemini-2.5-pro
# Get help
python search.py --helpinfo.py - Credential Info
Display information about your current credentials and authentication status.
python info.pyThis shows:
User email and name
Current tier and managed project
Available tiers
manual_auth.py - Authentication
Perform OAuth authentication and save credentials.
python manual_auth.pyAvailable Models
The following Gemini models are supported:
Model | Description |
| Fast, efficient model (default) |
| More capable model for complex tasks |
| Previous generation flash model |
| Legacy flash model |
| Legacy pro model |
MCP Client Configuration
For clients that support HTTP/SSE transport, run the server in HTTP mode:
docker run -d -p 8080:8080 -v ./config:/app/config gemini-mcpThen configure your MCP client:
{
"mcpServers": {
"gemini-search": {
"url": "http://localhost:8080/sse"
}
}
}Environment Variables
Variable | Description | Default |
| Directory containing |
|
| HTTP bind address |
|
| HTTP port (preferred) |
|
| HTTP port (legacy alias) |
|
| MCP transport ( |
|
Setting Environment Variables
Local:
export CREDENTIALS_PATH=/path/to/dir
python server.pyManual Google Cloud Setup
If automatic provisioning fails, you may need to set up the project manually:
Go to the Google Cloud Console.
Create or select a project.
Enable the Gemini for Google Cloud API (
cloudaicompanion.googleapis.com).Configure the
projectIdin your Opencode config as shown above.
Gemini Admin Settings
In Google Cloud Console, search for Admin for Gemini. Open it, go to Settings, then enable Preview on release channels for Gemini Code Assist in local IDEs.
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Latest Blog Posts
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/pedro-n-rocha/gemini-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server