Google Gemini MCP server
Maintained community MCP server for Google's Gemini API: generate text, analyze images, count tokens, and create embeddings from your agent.
mcp-server-gemini is a popular, actively-maintained community MCP server that brings Google's Gemini models into any MCP client over stdio. It wraps the Gemini API behind a small set of focused tools so a coding or chat agent can hand work off to Gemini — drafting or transforming text, analyzing an image, counting tokens before a large request, listing the available models, or generating vector embeddings — without you wiring up the Google AI SDK yourself.
The server exposes Gemini's distinctive features through tool parameters: thinking mode on the 2.5 reasoning models, vision for image understanding, Google Search grounding for fresh facts, and JSON output mode for structured responses. It also ships MCP prompts (code review, explain-with-thinking, creative writing) and resources that document the available models and parameters, so an agent can introspect what Gemini can do. It runs locally over stdio and authenticates with a GEMINI_API_KEY from Google AI Studio. Because the npm name is taken by an unrelated placeholder, the canonical way to run it is straight from GitHub via npx (github:aliargun/mcp-server-gemini). It is MIT-licensed and has a healthy following on GitHub.
Quick install
Copy-paste configs are provided for all 8 supported clients. Pick your client below.
Available tools
| Tool | Description |
|---|---|
| generate_text | Generate text with a Gemini model from a prompt, with optional thinking, grounding, and JSON output modes. |
| analyze_image | Analyze an image with Gemini's vision capability and answer questions about it. |
| count_tokens | Count the number of tokens a prompt will use before sending a request. |
| list_models | List the available Gemini models and their capabilities. |
| embed_text | Generate vector embeddings for text using a Gemini embedding model. |
| get_help | Return built-in documentation covering the server's tools, models, parameters, examples, and quick start. |
Required configuration
- GEMINI_API_KEYRequired
Google Gemini API key from Google AI Studio. Required.
What you can do with it
Offload a task to Gemini from your main agent
When your agent needs Gemini's long context window or thinking mode, it calls generate_text with grounding enabled to pull in fresh facts, or analyze_image to describe a screenshot — composing Gemini as a specialist without leaving the editor.
Estimate cost and pick a model before a big run
Before sending a large prompt, the agent calls count_tokens to size the request and list_models to choose between Gemini 2.5 Pro and Flash, keeping spend predictable.
FAQ
- Is it free?
- The MCP server is open source (MIT) and free to run, but it calls the Gemini API against your GEMINI_API_KEY. Google offers a free tier with rate limits; heavier usage is billed per token. Use count_tokens to size requests before sending them.
- Does it support remote/OAuth?
- No. It runs locally over stdio and authenticates with a GEMINI_API_KEY. Note that the npm package name 'mcp-server-gemini' is an unrelated placeholder — run this server directly from GitHub with npx github:aliargun/mcp-server-gemini.
- Which Gemini models does it support?
- It targets the current Gemini 2.5 family (Pro, Flash, Flash-Lite) plus 2.0 and legacy 1.5 models, and exposes thinking mode, vision, Google Search grounding, and JSON output through tool parameters.