GeminiMCP
MCP (Model Control Protocol) server integrating with Google's Gemini API
claude mcp add --transport stdio chew-z-geminimcp ./bin/mcp-gemini \ --env GEMINI_MODEL="gemini-3.1-pro-preview" \ --env GEMINI_API_KEY="YOUR_GEMINI_API_KEY" \ --env GEMINI_SEARCH_MODEL="gemini-flash-lite-latest" \ --env GEMINI_SYSTEM_PROMPT="You are a senior developer. Your job is to provide thorough, precise analysis and reasoning when interacting with Gemini models." \ --env GEMINI_SEARCH_SYSTEM_PROMPT="You are a search assistant. Find the most relevant information and provide well-sourced results."
How to use
GeminiMCP is a Go-based MCP server that acts as a bridge to Google's Gemini API. It automatically fetches the latest Gemini models at startup and exposes tools for code analysis, general queries, and web-style search with grounding. The server supports multiple modes, including a standard stdin/stdout transport for Claude Desktop-like clients and an HTTP transport for REST/web integrations. To use it, configure your MCP client to point at the GeminiMCP server and supply the required Gemini-related environment variables in the MCP configuration JSON. The included tools (gemini_models, gemini_ask, gemini_search) enable you to list available models, perform code analysis, and conduct factual research respectively, with optional caching and thinking modes for deeper reasoning when necessary.
How to install
Prerequisites:
- Go tooling installed (go version 1.x or newer)
- Access to a Gemini API key
Building from source:
# Clone the repository
git clone https://github.com/chew-z/GeminiMCP
cd GeminiMCP
# Build the server binary
go build -o ./bin/mcp-gemini
Running the server (example):
export GEMINI_API_KEY=your_api_key
export GEMINI_MODEL=gemini-3.1-pro-preview
./bin/mcp-gemini
Starting with HTTP transport (optional):
./bin/mcp-gemini --transport=http
Overriding settings via command line (example):
./bin/mcp-gemini --transport=http --gemini-model=gemini-3-flash-preview --enable-caching=true
Client configuration (example JSON snippet):
{
"gemini": {
"command": "/path/to/bin/mcp-gemini",
"env": {
"GEMINI_API_KEY": "YOUR_GEMINI_API_KEY",
"GEMINI_MODEL": "gemini-3.1-pro-preview",
"GEMINI_SEARCH_MODEL": "gemini-flash-lite-latest",
"GEMINI_SYSTEM_PROMPT": "You are a senior developer. Your job is to do a thorough code review of this code...",
"GEMINI_SEARCH_SYSTEM_PROMPT": "You are a search assistant. Your job is to find the most relevant information about this topic..."
}
}
}
Additional notes
Environment variables configured in the MCP config JSON take precedence for clients like Claude Desktop. The server supports two transport modes: stdio for MCP clients that communicate via stdin/stdout and http for REST-style access. When using HTTP, consider enabling authentication and configuring CORS origins via GEMINI_AUTH_ENABLED, GEMINI_AUTH_SECRET_KEY, and GEMINI_HTTP_CORS_ORIGINS to limit exposure in production. If you run into issues, ensure GEMINI_API_KEY and the selected GEMINI_MODEL are valid and that network access to Gemini services is available. The system prompts and models can be tuned with GEMINI_SYSTEM_PROMPT and GEMINI_SEARCH_SYSTEM_PROMPT to control style and behavior.
Related MCP Servers
sandbox
A Model Context Protocol (MCP) server that enables LLMs to run ANY code safely in isolated Docker containers.
github-brain
An experimental GitHub MCP server with local database.
temporal
Empowering AI with Workflow Orchestration
mcp-tts
MCP Server for Text to Speech
tasker
An MCP server for Android's Tasker automation app.
mcp-log-proxy
a web logging proxy for MCP client-server communication