gemini-cli-mcp
gemini-cli-mcp is an MCP server that lets MCP clients like Claude Code interact with Google Gemini AI models through a locally authenticated Gemini CLI, without needing an API key.
gemini_query — Send prompts to Gemini models:
Choose from multiple models (
gemini-2.5-pro,gemini-2.5-flash,gemini-2.5-flash-lite, preview models, or aliases likeauto,pro,flash)Reference local files in prompts using
@file.tssyntaxEnable sandbox mode for safe code execution
Set approval modes:
default,auto_edit,yolo(auto-approve all actions), orplan(read-only)Specify a working directory and additional workspace directories for file context
Include token usage statistics in responses
gemini_info — Diagnostics and metadata with minimal/zero API calls:
ping: Test CLI connectivityversion: Get the installed Gemini CLI versionlist_models: View available models and aliaseslist_sessions: Browse past conversation sessionslist_extensions: View installed extensions
Defaults for model, timeouts, binary path, and system prompts can be configured via environment variables. Works cross-platform on macOS, Linux, and Windows with security measures to prevent command injection.
Wraps the Google Gemini CLI to provide tools for querying Gemini models (such as Gemini 2.5 and 3), listing available models and aliases, and managing past sessions using local OAuth authentication.
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-cli-mcpask gemini-2.5-pro to explain the logic in @index.ts"
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
A secure MCP server that wraps Google's Gemini CLI. It lets Claude Code (or any MCP client) call Gemini models using your local OAuth session — no API key required.
Highlights
Secure —
spawn(shell:false)on Unix; controlledshell:true+ arg escaping on Windows. No command injection.Cross-platform — macOS, Linux, Windows. Auto-resolves
.cmdwrappers and forces UTF-8.Activity-based timeout — idle timer resets on each output chunk. Long thinking won't be killed; stuck 429 retries will.
Low token overhead — replaces Gemini's ~8 800-token default system prompt with a minimal one (~50 tokens).
Clean output — internally uses
stream-jsonand parses structured responses. No stdout noise pollution.2 tools only —
gemini_query+gemini_info. Minimal context-window footprint for the host AI.
Related MCP server: Gemini CLI MCP/OpenAI Bridge
Prerequisites
Node.js >= 18 — Download
Google Gemini CLI — installed globally and logged in:
npm install -g @google/gemini-cli
gemini # run once — complete the Google OAuth login in your browserVerify it works before using this MCP server:
gemini -p "say hello" -o text
# Should print a response. If you see auth errors, re-run `gemini` to log in.Install
NPM (recommended)
npm install -g @xjoker/gemini-cli-mcp
# Register with Claude Code
claude mcp add gemini-cli -s user -- gemini-cli-mcpFrom source
git clone https://github.com/xjoker/gemini-cli-mcp.git
cd gemini-cli-mcp
npm install && npm run build
claude mcp add gemini-cli -s user -- node $(pwd)/dist/index.jsClaude Desktop
Edit ~/Library/Application Support/Claude/claude_desktop_config.json:
{
"mcpServers": {
"gemini-cli": {
"command": "gemini-cli-mcp"
}
}
}Upgrade
npm update -g @xjoker/gemini-cli-mcpTools
gemini_query
Send a prompt to Gemini.
Parameter | Type | Required | Description |
| string | Yes | Prompt text. Use |
| string | No | Model name or alias (default: |
| boolean | No | Run in sandboxed environment |
| boolean | No | Auto-approve all tool actions |
| enum | No |
|
| boolean | No | Append token usage stats |
| string[] | No | Extra workspace directories |
| string | No | Working directory for |
gemini_info
Diagnostics and metadata — most actions cost zero API calls.
Action | Description | API call? |
| Test CLI connectivity | No |
| Get CLI version | No |
| Show available models and aliases | No |
| List past Gemini sessions | No |
| List installed Gemini extensions | No |
Models
Model | Tier | Description |
| stable | High reasoning & creativity |
| stable | Fast, balanced (default) |
| stable | Fastest, lightest |
| preview | Gemini 3 Pro |
| preview | Gemini 3 Flash |
| preview | Gemini 3.1 Pro (rolling out) |
| preview | Gemini 3.1 Flash Lite |
Aliases: auto, pro, flash, flash-lite
Free tier quota: 60 RPM / 1 000 requests per day.
Environment Variables
Variable | Default | Description |
|
| Default model |
|
| Phase 1 idle timeout (ms) — CLI startup and initial response |
|
| Phase 2 idle timeout (ms) — thinking, resets on each output chunk |
|
| Max response chars before truncation |
|
| Path to Gemini CLI binary |
| (bundled minimal) | Path to custom system prompt, or |
Security
Platform | Strategy |
Unix |
|
Windows |
|
Zero usage of
exec()/execSync()/ template-string commands.Verify:
grep -rn "exec(" src/returns nothing.
License
Available Tools
2 toolsgemini_infoB
Gemini CLI diagnostics: check connectivity, get version, list sessions or extensions.
| Name | Required | Description | Default |
|---|---|---|---|
| action | Yes | ping: test CLI works, version: CLI version, list_models: available models and aliases, list_sessions: past sessions, list_extensions: available extensions. |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations are provided, so the description carries the full burden. It implies read-only behavior through terms like 'diagnostics' and 'list', but fails to disclose output formats, error conditions, or whether these operations are cached/live. It meets minimum expectations for a metadata tool but lacks rich behavioral context.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is a single, efficient sentence that front-loads the category ('Gemini CLI diagnostics') and follows with a colon-delimited list of specific capabilities. No words are wasted.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
For a simple single-parameter tool with complete schema coverage, the description is adequate. It covers the primary use cases (though misses list_models in prose). No output schema exists, but the description sufficiently indicates the return type nature (diagnostic info).
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
With 100% schema coverage, the baseline is 3. The description maps most enum values to user-friendly intents (ping→connectivity, etc.) but omits 'list_models' entirely. It adds minimal semantic value beyond what the schema's detailed descriptions already provide.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly identifies the tool's purpose using specific verbs (check, get, list) and identifies the resource (Gemini CLI diagnostics). It implicitly distinguishes from sibling 'gemini_query' by focusing on introspection/metadata rather than active querying, though explicit differentiation would strengthen this further.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description lists capabilities but provides no explicit guidance on when to use this tool versus 'gemini_query'. It lacks prerequisites (e.g., 'use ping to verify connectivity before querying') or exclusion criteria that would help an agent select the correct tool.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
gemini_queryA
Send a prompt to Google Gemini via locally authenticated CLI. Supports all Gemini models. Use @path to reference local files. Options: sandbox mode, yolo (auto-approve), approval modes, extra directories.
| Name | Required | Description | Default |
|---|---|---|---|
| prompt | Yes | Prompt for Gemini. Use @file.ts to include file context. | |
| model | No | Model name (e.g. gemini-2.5-pro, gemini-2.5-flash, gemini-2.5-flash-lite). Default: gemini-2.5-flash | |
| sandbox | No | Run in sandbox mode for safe code execution. | |
| yolo | No | Auto-approve all tool actions (no confirmation prompts). | |
| approval_mode | No | Approval mode: default (prompt), auto_edit (auto-approve edits), yolo (auto-approve all), plan (read-only). | |
| include_stats | No | Include token usage stats in the response. | |
| include_directories | No | Additional directories to include in Gemini's workspace. | |
| cwd | No | Working directory for file references (@ syntax). |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations, description carries full burden. It discloses authentication method (locally authenticated CLI), safety controls (sandbox, yolo, approval modes), and file referencing (@path). However, misses return format, error behavior, and side effects of auto-approve modes.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
Front-loaded with core purpose, followed by model support, file syntax, and options list. Efficiently packs 8 parameters worth of context into four brief statements. Minor deduction for the slightly telegraphic 'Options:' list which could flow better.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Covers key capabilities well for a complex 8-parameter tool: authentication, model flexibility, file inclusion, workspace directories, and safety modes. Absence of output schema is mitigated by clear description of what the tool does, though mention of return format would improve completeness.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Adds conceptual value beyond 100% schema coverage by explaining @path syntax for file references and grouping related boolean flags (sandbox, yolo) under 'Options'. Schema handles individual parameter docs; description provides usage context.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
States specific action (Send), resource (prompt to Google Gemini), and mechanism (locally authenticated CLI). Clearly distinguishes from sibling 'gemini_info' by focusing on active querying vs. information retrieval.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
Implies usage through 'Send a prompt' and lists capabilities, but lacks explicit guidance on when to use gemini_info instead, or when-not-to-use scenarios (e.g., when file contexts are inappropriate).
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections. Dates show when Glama detected each change.
2 tool updates
v1.0.1- First observed
gemini_info - First observed
gemini_query
TDQS
The two tools have completely distinct purposes: gemini_info handles diagnostics and system information, while gemini_query handles querying the Gemini model. There is no overlap in functionality that could cause confusion.
Both tools follow a consistent gemini_ prefix pattern with clear descriptive suffixes (info and query). The naming is uniform and predictable across the toolset.
With only two tools, the server feels under-scoped for a CLI interface to Gemini. A typical CLI would include more operations like session management, configuration handling, or batch processing, making this set feel incomplete for the domain.
The toolset is severely incomplete for a Gemini CLI interface. It lacks essential operations such as managing sessions, configuring settings, handling file uploads beyond references, or listing available models. The two tools cover only basic diagnostics and querying, leaving significant gaps in typical CLI workflows.
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Connectors
Security scanner for MCP servers. Detect vulnerabilities, prompt injection, and tool poisoning.
An MCP server that provides an API to LLMs to manage their JumpCloud resources.
Focused MCP server for OpenAI image/audio generation (v2.0.0). Wraps endpoints via HAPI CLI.
MCP server for Pentest-Tools.com: run scans, manage findings and reports via your preffered LLM.
Related MCP Servers
- FlicenseNot gradedqualityDmaintenanceAn MCP server that wraps the Gemini CLI to provide tools for executing prompts, managing chat sessions, and accessing CLI extensions. It supports both local stdio and remote SSE transports for flexible integration with MCP clients.1-
- AlicenseNot gradedqualityFmaintenanceExposes Gemini CLI's built-in tools and external MCP proxies through a unified MCP endpoint while providing an OpenAI-compatible API for Gemini models. It features configurable security modes to safely manage file system operations, web searches, and shell command execution.22138Apache 2.0
- AlicenseAqualityBmaintenanceA stateless MCP server that wraps the headless Gemini CLI, providing tools to send prompts to Google's Gemini models and receive text responses. It supports both simple prompts and prompts with contextual information.2MIT
- FlicenseAqualityDmaintenanceWraps the Gemini CLI as an MCP server, enabling AI tools to perform Gemini queries, interactive sessions, and extension management via a unified tool.11-
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- 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/xjoker/gemini-cli-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server