gemini-cli-mcp
Server Configuration
Describes the environment variables required to run the server.
| Name | Required | Description | Default |
|---|---|---|---|
| GEMINI_BINARY | No | Explicit path to the gemini binary. When set, auto-discovery is skipped entirely. Useful when gemini is installed via nvm/fnm and not on the PATH that MCP servers see. | |
| GEMINI_MODELS | No | Comma-separated model IDs to override the default curated list exposed by the gemini://models resource. | |
| GEMINI_JOB_GC_MS | No | Job garbage-collection interval (ms). | 60000 |
| GEMINI_POOL_SIZE | No | Number of pre-spawned warm processes per server. | 1 |
| GEMINI_JOB_TTL_MS | No | How long completed/failed/cancelled jobs are retained (ms). | 300000 |
| GEMINI_SESSION_DB | No | SQLite path. :memory: = ephemeral. | ~/.gemini-cli-mcp/sessions.db |
| GEMINI_MAX_RETRIES | No | Auto-retries on empty-stdout/429/ETIMEDOUT. 0 = disabled. | 3 |
| GEMINI_CACHE_TTL_MS | No | Response cache TTL (ms). 0 = disabled. | 300000 |
| GEMINI_POOL_ENABLED | No | 0 = disable warm pool (cold spawn only). | 1 |
| GEMINI_ORPHAN_REAPER | No | 0 = disable the startup sweep that reaps orphaned gemini --yolo --output-format stream-json workers belonging to the current user. POSIX-only. | 1 |
| GEMINI_POOL_MIN_SIZE | No | Floor the pool can shrink to during idle eviction. Must be ≤ GEMINI_POOL_SIZE. | 0 |
| GEMINI_RETRY_BASE_MS | No | Base delay for exponential backoff (doubles each retry). | 1000 |
| GEMINI_MAX_CONCURRENT | No | Max parallel Gemini subprocesses. | 2 |
| GEMINI_SKIP_DETECTION | No | 1 = skip CLI version/flag detection at startup (use hardcoded defaults). | 0 |
| GEMINI_POOL_STARTUP_MS | No | Estimated CLI startup time (ms). Prompt writes are delayed by this amount after spawn. | 12000 |
| GEMINI_STRUCTURED_LOGS | No | 1 = emit one JSON telemetry line to stderr per request. | 0 |
| GEMINI_QUEUE_TIMEOUT_MS | No | Max wait for a concurrency slot (ms). | 60000 |
| GEMINI_CACHE_MAX_ENTRIES | No | Max entries in the response cache. | 50 |
| GEMINI_DISABLE_PDEATHSIG | No | 1 = skip the setpriv --pdeathsig TERM wrapper around child spawns (Linux only). Only the literal string "1" disables. | 0 |
| GEMINI_MAX_HISTORY_TURNS | No | Session history window (turn-pairs). 0 = unlimited. | 20 |
| GEMINI_POOL_IDLE_TIMEOUT_MS | No | Time of no acquire() calls after which the pool shrinks to GEMINI_POOL_MIN_SIZE. 0 disables eviction. | 300000 |
Instructions
Guidance the server publishes about itself, which clients place ahead of the tool catalog so the model reads it before choosing anything.
This server publishes no instructions, or was last inspected before Glama recorded them.
Capabilities
Features and capabilities supported by this server
Protocol revision2025-11-25
| Capability | Details |
|---|---|
| tools | {} |
| logging | {} |
| prompts | {} |
| resources | {
"listChanged": true
} |
Tools
Functions exposed to the LLM to take actions
| Name | Description |
|---|---|
| ask-geminiA | Start a new conversation with Gemini. If the MCP client supports progress notifications (progressToken present), blocks and streams partial responses as notifications/progress events, then returns the final response inline. Otherwise returns immediately with { jobId, sessionId }; poll with gemini-poll or cancel with gemini-cancel. |
| gemini-replyA | Continue an existing Gemini conversation. If the MCP client supports progress notifications (progressToken present), blocks and streams partial responses as notifications/progress events, then returns the final response inline. Otherwise returns immediately with { jobId }; poll with gemini-poll. Includes history truncation metadata when older turns are omitted. Throws if the session has a pending job. |
| gemini-pollA | Poll the status of an async Gemini job started by ask-gemini or gemini-reply. Returns status, partial response (while pending), or the full response (when done). Recommended poll interval: 2000ms. Jobs typically complete in 16–20s. |
| gemini-cancelA | Cancel an in-flight Gemini job. Sends SIGTERM to the subprocess. Idempotent: if the job is already done, returns { cancelled: false, alreadyDone: true }. |
| gemini-healthA | Return runtime diagnostics: binary path, env overrides, pool/semaphore concurrency and pool errors, job totals with per-status counts, session count, server uptime, CLI version/flag detection status, and active flag adaptations. |
| gemini-sessionsA | List or export Gemini sessions. If sessionId is omitted, returns the list of active sessions (id, lastAccessed, turnCount, expiresAt). If sessionId is provided, returns the full conversation history (turns + pre-rendered content) in the requested format. |
| gemini-batchA | Run multiple independent prompts in parallel, leveraging the existing concurrency infrastructure (semaphore + warm pool). Useful for parallel code review, multi-file analysis, and test generation — replacing N sequential ask-gemini calls with a single request. Returns all results when complete (wait: true, default) or job IDs for polling (wait: false). Individual failures are isolated: other items still complete successfully. |
| gemini-researchA | Run a research-oriented Gemini query. Supports quick, standard, and deep investigation modes. By default (wait: true), blocks and returns the full answer inline; with wait: false, returns a jobId for polling. |
Prompts
Interactive templates invoked by user choice
| Name | Description |
|---|---|
| code-review | Review code files for issues. Pass file paths/globs as `files`, optionally narrow with `focus`. |
| architecture-analysis | Analyse the architecture of a codebase directory. Optionally answer a specific architectural question. |
| explain-code | Explain how a source file works, optionally scoped to a single symbol and tailored to an audience level. |
| debug-error | Debug an error message or stack trace. Optionally supply relevant source files and context. |
Resources
Contextual data attached and managed by the client
| Name | Description |
|---|---|
| Server Health | Runtime diagnostics: binary path, pool/semaphore concurrency, active jobs, session count, and server uptime. |
| Sessions List | All active sessions with id, lastAccessed timestamp, and turn count. |
| Pending Jobs | All currently pending jobs with id and createdAt timestamp. |
| Gemini Models | Curated list of Gemini models with tier, description, and notes. Honors the GEMINI_MODELS env var (comma-separated IDs) as an override. |
TDQS
Scored across 8 tools
Each tool maps to a distinct operation in the async job/session lifecycle (start, reply, poll, cancel), with batch and research as clearly described variants. The main risk is ask-gemini vs gemini-research, since 'research-oriented query' reads like ask-gemini with a deeper mode, which could cause misselection. Overall boundaries are mostly clear thanks to the descriptions.
Seven tools follow a predictable gemini-<action> prefix pattern, making the set easy to scan. The single outlier ask-gemini reverses the convention, and a few suffixes are nouns (gemini-health, gemini-sessions) rather than verbs, but the pattern remains readable.
Eight tools are well-scoped for a Gemini CLI wrapper: one per lifecycle stage (start, reply, poll, cancel), plus batch, research, sessions, and health. Nothing feels redundant or missing at this count.
The full async lifecycle is covered, including start, continue, poll, cancel, plus batch parallelism, session listing/export, and runtime diagnostics. Minor gaps like session cleanup/deletion or model/config selection are workarounds an agent could handle, but the surface is close to complete.