gemini-cli-mcp
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 Generate an image of a cat wearing a hat"
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 Server
Seamless AI-to-AI Delegation via Local Gemini CLI
π Why Gemini CLI MCP?
gemini-cli-mcp is an advanced Model Context Protocol (MCP) server that empowers your AI assistants by delegating complex tasks to your locally installed Gemini CLI.
Rather than collapsing failures into generic errors, this server returns structured results along with execution metadata, making it an essential tool for robust AI-to-AI handoffs and deep debugging.
β¨ Key Features
π Zero-Friction Auth: Transparently utilizes your existing local Gemini CLI setup and credentials.
π Standard MCP Ready: Runs headless over
stdio, effortlessly integrating with standard MCP client setups.π οΈ Task-Oriented & Flexible: Choose
executeTaskfor direct answers, or drop down toexecutePromptfor precise control.π¨ Native Image Generation: Harnesses your local
nanobananaextension to generate and retrieve images seamlessly.π Environment Inspection: Instantly discover available commands, extensions, skills, and MCP servers on the local machine.
Related MCP server: MCP Gemini CLI
π¦ Installation
For normal usage, install the published package globally or run it through your package manager. Ensure you have Node.js 18.18+ installed along with a configured local Gemini CLI.
# npm
npm install -g @cainmaila/gemini-cli-mcp
# pnpm
pnpm add -g @cainmaila/gemini-cli-mcp
# one-off execution without a global install
npx -y @cainmaila/gemini-cli-mcpThe published package name is @cainmaila/gemini-cli-mcp, but the installed executable name is gemini-cli-mcp.
If you use pnpm add -g, make sure your MCP client can see your PNPM_HOME/global bin directory. Some desktop MCP clients do not inherit the same PATH as your interactive shell, which can make gemini-cli-mcp look missing even though the package is installed.
If you want to work on this repository itself instead of using the published package, use the local development flow in DEVELOPMENT.md.
π Quick Start & Usage
Running the Server
Since this is an MCP server, it is designed to communicate over stdio and should be launched by your MCP client.
gemini-cli-mcpClient Configuration Example
Add the following to your AI assistant's MCP configuration:
{
"mcpServers": {
"gemini-cli": {
"command": "gemini-cli-mcp"
}
}
}If your MCP client cannot resolve global binaries reliably, use one of these alternatives instead:
{
"mcpServers": {
"gemini-cli": {
"command": "npx",
"args": ["-y", "@cainmaila/gemini-cli-mcp"]
}
}
}{
"mcpServers": {
"gemini-cli": {
"command": "node",
"args": ["/absolute/path/to/installed/package/build/index.js"]
}
}
}Running gemini-cli-mcp directly in a terminal is only useful as a smoke test. It will wait for MCP traffic over stdio, so it may look idle until a client connects.
π οΈ Available Tools
Best for upstream AI systems. Hands off a task to the Gemini CLI and returns a ready-to-use answer. Auto-applies edit approvals when necessary!
Input Example:
{
"task": "Query today's weather in Taipei and provide a short summary.",
"expectedOutput": "Direct answer, no intro.",
"timeoutMs": 180000
}Output Example:
{
"answer": "...",
"ok": true,
"stdout": "...",
"stderr": "...",
"exitCode": 0,
"elapsedMs": 23053
}A lower-level interface designed for callers who demand exact prompt control.
Input Example:
{
"prompt": "Summarize the current repository",
"model": "gemini-2.5-pro",
"timeoutMs": 60000
}Output Example:
{
"ok": true,
"finalText": "...",
"stdout": "...",
"stderr": "",
"exitCode": 0,
"elapsedMs": 1532
}Flawless image-generation backed by the local nanobanana extension. Bypasses interactive prompts automatically!
Input Example:
{
"prompt": "a cute orange cat portrait, clean light background",
"count": 1,
"timeoutMs": 180000
}Output Example:
{
"ok": true,
"responseText": "/path/to/project/nanobanana-output/cat.png",
"imagePaths": ["/path/to/project/nanobanana-output/cat.png"],
"primaryImagePath": "/path/to/project/nanobanana-output/cat.png",
"exitCode": 0,
"elapsedMs": 12000
}Discover your AI environment's capabilities on the fly. Returns top-level commands, installed extensions, available skills, and configured MCP servers.
Input Example:
{
"includeModelReportedTools": true,
"timeoutMs": 60000
}βοΈ Environment Overrides
Tailor the server to your specific environment simply by setting these variables:
Variable | Description | Default |
| Path to the Gemini executable |
|
| The flag used for passing prompts |
|
| The flag used to specify the model |
|
π Notes & Contributing
Authentication: This server relies on your existing local Gemini CLI authentication.
Resilience: If the local CLI is missing or broken, you will receive structured failure detailsβnever a silent crash.
Want to build with us? Check out our developer guide in DEVELOPMENT.md.
Available Tools
4 toolsexecuteImageTaskExecute Image TaskA
Uses the nanobanana extension to generate images and returns saved image paths plus execution metadata.
Inputs: prompt (required), cwd, count, styles, +3 more. Returns: ok, args, signal, stderr, +12 more
executePromptExecute Gemini PromptB
Runs a non-interactive prompt through the locally installed Gemini CLI and returns the final result plus execution metadata.
Inputs: prompt (required), cwd, model, timeoutMs, +1 more. Returns: ok, args, signal, stderr, +10 more
executeTaskExecute Delegated TaskC
AI-friendly task interface. Accepts a task description and returns a direct, meaningful final answer plus execution metadata.
Inputs: task (required), cwd, model, context, +3 more. Returns: ok, args, answer, signal, +10 more
inspectGeminiCliInspect Gemini CLIA
Lists the currently available Gemini CLI commands, extensions, skills, configured MCP servers, and an optional model-reported tool summary.
Inputs: timeoutMs, includeModelReportedTools. Returns: raw, notes, skills, version, +5 more
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelogβ¦
TDQS
Scored across 4 tools
executeTask and executePrompt overlap heavily: both accept text input and return results plus metadata, with only vague wording about 'task' versus 'prompt' to distinguish them. executeImageTask and inspectGeminiCli are clearly distinct, but the two execution tools create real selection ambiguity.
Three tools follow an execute* pattern and one uses inspect*, all in consistent camelCase. The pattern is readable and predictable, with the minor deviation being 'inspectGeminiCli' referring to a product rather than a generic action object.
Four tools is well-scoped for a Gemini CLI wrapper: prompt execution, task execution, image generation, and introspection. Each tool earns its place without unnecessary bloat.
The set covers the primary workflows of running prompts, executing tasks, generating images, and inspecting the CLI environment. Minor gaps exist around configuration or extension management, but the core use cases are well covered.
Maintenance
Related MCP Connectors
Operate Linux, macOS and Windows from your LLM. Every action runs through an auditable allowlist.
Use your Mac, Windows or Linux computer from ChatGPT, Claude or Codex: files, commands, documents.
Work on your own computers from Claude or ChatGPT: run commands, edit and search files.
Source-checked CLI guides and model-aware planning for Claude Code, Codex, and Grok Build.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceProvides a Model Context Protocol interface to the Gemini CLI, enabling AI agents to call the Gemini model and interact with development tools like code linting, GitHub operations, and documentation generation. Includes security measures to prevent unauthorized file access through path validation.3MIT
- AlicenseNot gradedqualityDmaintenanceWraps Google's Gemini CLI to expose search, chat, and file analysis tools via the Model Context Protocol for AI assistants.321 npm101MIT
- AlicenseAqualityCmaintenanceEnables Codex to delegate coding tasks to an OpenCode CLI locally, returning structured results such as exit codes, session summaries, tool calls, and git diffs.2MIT
- AlicenseAqualityBmaintenanceEnables delegation of coding tasks to a locally installed MiniMax Code CLI, leveraging user's existing login, models, and configuration.728 npmMIT