Skip to main content
Glama
cainmaila

gemini-cli-mcp

by cainmaila

πŸ€– Gemini CLI MCP Server

Seamless AI-to-AI Delegation via Local Gemini CLI

npm version License: MIT Node.js Version

English Β· 繁體中文


🌟 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 executeTask for direct answers, or drop down to executePrompt for precise control.

  • 🎨 Native Image Generation: Harnesses your local nanobanana extension 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-mcp

The 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-mcp

Client 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

GEMINI_CLI_PATH

Path to the Gemini executable

gemini

GEMINI_PROMPT_FLAG

The flag used for passing prompts

-p

GEMINI_MODEL_FLAG

The flag used to specify the model

--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 tools
executeImageTaskExecute Image TaskA

Uses the nanobanana extension to generate images and returns saved image paths plus execution metadata.

ParametersJSON Schema
NameRequiredDescriptionDefault
cwdNoOptional working directory for generated image output
countNoOptional number of images to generate
promptYesImage generation prompt for the nanobanana extension
stylesNoOptional style names passed to nanobanana
timeoutMsNoOptional timeout in milliseconds
variationsNoOptional variation names passed to nanobanana
approvalModeNoOptional Gemini CLI approval mode. Defaults to yolo for nanobanana.

Output Schema

ParametersJSON Schema
NameRequiredDescription
okYes
argsYes
signalYes
stderrYes
stdoutYes
abortedYes
commandYes
exitCodeYes
timedOutYes
elapsedMsYes
imagePathsYes
errorMessageNo
responseTextYes
primaryImagePathNo
workingDirectoryNo
effectiveApprovalModeNo

TDQS

A3.7/5.0
Behavior3/5

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.

Conciseness5/5

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.

Completeness3/5

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.

Parameters3/5

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.

Purpose5/5

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.

Usage Guidelines3/5

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.

ParametersJSON Schema
NameRequiredDescriptionDefault
cwdNoOptional working directory for the Gemini CLI process
modelNoOptional Gemini model name
promptYesPrompt to send to the local Gemini CLI
timeoutMsNoOptional timeout in milliseconds
approvalModeNoOptional Gemini CLI approval mode

Output Schema

ParametersJSON Schema
NameRequiredDescription
okYes
argsYes
signalYes
stderrYes
stdoutYes
abortedYes
commandYes
exitCodeYes
timedOutYes
elapsedMsYes
finalTextYes
errorMessageNo
workingDirectoryNo
effectiveApprovalModeNo

TDQS

B3.2/5.0
Behavior2/5

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.

Conciseness5/5

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.

Completeness2/5

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.

Parameters3/5

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.

Purpose5/5

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.

Usage Guidelines2/5

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.

ParametersJSON Schema
NameRequiredDescriptionDefault
cwdNoOptional working directory for the Gemini CLI process
taskYesTask to delegate to the local Gemini CLI
modelNoOptional Gemini model name
contextNoOptional task context for Gemini
timeoutMsNoOptional timeout in milliseconds
approvalModeNoOptional Gemini CLI approval mode. If omitted, file-mutating tasks default to auto_edit.
expectedOutputNoOptional instructions describing the desired final answer format

Output Schema

ParametersJSON Schema
NameRequiredDescription
okYes
argsYes
answerYes
signalYes
stderrYes
stdoutYes
abortedYes
commandYes
exitCodeYes
timedOutYes
elapsedMsYes
errorMessageNo
workingDirectoryNo
effectiveApprovalModeNo

TDQS

C2.8/5.0
Behavior2/5

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.

Conciseness3/5

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.

Completeness2/5

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.

Parameters3/5

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.

Purpose4/5

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.

Usage Guidelines2/5

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.

ParametersJSON Schema
NameRequiredDescriptionDefault
timeoutMsNoOptional timeout in milliseconds for each inspection command
includeModelReportedToolsNoWhether to ask Gemini itself for a model-reported summary of currently active tools.

Output Schema

ParametersJSON Schema
NameRequiredDescription
rawYes
notesYes
skillsYes
versionYes
commandsYes
extensionsYes
mcpServersYes
modelReportedToolsNo
modelReportedSummaryNo

TDQS

A3.8/5.0
Behavior3/5

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.

Conciseness5/5

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.

Completeness4/5

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.

Parameters3/5

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.

Purpose5/5

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.

Usage Guidelines3/5

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.

  1. 4 tool updatesv1.0.1
    • First observedexecuteImageTask
    • First observedexecutePrompt
    • First observedexecuteTask
    • First observedinspectGeminiCli

TDQS

B3.4/5.0
Disambiguation2/5

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.

Naming Consistency4/5

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.

Tool Count5/5

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.

Completeness4/5

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

ActivityInactive
ResponsivenessNo issues

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

Related MCP Servers

  • A
    license
    Not graded
    quality
    C
    maintenance
    Provides 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.
    3
    MIT
  • A
    license
    Not graded
    quality
    C
    maintenance
    Wraps Google's Gemini CLI to expose search, chat, and file analysis tools via the Model Context Protocol for AI assistants.
    107
    101
    MIT

Latest Blog Posts

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