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 "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-cli-mcp ask 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.
Inputs: action (required).
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.
Inputs: prompt (required), model, sandbox, yolo, +4 more.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 2 tools
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
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.
Shared memory MCP server for Claude Code, Codex, Gemini CLI and Cursor. Cited, editable.
Remote MCP server exposing your Node Command fleet (files, shell, processes, browser) to AI hosts.
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.138Apache 2.0
- AlicenseAqualityCmaintenanceA 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
- AlicenseAqualityDmaintenanceWraps the Gemini CLI as an MCP server, enabling AI tools to perform Gemini queries, interactive sessions, and extension management via a unified tool.11MIT