gemini-cli-mcp
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-mcpGenerate 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.
| Name | Required | Description | Default |
|---|---|---|---|
| cwd | No | Optional working directory for generated image output | |
| count | No | Optional number of images to generate | |
| prompt | Yes | Image generation prompt for the nanobanana extension | |
| styles | No | Optional style names passed to nanobanana | |
| timeoutMs | No | Optional timeout in milliseconds | |
| variations | No | Optional variation names passed to nanobanana | |
| approvalMode | No | Optional Gemini CLI approval mode. Defaults to yolo for nanobanana. |
Output Schema
| Name | Required | Description |
|---|---|---|
| ok | Yes | |
| args | Yes | |
| signal | Yes | |
| stderr | Yes | |
| stdout | Yes | |
| aborted | Yes | |
| command | Yes | |
| exitCode | Yes | |
| timedOut | Yes | |
| elapsedMs | Yes | |
| imagePaths | Yes | |
| errorMessage | No | |
| responseText | Yes | |
| primaryImagePath | No | |
| workingDirectory | No | |
| effectiveApprovalMode | No |
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 of behavioral disclosure. It does reveal that images are saved and that metadata is returned, which is useful, but it omits caveats about external dependencies, failure behavior, or approval modes. Transparency is partial but not absent.
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 front-loaded sentence with no wasted words. It efficiently communicates the mechanism, the operation, and the output type.
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?
The description is adequate for identifying the tool's core purpose, and the output schema covers return details. However, without annotations or usage guidance, and with several sibling tools, the description leaves gaps around when to choose this tool and what side effects to expect beyond saving images.
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?
Schema description coverage is 100%, so the schema already documents all seven parameters. The description adds no additional parameter-level semantics beyond what the schema provides, which is the baseline case.
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 states a specific action ('generate images') and a specific resource ('nanobanana extension'), and it also states what is returned ('saved image paths plus execution metadata'). This clearly differentiates it from the generic sibling tools executeTask and executePrompt.
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 implies use for image-generation tasks through nanobanana, but it gives no explicit when-to-use or when-not-to-use guidance. It does not mention alternatives or exclusions, so the agent must infer the appropriate context.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
executePromptExecute Gemini PromptB
Runs a non-interactive prompt through the locally installed Gemini CLI and returns the final result plus execution metadata.
| Name | Required | Description | Default |
|---|---|---|---|
| cwd | No | Optional working directory for the Gemini CLI process | |
| model | No | Optional Gemini model name | |
| prompt | Yes | Prompt to send to the local Gemini CLI | |
| timeoutMs | No | Optional timeout in milliseconds | |
| approvalMode | No | Optional Gemini CLI approval mode |
Output Schema
| Name | Required | Description |
|---|---|---|
| ok | Yes | |
| args | Yes | |
| signal | Yes | |
| stderr | Yes | |
| stdout | Yes | |
| aborted | Yes | |
| command | Yes | |
| exitCode | Yes | |
| timedOut | Yes | |
| elapsedMs | Yes | |
| finalText | Yes | |
| errorMessage | No | |
| workingDirectory | No | |
| effectiveApprovalMode | No |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations, the description carries full responsibility for disclosing behavioral traits. It mentions running a prompt and returning metadata, but omits potential side effects such as code execution, credential requirements, or approval behaviors implied by the approvalMode enum (including 'yolo' and 'auto_edit'). No warnings about destructive or mutating outcomes are given.
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 19-word sentence that front-loads the verb, resource, and scope. Every word contributes; there is no filler or repetition.
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?
Even with complete parameter schema and an output schema, the description is too thin for a tool that wraps an external CLI with potentially risky approval modes. Missing context includes when to prefer it over siblings, prerequisites like having the Gemini CLI installed, and behavioral safety. An agent could call it wrongly or be surprised by side effects.
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?
Schema description coverage is 100%, so all five parameters already have individual descriptions. The tool-level description adds no parameter-specific meaning beyond framing the prompt as 'non-interactive', which is not enough to lift above the baseline of 3.
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 states a specific action ('Runs a non-interactive prompt') and resource ('locally installed Gemini CLI'), and adds a distinctive output ('final result plus execution metadata'). This clearly separates it from executeImageTask and inspectGeminiCli, though overlap with executeTask is not explicitly addressed.
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?
No guidance is provided on when to use this tool versus siblings like executeTask or executeImageTask. There are no exclusions, prerequisites, or alternative routing hints; the only implicit signal is 'non-interactive', which is not developed into actionable direction.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
executeTaskExecute Delegated TaskC
AI-friendly task interface. Accepts a task description and returns a direct, meaningful final answer plus execution metadata.
| Name | Required | Description | Default |
|---|---|---|---|
| cwd | No | Optional working directory for the Gemini CLI process | |
| task | Yes | Task to delegate to the local Gemini CLI | |
| model | No | Optional Gemini model name | |
| context | No | Optional task context for Gemini | |
| timeoutMs | No | Optional timeout in milliseconds | |
| approvalMode | No | Optional Gemini CLI approval mode. If omitted, file-mutating tasks default to auto_edit. | |
| expectedOutput | No | Optional instructions describing the desired final answer format |
Output Schema
| Name | Required | Description |
|---|---|---|
| ok | Yes | |
| args | Yes | |
| answer | Yes | |
| signal | Yes | |
| stderr | Yes | |
| stdout | Yes | |
| aborted | Yes | |
| command | Yes | |
| exitCode | Yes | |
| timedOut | Yes | |
| elapsedMs | Yes | |
| errorMessage | No | |
| workingDirectory | No | |
| effectiveApprovalMode | No |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations, the description carries the full burden of disclosing behavior, but it only promises a final answer and metadata. It does not mention that this invokes the local Gemini CLI, that approvalMode governs file-mutating behavior with a default of auto_edit, or anything about side effects and execution constraints.
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 short and mostly front-loaded, but the opening 'AI-friendly task interface' sentence is filler that does not earn its place. The functional sentence is concise, so this is adequate but not exemplary.
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 tool with seven parameters, a rich output schema, and sibling tools, the description is too thin: it does not clarify when to use executeTask vs executePrompt/inspectGeminiCli, nor does it mention the underlying Gemini CLI execution model. The schema fills parameter details, but selection and invocation context remain incomplete.
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?
Schema coverage is 100%, so parameters are already documented in the schema. The description itself adds no parameter-level semantics beyond calling the input a 'task description,' which is sufficient only at baseline.
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 title and description establish a generic task-execution tool: it accepts a task description and returns a final answer plus execution metadata. This is clear enough to distinguish 'task execution' from mere inspection, but it does not explicitly distinguish executeTask from sibling executePrompt, so it falls one step short of a 5.
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?
No when-to-use guidance is present. The description never names alternatives like executePrompt or executeImageTask, nor does it state conditions that should route an agent to this tool rather than a sibling. This leaves tool selection to inference.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
inspectGeminiCliInspect Gemini CLIA
Lists the currently available Gemini CLI commands, extensions, skills, configured MCP servers, and an optional model-reported tool summary.
| Name | Required | Description | Default |
|---|---|---|---|
| timeoutMs | No | Optional timeout in milliseconds for each inspection command | |
| includeModelReportedTools | No | Whether to ask Gemini itself for a model-reported summary of currently active tools. |
Output Schema
| Name | Required | Description |
|---|---|---|
| raw | Yes | |
| notes | Yes | |
| skills | Yes | |
| version | Yes | |
| commands | Yes | |
| extensions | Yes | |
| mcpServers | Yes | |
| modelReportedTools | No | |
| modelReportedSummary | No |
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. 'Lists' suggests a read-only inspection behavior, but it does not explicitly state that nothing is modified, whether any commands are executed, or whether the optional model-reported summary incurs extra cost or latency. It is adequate but not fully transparent.
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, tight sentence that enumerates the output categories up front and wastes no words. It is easy to scan and immediately actionable.
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?
The output schema is present, no parameters are required, and the description clearly enumerates the returned information categories. It could note that timeoutMs applies to each inspection command or clarify the side-effect-free nature, but overall the information is sufficient for an agent to invoke the tool correctly.
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?
Schema description coverage is 100%; both parameters already have descriptive text in the schema. The tool description only adds a passing reference to the model-reported tool summary and does not meaningfully extend the parameter understanding beyond what the schema already provides.
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 states a specific verb ('Lists') and clearly identifies the resource scope: Gemini CLI commands, extensions, skills, configured MCP servers, and an optional model-reported tool summary. This fully distinguishes it from the execute* sibling tools, which focus on running tasks.
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 implies that this tool is for inspection rather than execution, but it never explicitly says when to choose it over the sibling tools or lists any exclusion conditions. An agent would have to infer the intended usage from the verb and resource enumeration.
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.
4 tool updates
v1.0.1- First observed
executeImageTask - First observed
executePrompt - First observed
executeTask - First observed
inspectGeminiCli
TDQS
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
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
Operate Linux, macOS and Windows from your LLM. Every action runs through an auditable allowlist.
Source-checked CLI guides and model-aware planning for Claude Code, Codex, and Grok Build.
Proxy Gemini (Vertex AI) completions wrapped in OpenTelemetry trace spans; returns the answer plus t
Provides capabilities that let LLM agents perform a range of infrastructure management tasks.
Related MCP Servers
- AlicenseNot gradedqualityCmaintenanceProvides 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 gradedqualityCmaintenanceWraps Google's Gemini CLI to expose search, chat, and file analysis tools via the Model Context Protocol for AI assistants.107101MIT
- AlicenseNot gradedqualityFmaintenanceBridges Google's Gemini CLI to MCP-compatible AI assistants, enabling prompt execution, model listing, and raw CLI commands.131GPL 3.0
- AlicenseAqualityDmaintenanceIntegrates the local gemini CLI tool with Claude Code, allowing Claude to execute Gemini AI queries via the MCP protocol.1131MIT
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/cainmaila/gemini-cli-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server