Gemini MCP Server
Provides a Git-aware PR/branch review tool that automatically fetches branch diffs and commit history for Gemini review.
Provides tools to send prompts, files, and code to Google's Gemini models via the Gemini CLI, including summarization, analysis, code review, and web search using Google Search grounding with source citations.
Click on "Deploy 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 MCP Server summarize the src/ directory and flag the riskiest code"
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.
What is this?
A local MCP server that wraps the gemini CLI, letting any MCP client (Claude Code, Cursor, etc.) offload expensive tasks to Gemini 2.5 Pro's massive context window.
Use cases:
Summarize a 5,000-line file without burning Claude's tokens
Analyze an entire codebase directory in one shot
Get a second-opinion code review from a different model
Process huge logs or data files that exceed comfortable context limits
Search the web for up-to-date information via Google Search grounding
Review a PR or branch diff automatically without manual copy-paste
Related MCP server: gemini-researcher
MCP Tools
Tool | Description |
| Send a prompt to Gemini with optional file context |
| Summarize a file or entire directory/codebase |
| Deep analysis of codebase structure, patterns, and issues |
| Code review with actionable feedback (manual diff/files) |
| Web search with Google Search grounding — get current info with source citations |
| Git-aware PR/branch review — auto-fetches diff and commit history |
Prerequisites
Node.js 18+
Gemini CLI installed and authenticated
Quick Start
No cloning needed — just add to your MCP client config:
{
"mcpServers": {
"gemini": {
"command": "npx",
"args": ["-y", "@ethantsaitsai/gemini-mcp-server"]
}
}
}Run:
claude mcp add gemini -- npx -y @ethantsaitsai/gemini-mcp-serverOr add to your project's .mcp.json:
{
"mcpServers": {
"gemini": {
"command": "npx",
"args": ["-y", "@ethantsaitsai/gemini-mcp-server"]
}
}
}Add to ~/.gemini/settings.json:
{
"mcpServers": {
"gemini": {
"command": "npx",
"args": ["-y", "@ethantsaitsai/gemini-mcp-server"]
}
}
}Add to ~/Library/Application Support/Claude/claude_desktop_config.json (macOS) or %APPDATA%\Claude\claude_desktop_config.json (Windows):
{
"mcpServers": {
"gemini": {
"command": "npx",
"args": ["-y", "@ethantsaitsai/gemini-mcp-server"]
}
}
}Go to Cursor Settings > MCP > Add new MCP Server, then add:
{
"mcpServers": {
"gemini": {
"command": "npx",
"args": ["-y", "@ethantsaitsai/gemini-mcp-server"]
}
}
}Add to .vscode/mcp.json in your workspace:
{
"servers": {
"gemini": {
"command": "npx",
"args": ["-y", "@ethantsaitsai/gemini-mcp-server"]
}
}
}Add to ~/.codeium/windsurf/mcp_config.json:
{
"mcpServers": {
"gemini": {
"command": "npx",
"args": ["-y", "@ethantsaitsai/gemini-mcp-server"]
}
}
}git clone https://github.com/ethan-tsai-tsai/gemini-mcp-server.git
cd gemini-mcp-server
npm install
npm startEnvironment Variables
Variable | Default | Description |
|
| Path to the gemini binary |
|
| Default Gemini model |
|
| Timeout per invocation (ms) |
How It Works
┌─────────────┐ MCP (stdio) ┌──────────────┐ child_process ┌─────────────┐
│ AI Client │ ◄──────────────────► │ index.js │ ◄────────────────► │ gemini CLI │
│ (Claude, │ gemini_query() │ (MCP Server)│ spawn/execFile │ (Google) │
│ Cursor...) │ gemini_summarize() │ │ │ │
│ │ gemini_analyze() │ │ │ │
│ │ gemini_review() │ │ │ │
│ │ gemini_search() │ │ │ │
│ │ gemini_pr_review() │ │ │ │
└─────────────┘ └──────────────┘ └─────────────┘Security
No
console.log— stdout is reserved for JSON-RPC; all logging usesstderrNo shell injection — Uses
spawn/execFileinstead ofexec; all inputs are sanitizedBinary files skipped — Automatically detects and skips non-text files
Path validation — All file paths are sanitized before use
License
Available Tools
6 toolsgemini_analyzeA
Perform deep, structured analysis of a codebase or file using Gemini. USE THIS TOOL WHEN: (1) You need to understand the architecture of a large, unfamiliar project. (2) You want to audit code for bugs or security vulnerabilities across many files. (3) You need to map out dependencies or identify design patterns in a codebase. (4) You have a specific analytical question about a codebase that requires reading many files. This tool is MORE STRUCTURED than gemini_summarize — it uses specialized prompts for each analysis type and produces categorized, actionable findings. Automatically filters out node_modules, .git, binary files, and other non-essential content.
Inputs: target_path (required), analysis_type (required), model, max_depth, +1 more.
gemini_pr_reviewA
Review a pull request or branch diff using Gemini. USE THIS TOOL WHEN: (1) You want to review all changes in a PR or feature branch before merging. (2) You need a thorough review of a large diff that would consume too many tokens. (3) You want to compare changes between two branches or commits. This tool automatically fetches the git diff and optionally collects the full content of changed files for deeper context. It differs from gemini_review: this tool is git-aware and fetches diffs automatically, while gemini_review requires you to pass in the diff or file content manually.
Inputs: repo_path (required), base, head, model, +2 more.
gemini_queryA
Send a query to Google Gemini with optional file context. Use this tool when you need to delegate a task that would consume a large amount of tokens — for example: reading and analyzing a very large file (>1000 lines), summarizing lengthy logs, getting a second opinion on complex analysis, or processing content that exceeds your comfortable context window. Gemini has a very large context window (1M+ tokens) and can handle these tasks efficiently. You can attach files as context by providing their absolute paths. Returns Gemini's text response.
Inputs: prompt (required), model, context_files.
gemini_reviewA
Get a code review from Gemini on specific files or a git diff. USE THIS TOOL WHEN: (1) You want a second opinion on code you just wrote or are about to commit. (2) You need to review a large diff that would consume too many tokens to analyze yourself. (3) You want a focused review on a specific aspect like performance, error handling, or readability. (4) You need to review multiple files together to check for cross-file consistency. This tool differs from gemini_analyze: it is designed for reviewing CHANGES (diffs, specific files) rather than analyzing an entire codebase. It provides actionable review comments with severity levels.
Inputs: diff, model, file_paths, review_focus.
gemini_searchA
Search the web using Gemini with Google Search grounding. USE THIS TOOL WHEN: (1) You need current, up-to-date information that may be beyond your training data. (2) You need to look up latest versions, release notes, or changelogs. (3) You need to research a topic with real-time web results. (4) You need to verify facts or find documentation URLs. Gemini will automatically search Google and synthesize results into a comprehensive answer with source citations. This is more powerful than a raw search engine — it reads, understands, and summarizes the search results.
Inputs: query (required), model, context.
gemini_summarizeA
Summarize a file or an entire directory/codebase using Gemini's large context window. USE THIS TOOL WHEN: (1) You need a quick overview of a large file (>500 lines) without reading it yourself. (2) You need to understand the structure and purpose of an unfamiliar codebase or directory. (3) You want to summarize lengthy logs, documentation, or data files. For directories, this tool automatically traverses the file tree, skipping node_modules, .git, binary files, and other non-essential content. It respects a ~4MB total content limit to stay within Gemini's context window. Returns a structured summary from Gemini.
Inputs: target_path (required), focus, model, max_depth.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 6 tools
Each tool has a distinct intent: query (arbitrary delegation), summarize (overview), analyze (structured deep analysis), review (manual diffs/files), pr_review (git-aware diff fetching), and search (web grounding). The boundaries between summarize/analyze/review are explicitly explained in the descriptions, though gemini_query is a generic catch-all that could plausibly be used where the specialized tools are intended.
All six tools follow a strict gemini_<verb> pattern (query, summarize, analyze, review, search, pr_review). The convention is predictable and the names read cleanly.
Six tools is well-scoped for a Gemini delegation wrapper, with each tool covering a distinct workflow (query, summarize, analyze, review, search, PR review). No filler tools appear.
The surface covers the main use cases of offloading large-context work: arbitrary queries, file/directory summarization, structured analysis, code review, git-aware PR review, and web search. Minor gaps exist, such as no dedicated diff-between-commits reporting beyond pr_review or a batch multi-file review tool, but the catch-all gemini_query lets agents work around these.
Maintenance
Related MCP Connectors
Shared memory MCP server for Claude Code, Codex, Gemini CLI and Cursor. Cited, editable.
AI-native git hosting — repos, PRs, issues, CI gates, and AI code review over MCP (60 tools).
GitHub Copilot MCP: code, repo, PR, workflow tools for AI assistants.
Web scraping, Google SERP, Markdown and ChatGPT/Gemini answers as typed tools for AI agents.
Related MCP Servers
- FlicenseNot gradedqualityDmaintenanceEnables comprehensive codebase analysis using Google's Gemini CLI and its massive context window. Supports file/directory analysis, security audits, architecture analysis, feature verification, and complete project overviews for large codebases that exceed other AI models' context limits.-
- AlicenseAqualityFmaintenanceA research proxy that lets Claude, Cursor, and other MCP clients utilize Gemini's generous free tier for deep codebase analysis without burning your main model's quota!6594 npmMozilla Public 2.0
- AlicenseNot gradedqualityAmaintenanceAn MCP server for AI-to-AI collaboration via the Gemini CLI. Available on npm: ask-gemini-mcp. Works with Claude Code, Claude Desktop, Cursor, Warp, Copilot, and 40+ other MCP clients. Leverage Gemini's massive 1M+ token context window for large file and codebase analysis while your primary AI handles interaction and code editing.21MIT
- AlicenseCqualityDmaintenanceExposes the local Gemini CLI as an MCP stdio server, providing tools for prompting, web search, file operations, and MCP management, enabling AI clients like Codex CLI and Claude Code to interact with Gemini.227MIT