LLM CLI Gateway MCP Server
One MCP endpoint for Claude Code, Codex, Gemini, Grok and Mistral CLIs, with durable async jobs.
LLM CLI Gateway scores 70 (Good), licensed MIT and written in TypeScript. It installs as a local process. It declares 10 tools. Filed under AI and memory. GitHub shows 19 stars. Package registries report about 319 downloads a week. Install configs are generated for 10 clients. Being listed in the registry is not the same as being vendor-official.
Good trust
70 of 100 from six public signals. Nobody can buy a point.
- Listed in the official MCP registry.
- OSI-style license: mit.
License, quality and maintenance
Quality: Grade A
90/100 for listing completeness. Lost points: short summary, no docs link.
How quality is graded
Where the 70 comes from
22 + 20 + 4 + 10 + 4 + 10 = 70. Each factor is capped, so no single signal can carry a listing.
Active in the official MCP registry, plus a known vendor namespace.
Registry: 22 of 30 points.How recently the repository saw a commit or release.
Maintenance: 20 of 20 points.GitHub stars and weekly downloads, on a log scale.
Popularity: 4 of 20 points.A clear, OSI-style open-source license.
License: 10 of 10 points.Not archived, a secure install path, a pinned version.
Security: 4 of 10 points.A real summary, a README with depth, listed tools.
Docs: 10 of 10 points.Install
Pick your client, copy the config, paste it in.
Needs Cursor or VS Code installed on this device. The button opens the app and asks you to confirm before it adds the server.
{ "mcpServers": { "verivus-oss-llm-cli-gateway": { "command": "npx", "args": [ "-y", "llm-cli-gateway@1.17.1" ] } }}
Environment variables
This server does not declare environment variables.
Tools10Tool docs quality grade D
All capabilitiesask_modeltoolask one provider through the simplified surface.
consensus_checktoolcheck whether providers agree with a claim.
list the models each provider CLI exposes through the simplified surface.
mcpServerstoolRequested/enabled/missing MCP servers for this call
red_team_reviewtoolchallenge a plan, answer, or document for risks and failure modes.
review_changestoolcapture one complete Git review artifact, fence repository
second_opiniontoolask one provider to review an answer.
run an explicit judge model after provider results have
ask two or more providers to independently validate a question.
retrieve the canonically hashed immutable receipt of a terminal cross-LLM validation run by validationId (returns minted | pending | verificationfailed | expiredunminted | notfound, own-or-not-found). verificationfailed means a st
About
llm-cli-gateway
"Without consultation, plans are frustrated, but with many counselors they succeed." — Proverbs 15:22 (LSB)
Secure local control plane for AI coding agents.
llm-cli-gateway lets supported MCP clients operate Claude Code, Codex, Gemini/Antigravity, Grok Build, Mistral Vibe, Cognition Devin, Cursor Agent, and configured HTTP API providers through one user-owned gateway while preserving native CLI sessions, local credentials, durable async jobs, validation receipts, and review workflows.
Why developers try it: use the client you are already in to delegate work to local coding agents, scope remote execution to registered workspaces, gate risky actions, survive disconnects, and collect auditable review evidence without turning those agents into a generic chat proxy.
Current signals: CI and security workflows pass on main, OpenSSF Scorecard is published, OpenSSF Best Practices is passing, releases use Sigstore signing, and the package is MIT licensed.
Quick Start
npm install -g llm-cli-gateway
Or use directly with npx from an MCP client:
{
"mcpServers": {
"llm-gateway": {
"command": "npx",
"args": ["-y", "llm-cli-gateway"]
}
}
}
What It Provides Today
llm-cli-gateway is a single-user MCP control plane for operating AI coding agents from supported local or remote clients. It is more than a thin CLI wrapper:
- Runs registered provider CLIs and configured HTTP API providers through consistent sync and async MCP tools.
- Persists long-running jobs, supports restart-safe result collection, deduplication, cancellation, and sync-to-async deferral.
- Tracks sessions, real CLI resume paths, structured response metadata, and cache telemetry.
- Supports cache-aware
promptParts, including explicit Claudecache_controlwhen opted in. - Can run supported provider requests inside gateway-managed git worktrees for isolated multi-agent review and implementation loops with either the local file-backed or PostgreSQL session manager. Session-bound reuse and cleanup remain limited to the host that owns the filesystem artifact, even when PostgreSQL shares the session row across hosts. After session deletion,
session_clear_all, or file-backed TTL eviction, both session managers retain a failed cleanup for retry by the host that owns the worktree. Deletion processed from another host removes no worktree and leaves that record intact. The database-sidecleanup_expired_sessionsfunction stages the same record instead of deleting a worktree-bearing session; it invokes no gateway observer and so attempts no removal itself. Grok, Devin, and Mistral require an explicit provider-nativesessionIdfor a gateway worktree; fresh,createNewSession, andresumeLatest-only worktree requests fail closed because they cannot durably reselect it. Materialization suppresses repository, system, and global Git hooks, configured clean, smudge, and process checkout filters, sparse checkout, and lazy object fetching. Filter-dependent content such as Git LFS remains in its repository representation instead of executing host commands. - Ships personal-appliance setup surfaces: HTTP transport with bearer-token auth,
doctor --json, setup UI artifacts, provider setup snippets, Docker fallback, and checked release bundles. - Remote web connectors use MCP OAuth discovery and authorization-code setup with static client or shared-secret gates. Client secrets are generated locally, stored only as hashes, and printed only by explicit copy-once commands.
- Provider CLI requests can select registered workspaces by alias via
workspace; every HTTP/tunnel request must use a registered alias, session workspace, or[workspaces].defaultbefore provider execution. Local unrestricted filesystem access is the stdio transport.
Workflow Assets
The repo ships agent-ready workflow skills under .agents/skills for async orchestration, session continuity, multi-LLM review, implement-review-fix loops, retrospective evidence walks, secure approval-gated dispatch, and Personal Agent Config Kit operations. Nine caller-facing skills are bundled in the published npm package: async-job-orchestration, multi-llm-review, session-workflow, secure-orchestration, implement-review-fix, retrospective-walk, public-demo-session, least-cost-routing, and personal-agent-config-kit. Machine-readable DAG-TOML plans live under docs/plans and setup/install-plan.dag.toml for workflows that need deterministic sequencing and verification gates.
Skill packs can be updated outside the core npm release by placing skill
directories in local, operator-controlled paths. The gateway loads bundled
skills first, then [skills].paths, then LLM_GATEWAY_SKILLS_PATH, then
~/.llm-cli-gateway/skills when it exists; later roots override earlier skills
by name. Each skill is a directory containing SKILL.md. A root may also carry
skill-pack.json to pin expected SKILL.md hashes:
[skills]
paths = ["/opt/llm-cli-gateway/skills"]
export LLM_GATEWAY_SKILLS_PATH="/opt/team-skill-pack:/opt/incident-skill-pack"
{
"name": "team-pack",
"version": "1.0.0",
"skills": [
{
"name": "incident-retrospective",
"sha256": "<sha256 of incident-retrospective/SKILL.md>"
}
]
}
The loader is intentionally local-only: it never fetches remote Markdown at
startup. To update a pack, install or replace files through your package manager
or deployment system, then restart the gateway so the advertised skills://...
resources refresh.
The next documentation focus is provider-specific skill and DAG-TOML pairs for each outbound CLI and API-provider family: Claude, Codex, Gemini/Antigravity, Grok, Mistral Vibe, Devin, Cursor Agent, OpenAI-compatible endpoints, Anthropic Messages, and xAI Responses. The implementation plan is tracked in docs/plans/provider-workflow-assets.dag.toml, with each provider asset expected to cover install/login checks or token-env checks, session behavior, approval modes, cache/telemetry surfaces, failure modes, and a smoke-test gate.
Trust & Supply Chain
- CI runs build, lint, format, tests, package checks, and npm audit.
- Security CI runs actionlint, zizmor, shellcheck, typos, osv-scanner, gitleaks, and lychee.
- GitHub release installer artifacts are checksummed and signed with Sigstore keyless signing.
- npm releases use a generated prod-only shrinkwrap and release security audit; GitHub Actions Trusted Publishing exchanges the job's OIDC identity for short-lived npm publish credentials.
- The npm package intentionally ships a generated, prod-only
npm-shrinkwrap.jsonso registry installs resolve the audited release tree. Release gates regenerate it frompackage-lock.json, compare for parity, and run a registry-fidelity consumer install before publishing. - Socket behavioural alerts are documented in
socket.ymland under "Security Considerations" below.shellAccessandshrinkwrapare reviewed package capabilities/configuration for this CLI appliance, not hidden install behaviour.
Personal MCP Appliance
The personal-appliance contract keeps that surface intentionally narrow: one trusted user runs the gateway on a machine or volume they own, connects one MCP endpoint, and lets supported clients operate local coding agents through workspace-scoped, approval-gated, auditable requests.
The product contract is documented in docs/personal-mcp/PRODUCT_CONTRACT.md. It defines the single-user scope, security posture, target support matrix, and provider-support verification gates. Public setup guides must not claim ChatGPT, Claude web, Claude Desktop, Codex, Gemini CLI, Gemini web, or Grok inbound support until the corresponding provider/client path has been verified.
This project does not provide hosted multi-tenant credential custody. Provider credentials stay on the user's machine or user-owned deployment volume.
For a single developer who works on several workstations and repositories, the Personal Agent Config Kit guide explains the Git-synchronised personal baseline, repository overlays, immutable context stamps, and workstation-safe provider continuity model. The baseline directory is confined to a non-symlinked descendant of the local home directory, and every publish or sync revalidates its configured origin fetch and push URLs against the HTTPS/SSH-only policy. The Kit is intentionally local-caller-only; Kit provider execution and recovery of an unadmitted attempt require healthy durable SQLite or PostgreSQL async-job admission. Kit mode supports Claude, Codex, and Mistral; every other provider fails closed while it is enabled. Kit scope never inherits the gateway process cwd: Claude and Mistral require a registered workspace selection or configured default, while Codex can also use an explicit absolute workingDir. Relative Kit workingDir values are rejected before filesystem or Git inspection. It disables cross-model validation tools while enabled and is not an HTTP/OAuth configuration or remote execution feature.
For a retention-pinned non-Kit Claude MCP request configuration, follow the local-only same-host recovery procedure. It accepts no SQL or arbitrary-path override. A valid recovery invocation emits JSON and exits 0 after success or 2 for a safe refusal; invalid usage or unavailable durable storage exits 1.
Release-readiness history is tracked in docs/personal-mcp/RELEASE_READINESS.md. Dogfooding evidence (which target LLMs guided setup, what unsafe suggestions were captured, and which findings were deferred from the initial personal-appliance rollout) is in docs/personal-mcp/DOGFOODING_RESULTS.md.
Current personal-appliance artifacts include:
- Streamable HTTP startup:
LLM_GATEWAY_AUTH_TOKEN=<token> npm run start:http - Machine-readable diagnostics:
npm run doctor - Go bootstrapper:
installer/withsetup,doctor --json,start,stop,status,repair,upgrade,uninstall,print-client-config, and verified bundle download commands. - Release packaging: on the public mirror, the release workflow builds Linux binaries on GitHub-hosted
ubuntu-latestand builds Windows/macOS binaries on their GitHub-hosted platform runners. The private upstream uses its internal self-hosted Linux runner. Each release publishes checksummed platform bundles with the gateway, production dependencies, and a managed Node runtime; see installer/packaging/README.md. - Docker Compose fallback: docker/personal.compose.yml + docker/Dockerfile.personal for users who already manage containers.
- Local setup UI artifact: setup/ui/index.html
- Provider setup snippets: setup/providers/
- Cross-validation tools:
review_changes,validate_with_models,second_opinion,compare_answers,red_team_review,consensus_check,ask_model,synthesize_validation,job_status,job_result, andvalidation_receipt(plus thevalidation-receipt://{validationId}resource).review_changesand durable receipts require a SQLite or PostgreSQL validation-run store and are absent in Personal Agent Config Kit mode.
Install / Upgrade / Uninstall (single binary)
Windows PowerShell:
$Version = '<version>'
$Base = "https://github.com/verivus-oss/llm-cli-gateway/releases/download/v$Version"
$InstallDir = Join-Path (Join-Path $env:LOCALAPPDATA 'Programs') 'llm-cli-gateway'
$ExeName = "llm-cli-gateway-$Version-windows-amd64.exe"
$BundleName = "llm-cli-gateway-bundle-$Version-windows-amd64.tar.gz"
$Exe = Join-Path $InstallDir 'llm-cli-gateway.exe'
$Checksums = Join-Path $InstallDir 'SHA256SUMS'
$ChecksumBundle = Join-Path $InstallDir 'SHA256SUMS.sigstore.json'
New-Item -ItemType Directory -Force $InstallDir | Out-Null
Invoke-WebRequest -UseBasicParsing "$Base/$ExeName" -OutFile $Exe
Invoke-WebRequest -UseBasicParsing "$Base/SHA256SUMS" -OutFile $Checksums
Invoke-WebRequest -UseBasicParsing "$Base/SHA256SUMS.sigstore.json" -OutFile $ChecksumBundle
cosign verify-blob $Checksums --bundle $ChecksumBundle --certificate-identity "https://github.com/verivus-oss/llm-cli-gateway/.github/workflows/release-installer.yml@refs/tags/v$Version" --certificate-oidc-issuer "https://token.actions.githubusercontent.com"
if ($LASTEXITCODE -ne 0) { throw "Sigstore verification failed for SHA256SUMS" }
function Get-ReleaseSha256($Name) {
$line = Select-String -Path $Checksums -Pattern "^[a-fA-F0-9]{64}\s+$([regex]::Escape($Name))$" | Select-Object -First 1
if (-not $line) { throw "No SHA256SUMS entry found for $Name" }
return (($line.Line -split "\s+")[0]).ToLowerInvariant()
}
if ((Get-FileHash $Exe -Algorithm SHA256).Hash.ToLowerInvariant() -ne (Get-ReleaseSha256 $ExeName)) { throw "Checksum mismatch for $ExeName" }
$env:RVWR_GATEWAY_BUNDLE_URL = "$Base/$BundleName"
$env:RVWR_GATEWAY_BUNDLE_SHA256 = Get-ReleaseSha256 $BundleName
& $Exe setup
& $Exe stop
& $Exe install-bundle
& $Exe start
& $Exe status
& $Exe doctor
The Windows installer keeps a stable llm-cli-gateway.exe command in
%LOCALAPPDATA%\Programs\llm-cli-gateway and adds that directory to the user
PATH. Do not script against release-versioned exe names after install.
# After downloading the binary that matches your OS/arch from a release:
cosign verify-blob SHA256SUMS --bundle SHA256SUMS.sigstore.json \
--certificate-identity "https://github.com/verivus-oss/llm-cli-gateway/.github/workflows/release-installer.yml@refs/tags/v<version>" \
--certificate-oidc-issuer "https://token.actions.githubusercontent.com"
sha256sum --check SHA256SUMS # verify before run (or `shasum -a 256 --check` on macOS)
chmod +x llm-cli-gateway-<ver>-<os>-<arch>
./llm-cli-gateway-<ver>-<os>-<arch> setup
./llm-cli-gateway-<ver>-<os>-<arch> install-bundle # uses the platform bundle URL/SHA256
./llm-cli-gateway-<ver>-<os>-<arch> start
./llm-cli-gateway-<ver>-<os>-<arch> doctor
# Upgrade: replace the binary, set the new bundle env vars, run upgrade.
./llm-cli-gateway-<new>-<os>-<arch> upgrade
# Uninstall: dry-run first, then run with --yes.
./llm-cli-gateway-<ver>-<os>-<arch> uninstall
./llm-cli-gateway-<ver>-<os>-<arch> uninstall --yes
Docker fallback:
LLM_GATEWAY_AUTH_TOKEN=$(openssl rand -hex 32) \
docker compose -f docker/personal.compose.yml up -d
docker compose -f docker/personal.compose.yml run --rm doctor
Features
Core Capabilities
- Multi-LLM Orchestration: Unified interface for Claude Code, Codex, Gemini, Grok, Mistral (Vibe), Devin, and Cursor Agent CLIs
- Session Management: Track gateway session metadata and provider-specific continuity with persistent storage
- Gateway-owned worktrees: Run supported sync or async provider requests inside a managed git worktree with either the local file-backed or PostgreSQL session manager. Same-session reuse requires same-host durable ownership plus a matching live Git registration and gateway branch; manager-level named path collisions fail closed. A shared PostgreSQL session row does not transfer ownership of its filesystem-local worktree to another host. Grok, Devin, and Mistral require an explicit provider-native
sessionId; fresh,createNewSession, andresumeLatest-only worktree requests fail closed. A worktree requires a registered workspace selected explicitly, through caller-owned session metadata, or by the configured default; it never inherits process cwd or combines withworkingDir,addDir, orincludeDirs. Materialization suppresses repository, system, and global Git hooks, configured clean, smudge, and process checkout filters, sparse checkout, and lazy object fetching. Filter-dependent content such as Git LFS remains in its repository representation instead of executing host commands. Session deletion,session_clear_all, and file-backed TTL eviction hide a durably owned worktree session while cleanup runs, under either session manager. If Git removal fails, the manager retains a durable cleanup-pending tombstone, blocks reuse, and retries cleanup when a manager is registered on the owning host. The record is finalized only once Git no longer registers the worktree, read back rather than inferred from the recorded path being absent: a worktree that was moved, or whose owner marker cannot be read, is not a removal. Deletion processed by a different host removes no worktree and leaves the owning host's record intact. The database-sidecleanup_expired_sessionsfunction stages the same tombstone instead of deleting a worktree-bearing session; it invokes no gateway observer and so attempts no removal itself. A tombstone is not bounded by retention. - Token Optimization: opt-in prompt/response compaction via
optimizePrompt/optimizeResponse, both defaulting to false. The 44% / 37% figures are v1.0.0 measurements on a specific corpus, not a guarantee:src/optimizer.tsis a deterministic phrase-stripper, and nothing measures a ratio at runtime. - Correlation ID Tracking: Full request tracing across all LLM interactions
- Cross-Tool Collaboration: LLMs can use each other via MCP (validated through dogfooding)
Observability
- Durable Flight Recorder: Provider requests and responses follow
[persistence].backend: SQLite writes to~/.llm-cli-gateway/logs.dbby default, while PostgreSQL writes them to the configured database with the other durable subsystems. A PostgreSQL failure leaves the recorder unavailable or degraded and is reported generically on health surfaces; it never falls back to SQLite. Existing rows are not migrated or dual-read when the backend changes. Records include correlation IDs, duration, and token usage where the provider emits it (today: claude onstream-json/json, codex, and the API providers; grok, gemini, mistral, devin and cursor emit no usage on their CLI wire). Two exclusions are worth knowing: cross-LLM validation seats write no flight-recorder row at all, sollm_request_resultcannot read one back by correlation ID, and repository-review seats are additionally excluded by design so review evidence is not retained in a non-expiring table. Theretry_countandcircuit_breaker_statecolumns are constants on the async path, which is the production path; retry and circuit breaking apply only to the direct-execute fallback. Read history throughllm_request_listandllm_request_resultso per-principal ownership checks remain in force. For human browsing of a SQLite deployment:datasette ~/.llm-cli-gateway/logs.db - Structured Metadata: Tool responses include machine-readable
structuredContent(model, cli, correlationId, sessionId, durationMs, token counts) - Cache observability resources:
cache-state://global,cache-state://session/{id}, andcache-state://prefix/{hash}MCP resources return aggregate cache hit/miss/savings — tokens and hashes only, no prompt text.session_getincludes acacheStateblock when the session has prior requests. - Provider capability inventory:
provider_tool_capabilitiesandprovider-tools://catalogexpose the gateway request fields, supported/degraded provider controls, local skill/tool discovery, and safe config-surface hints for Claude Code, Codex CLI, Gemini/Antigravity, Grok CLI/API, Mistral Vibe, Cognition Devin, and Cursor Agent.doctor --jsonincludes a compactprovider_capabilitiessummary for setup assistants.
Cache-aware operation
Every *_request and *_request_async tool except devin_request / devin_request_async and cursor_request / cursor_request_async accepts an optional promptParts field that structures the prompt for better cache hit rates (the Devin and Cursor headless paths take a plain prompt only). The gateway concatenates the parts in canonical order (system → tools → context → task) so that the stable prefix bytes precede the volatile task tail unchanged across calls, letting each provider's automatic prompt-caching land on the same content hash each time.
{
"promptParts": {
"system": "You are a helpful code reviewer.",
"tools": "You have access to Read, Grep, Bash.",
"context": "<long stable context block — file dumps, etc.>",
"task": "Review the changes in src/foo.ts for security issues."
}
}
prompt and promptParts are mutually exclusive — pass exactly one.
Per-CLI capability matrix (prefix discipline is automatic via promptParts for all providers except Devin and Cursor, which have no promptParts surface; explicit levers are provider-specific):
| CLI | Prefix discipline | Explicit lever(s) |
|---|---|---|
| claude | yes | promptParts.cacheControl + outputFormat: "stream-json" (Anthropic cache_control breakpoints on stable blocks; ttl="1h" forced) |
| codex | yes | none (OpenAI implicit) |
| gemini | yes | none (implicit server-side) |
| grok | yes | compactionMode / compactionDetail (context compaction: `summary |
| mistral | yes | none (implicit) |
| devin | no | plain prompt only |
| cursor | no | plain prompt only |
Claude example (explicit cacheControl)
claude_request({
promptParts: {
system: "You are a helpful code reviewer.",
context: "<long stable file dump>",
task: "Review the diff.",
cacheControl: { system: true, context: true }, // task is never marked
},
outputFormat: "stream-json",
});
Gateway emits the stream-json stdin path with cache_control: {type:"ephemeral", ttl:"1h"} on marked blocks only.
Grok example (compaction)
grok_request({
promptParts: { system: "...", context: "...", task: "..." },
compactionMode: "segments",
compactionDetail: "balanced",
});
Emits --compaction-mode segments --compaction-detail balanced.
See docs/personal-mcp/PROVIDER_CACHE_SURFACES.md for full surfaces, telemetry differences (e.g. Grok -p vs ACP), exact stream-json payload shapes, and cross-LLM review notes.
Opt-in flags (all default off) live under [cache_awareness] in ~/.llm-cli-gateway/config.toml.
Reliability & Performance
- Retry Logic: Exponential backoff with circuit breaker for transient failures
- Atomic File Writes: Process-specific temp files with fsync for data integrity
- Host-protection backpressure: bounded HTTP session lifecycle (max sessions + idle reaper), global and per-provider job-execution limits with a bounded FIFO queue, and a configurable per-job output cap (default 50MB). See Host-protection limits.
- NVM Path Caching: Eliminates I/O overhead on every request
- Long-Running Jobs: Non-time-bound async execution via
*_request_async+ polling tools
Security & Quality
- Comprehensive Testing: 1,700+ tests covering unit, integration, and regression scenarios with real CLI execution
- Input Validation: Zod schemas prevent injection attacks
- No Secret Leakage: Generic session descriptions only (file permissions 0o600)
- No ReDoS: Bounded regex patterns prevent catastrophic backtracking
- Type Safety: Strict TypeScript with comprehensive error handling
- Supply-chain hardening: a dedicated
.github/workflows/security.ymlruns actionlint, zizmor, shellcheck, typos, osv-scanner, gitleaks, and lychee on every push and PR (seeSECURITY.mdfor the threat model)
Provider capability surface
Every provider is reachable through the same request, session, job, and validation machinery, but the underlying CLIs differ in what they natively expose. The table records what actually shipped per provider; discover the live surface at runtime with provider_tool_capabilities, list_models, and the provider-acp://<provider> / provider-tools://<provider> resources.
| Provider | CLI request tools | Native ACP | Live model discovery | Admin surface |
|---|---|---|---|---|
Claude Code (claude) | claude_request / _async | None (CLI-first; no ACP entrypoint at its tracked version) | model aliases, reasoning-effort levels, fallback model | read-only via provider_admin_list / provider_admin_run |
OpenAI Codex (codex) | codex_request / _async, codex_fork_session | None (codex-cli advertises mcp-server / app-server transports, not native ACP) | codex debug models | read-only via provider_admin_list / provider_admin_run |
Gemini / Antigravity (gemini, agy) | gemini_request / _async | None (agy exposes no ACP entrypoint; legacy Gemini CLI ACP evidence does not transfer) | agy models | read-only via provider_admin_list / provider_admin_run |
xAI Grok (grok) | grok_request (sync transport: "acp") / _async | Native via grok agent stdio | grok models + ~/.grok/config.toml | read-only via provider_admin_list / provider_admin_run |
Mistral Vibe (mistral) | mistral_request (sync transport: "acp") / _async | Native via vibe-acp | Vibe config plus the VIBE_ACTIVE_MODEL active model and agent profiles | read-only via provider_admin_list / provider_admin_run |
Cognition Devin (devin) | devin_request (sync transport: "acp", agentType: summarizer|review) / _async | Native via devin acp | --model / DEVIN_MODEL | read-only via provider_admin_list / provider_admin_run |
Cursor Agent (cursor) | cursor_request (sync transport: "acp") / _async | Native via cursor-agent acp (companion-owned) | model aliases | read-only via provider_admin_list / provider_admin_run |
- Native ACP is reported honestly.
grok,mistral,devin, andcursorexpose a native ACP entrypoint, soprovider-acp://<provider>carries the negotiatedinitializecapability set and the derived session-method availability, and the sync*_requestacceptstransport: "acp"(fails closed unless[acp]and the provider'sruntime_enabledgate are set). ACP routing is sync-only: the*_request_asyncvariants always run the CLI transport and do not accepttransport: "acp"(nor Devin'sagentType); async ACP parity is a later phase. ACP workspace selection is gateway-owned: an explicit ACPworkspacemust be a registered alias. A fresh remote ACP request uses that alias or[workspaces].default; a remote resume is fixed to its recorded canonical alias and cwd, and a different or unbound workspace is rejected. Local ACP may omitworkspace; each unscoped process then gets a fresh private0o700neutral directory that is removed after the process exits, never a shared predictable temp path.claude,codex, andgeminihave no native ACP entrypoint at their target CLI versions; theirprovider-acp://records reportnative: falsewith no methods and no adapter-as-native masquerade, and they expose notransport: "acp"selector. - Managed approval is Claude-only today.
approvalStrategy:"mcp_managed"is executable only by the Claude CLI adapter, which launches Claude with a request-scoped generated MCP configuration and--strict-mcp-config. It permits only provisioned, gateway-owned MCP definitions and rejects dynamicnpx, ambient-PATH, and Codex-config overrides. Codex, Gemini, Grok, Mistral, Devin, and Cursor rejectmcp_managedbefore launching a provider because their current adapters cannot isolate ambient MCP configuration. For those adapters, useapprovalStrategy:"legacy";approvalPolicyhas no effect. - ACP has its own permission bridge.
approvalStrategy:"mcp_managed"and anyapprovalPolicyare rejected whentransport:"acp"is selected. Use the Claude CLI transport for managed approval. ACP host services fail closed, gated by the tool-call category the agent declares:writeis denied unlessallow_write_host_servicesis set,executeunlessallow_terminal_host_servicesis set, and any other category is denied outright, includingfetchand every unrecognised kind, so a new upstream tool kind cannot be auto-approved by default. Approval is expressed only by selecting an agent-offered single-use allow option; an agent that offers only a persistentallow_alwaysgrant is denied, so ACP never maps a raw CLI bypass input to a standing permission grant. Note the boundary is this category gate: it constrains what the agent may ask the gateway to do, not what the agent does in its own process. - Resources are generated from the provider registry for every CLI provider:
models://<provider>,sessions://<provider>,provider-acp://<provider>,provider-tools://<provider>, andprovider-subcommands://<provider>. - Model discovery is live and account-aware: the discovery listed above reaches
models://<provider>andlist_models, degrading to static registry facts when a live probe is unavailable (a resource read never spawns a CLI). - Admin surfaces are discovery-driven and output-redacted.
provider_admin_listandprovider_admin_runare read-only for every provider. State-mutating admin operations are exposed only throughprovider_admin_mutate, gated behind[admin] allow_mutating_cli_admin_ops, the remotecli:adminscope, an approval gate, and an audit record. Mutating ACP session operations are likewise gated behind[acp] allow_mutating_session_ops. - Validation commands work across every provider:
review_changes,validate_with_models,second_opinion,compare_answers,red_team_review,consensus_check,ask_model, andsynthesize_validation, with canonically hashed immutable receipts viavalidation_receiptand thevalidation-receipt://{validationId}resource.review_changescaptures a complete, hashed Git artifact and starts repository-bound read-only reviewers.
Prerequisites
Node.js >= 24.4.0 is required (engines.node in package.json). The SQLite backend uses Node's built-in node:sqlite module, so there is no native binding to compile and no install scripts run. The 24.4 floor is where allowBareNamedParameters defaults to true, which the SQLite persistence layer relies on.
Running the source-tree release audit also requires Bash and flock from
util-linux. This prerequisite was verified against commit
242e7669565ecc7c71183f5f7133791a1384ca7c. Release automation runs the audit
on Ubuntu. On macOS, install a compatible flock before running
npm run security:audit or the full npm run check gate.
Before using this gateway, you need to install the CLI tools you want to use:
Claude Code CLI
# Installation instructions for Claude Code
# Visit: https://docs.anthropic.com/claude-code
npm install -g @anthropic-ai/claude-code
Codex CLI
npm install -g @openai/codex
codex login
Gemini (Google Antigravity CLI)
The Gemini provider runs through Google Antigravity CLI (agy).
curl -fsSL https://antigravity.google/cli/install.sh | bash
# Docs: https://antigravity.google/docs
Grok Build CLI (xAI)
curl -fsSL https://x.ai/cli/install.sh | bash
grok login # OAuth flow; for headless auth, set XAI_API_KEY
# Docs: https://docs.x.ai/build/overview
Mistral Vibe CLI
# Pick one — the gateway's cli_upgrade auto-detects which one you used.
curl -LsSf https://mistral.ai/vibe/install.sh | bash
pip install mistral-vibe
uv tool install mistral-vibe
brew install mistral-vibe
vibe --setup
# Complete the API-key setup locally. Do not paste the key into a chat.
# Current Vibe defaults session logging to enabled. If an older config disabled it,
# edit ~/.vibe/config.toml and set:
# [session_logging]
# enabled = true
Vibe-specific notes:
- Model selection is via the
VIBE_ACTIVE_MODELenvironment variable — Vibe has no--modelflag. The gateway discovers~/.vibe/config.toml/VIBE_MODELS, injectsVIBE_ACTIVE_MODELonly when a model is explicitly requested or Vibe config needs recovery, and retries once after a model-not-found failure with refreshed discovery. permissionModeis the Vibe--agentname. Builtins aredefault | plan | accept-edits | auto-approve; Vibe also accepts install-gated builtins (e.g.lean) and custom agents from~/.vibe/agents. Requests pass the selected name through for Vibe to validate.mcp_managedis not available for Vibe.- Tool controls use Vibe's native flags. The gateway emits one
--enabled-tools <tool>flag perallowedToolsentry and one--disabled-tools <tool>flag perdisallowedToolsentry. Vibe applies disabled tools after enabled-tool filtering. - Usage telemetry is best-effort. Vibe does not emit token or cost data in
programmatic stdout. When the gateway knows Vibe's native session UUID, it
reads
~/.vibe/logs/session/session_<...>/meta.jsonfor usage and cost. A missing, malformed, or not-yet-known session log leaves those fields empty. - No self-update:
cli_upgrade --cli mistraldetects whether you used pip / uv / brew and dispatches the matching upgrade command. Runningvibe updateis not a thing.
Installation
As an MCP server (npm)
npm install -g llm-cli-gateway
Or use directly with npx:
{
"mcpServers": {
"llm-gateway": {
"command": "npx",
"args": ["-y", "llm-cli-gateway"]
}
}
}
From source
git clone https://github.com/verivus-oss/llm-cli-gateway.git
cd llm-cli-gateway
npm install
npm run build
Usage
As an MCP Server
For clients that already support local stdio MCP servers, add a configuration like:
{
"mcpServers": {
"llm-cli-gateway": {
"command": "node",
"args": ["/path/to/llm-cli-gateway/dist/index.js"]
}
}
}
Stdio is the recommended path for unrestricted machine-local development access. HTTP MCP, including localhost HTTP and tunneled HTTPS, is treated as remote-capable for provider execution: provider tools must resolve a registered workspace alias, a session workspace, or [workspaces].default before spawning a CLI. Remote clients should pass relative workingDir, addDir, and include-directory values inside the selected workspace, and may resume only gateway-tracked sessions they own. Raw native provider session IDs are local-only. Disabling auth or using a no-auth connector path is not a filesystem bypass.
For a local CLI request with no resolved workingDir, registered workspace,
or gateway-managed worktree, the child runs in a fresh private 0o700
temporary directory that is removed after the process exits. It never inherits
the gateway repository cwd or its provider-native instruction context. The
gateway canonicalizes the temp root and rejects or relocates it when any
ancestor contains .git, AGENTS.md, AGENTS.override.md, Agents.md,
AGENT.md, CLAUDE.md, Claude.md, CLAUDE.local.md,
.claude/CLAUDE.md, .claude/rules/, .cursor/rules/, .cursorrules,
GEMINI.md, or .vibe/config.toml, including through a symlinked or custom
TMPDIR beneath that context. The list covers entries a provider discovers by
walking up from its cwd. User-scope configuration such as
~/.claude/settings.json is deliberately absent: it loads on every invocation
regardless of cwd, so relocating the workspace would not isolate it.
Provider-native resumeLatest operations that use a cwd-scoped latest-session
pointer therefore require an explicit workingDir, workspace, or configured
default workspace and fail closed when none is available. Use explicit target
selection whenever several repositories are active at once.
CLI request schemas accept prompts up to 100,000 characters, but operating
systems also impose byte limits on individual argv elements. Codex new and
resume requests stream the exact prompt over stdin. codex_fork_session
remains argv-bound and rejects an oversized UTF-8 prompt before spawn as
non-retryable input_too_large. Other providers whose current CLI contracts
require an argv prompt use the same admission rule. Every other
caller-controlled argv value is checked on its final encoded form too,
including serialized agent/schema JSON, joined tool lists, instruction
overrides, paths, model names, and native session IDs. The final spawn boundary
checks every argv element plus the aggregate resolved command line against a
conservative platform-specific byte budget and a 2,048-element cap. The
aggregate byte budget excludes the environment but reserves headroom for it;
on Windows, pre-resolution admission assumes the smaller npm .cmd/.bat
wrapper limit until command resolution proves a native executable. Native
session and resume flags on non-Kit requests are included before workspace,
session, provider-artifact handoff, or durable job side effects. Claude Kit
projects its eventual argv before materializing its compiled context artifact
or allocating a durable Kit session.
An embedded NUL byte in the command or any argv element is rejected before
spawn as non-retryable invalid_input. Caller-facing results, long-lived job
memory, durable job args, and async flight rows use a fixed invalid-argv marker;
the optional duplicate durable payload is suppressed. None retains the rejected
vector or Node's value-echoing native error.
Native E2BIG, including an environment-driven failure, is normalized without
retaining the native spawnargs. The gateway never truncates instructions or
other values to make them fit. For stdin-backed requests, a clean provider exit
is accepted only after the complete payload write callback succeeds. A closed
or still-pending pipe becomes a fixed, non-sensitive incomplete-delivery
failure; timeout, cancellation, and provider nonzero exits remain authoritative.
This generic stdio example is not provider-support verification for the Personal MCP Appliance. Client-specific setup guides for ChatGPT, Claude web, Claude Desktop, Codex, Gemini CLI, Gemini web, and Grok remain gated by the provider-support matrix in docs/personal-mcp/PRODUCT_CONTRACT.md.
Available Tools
Cross-LLM Validation Tools
The personal-appliance surface exposes simplified validation tools for non-developer clients. These tools start provider CLI jobs through the durable async job manager and return normalized provider status plus raw job references.
validate_with_models: ask two or more providers to independently validate a question.review_changes: capture one complete Git review artifact, fence repository content as untrusted data, and start read-only independent reviewers. See Repository change review.second_opinion: ask one provider to review an answer.red_team_review: challenge a plan, answer, or document for risks and failure modes.consensus_check: check whether providers agree with a claim.ask_model: ask one provider through the simplified surface.synthesize_validation: run an explicit judge model after provider results have been collected. General validation requires the caller's question and terminal normalized results. Areview_changesrun instead reloads its exact owned durable results fromvalidationId; caller-supplied question/results are ignored.list_available_models: list the models each provider CLI exposes through the simplified surface.job_statusandjob_result: poll and collect validation job outputs.validation_receipt: retrieve the canonically hashed immutable receipt of a terminal cross-LLM validation run byvalidationId(returnsminted | pending | verification_failed | expired_unminted | not_found, own-or-not-found).verification_failedmeans a stored receipt exists but disagrees with its durable run, which is a defect to investigate;expired_unmintedonly ever means absence.format: "markdown"renders a human-readable report;includeRawResponsesinlines complete provider answer text when the linked job still exposes identity-verified output. Registered only when the attached job store provides the durable validation-run store capability (sqliteandpostgres).
The same receipt is also exposed as the validation-receipt://{validationId} MCP resource (same durable gate and own-or-not-found owner scoping).
The validation report preserves per-provider disagreement. Optional judge synthesis is explicit about which provider produced the judge job.
Repository change review
review_changes accepts an absolute local workingDir or a registered
workspace, then resolves scope: "auto" | "uncommitted" | "branch" | "commit". It can take an explicit Git base, literal repository-relative
paths, stance: "standard" | "adversarial", reviewer models, an optional
judgeModel, trustCursorWorkspace, and fail-closed artifact/prompt byte
ceilings.
Cursor refuses to review a directory it does not trust, so a cursor seat is
granted --trust only when the reviewed directory is a registered
[[workspaces.repos]] path whose providers include cursor (a gateway worktree
beneath one counts, and the nearest enclosing registration decides). On any
other directory the cursor seat is skipped with an actionable reason, and the
rest of the roster still runs. trustCursorWorkspace: true accepts the grant
for one durable review run. The consent applies to Cursor seats in that run's
reviewer roster and to its planned Cursor judge when synthesize_validation
launches it later. It is bound to the run owner, repository, and planned judge,
so another principal or review run cannot replay it. That is a real decision
rather than a formality: a trusted folder is also where cursor loads project
rules and AGENTS.md, so the repository under review gains some influence over
its own reviewer, which the fenced review prompt otherwise forbids. The artifact keeps
committed, staged, unstaged, and regular non-ignored untracked file evidence separate. It
forces tracked diffs to remain readable even when in-tree attributes mark them
as non-diffable. The review-evidence.v2 artifact exposes committedPatch,
stagedPatch, and unstagedPatch independently; each segment carries its
sorted path inventory, encoding, exact byte length, SHA-256 identity, and
content. This prevents an index change and its worktree-only reversal from
canceling out. The artifact is collision-fenced, byte-counted, SHA-256
identified, race-checked, and never truncated. In auto mode, a diverged branch is
reviewed from its merge base with working-tree evidence included. Otherwise,
a dirty tree selects uncommitted changes, while a clean tree falls back to the
last commit (HEAD^..HEAD) without working-tree evidence. Unsafe untracked
file types or a repository mutation during capture cause a refusal.
The tool starts asynchronous provider jobs and returns a validationId, exact
artifact and prompt identities, file inventory, and one rawJobReference per
reviewer. Poll those references with validation job_status and collect them
with validation job_result, not the similarly named llm_job_* tools. If a
judge was requested, wait for every reviewer to become terminal, then call
synthesize_validation with the validationId and the same workingDir or
workspace selector. Continue collecting results for progress and human
visibility, but do not pass them as review evidence: for a review_changes run,
the gateway ignores caller-supplied question and providerResults, reloads
the exact owned durable linked terminal jobs, and reconstructs requested but
unavailable seats as skipped. General validation synthesis still requires a
caller-supplied question and terminal normalized results.
The review surface is registered only with durable SQLite or PostgreSQL job and
validation-run storage. Each CLI review job retains the exact fenced prompt in
its expiry-bound payload_json; its persisted argv contains only a hash marker.
The non-expiring flight recorder does not receive repository-review prompts.
Configured HTTP/API reviewer seats require explicit allowApiUpload:true
because the complete artifact leaves the local CLI boundary. Remote HTTP/OAuth
workspace reviews reject API reviewer uploads even with that flag. Treat the
durable job store as sensitive. Its retention is unbounded by default, and an
operator can set [persistence.retention].jobs when a bounded record is
required.
When judgeModel is an HTTP/API provider, review_changes binds that explicit
consent, the judge provider, the resolved repository, and the caller identity to
the durable validationId. The later synthesize_validation call must provide
that id and the same repository selector. The stored judge, repository, owner,
and upload consent are authoritative. The gateway atomically claims the planned
judge once, so concurrent or repeated synthesis cannot start a second judge.
A follow-up argument cannot grant or override upload consent.
LLM Request Tools
claude_request
Execute a Claude Code request with optional session management.
Parameters:
prompt(string, optional*): The prompt to send (1-100,000 chars). *Exactly one ofpromptorpromptPartsis required (mutually exclusive)model(string, optional): Model name or alias (uselist_modelsfor available values; supportslatest)outputFormat(string, optional): Output format (text|json|stream-json), default:stream-json— the gateway parses NDJSON usage events for token/cost observability; override totextonly when you want unparsed stdoutsessionId(string, optional): Specific session ID to use. Undermcp_managed, native continuation is a high-risk input because it can inherit an unverified provider posture; it requires approval andLLM_GATEWAY_APPROVAL_ALLOW_BYPASS=1, but does not select a full-permission profile.continueSession(boolean, optional): Continue the active session. It has the same managed-approval requirement assessionId. Because Claude--continueselects by cwd, it requiresworkingDiror a registered workspace selected explicitly, through caller-owned session metadata, or by the configured default. That workspace may optionally supply a gateway worktree. The request fails closed when no selection supplies a stable cwd.createNewSession(boolean, optional): Always create a new sessionforkSession(boolean, optional): Fork the resumed session instead of appending to it. Undermcp_managed, it is a high-risk native-fork input that requires approval andLLM_GATEWAY_APPROVAL_ALLOW_BYPASS=1, but stays bounded.allowedTools(string[], optional): Restrict Claude tools to this allow-list. A non-empty allow-list is a high-risk managed input because it can change the tool posture.disallowedTools(string[], optional): Explicitly deny listed Claude toolspermissionMode(string, optional): Claude permission mode (default|acceptEdits|plan|auto|dontAsk|bypassPermissions); preferred overdangerouslySkipPermissions.bypassPermissionsis a direct full-permission request undermcp_managed.dangerouslySkipPermissions(boolean, optional): Deprecated, maps topermissionMode: "bypassPermissions";permissionModewins when both are set. It is a direct full-permission request undermcp_managed.agent(string, optional): Named sub-agent to run as. A non-empty value is a high-risk managed input because it can change tool and permission posture.agents(string, optional): Inline agent definitions JSON. A non-empty value is a high-risk managed input for the same reason.systemPrompt/appendSystemPrompt(string, optional): Replace or extend the system prompt. A non-empty value is a high-risk managed input.systemPromptFile/appendSystemPromptFile(string, optional): Replace or extend the system prompt from a file. A non-empty file path is a high-risk managed input.safeMode(boolean, optional): Start Claude with local customizations disabled, includingCLAUDE.md, skills, plugins, hooks, MCP, commands, and agents.trueis a high-risk managed input.bare(boolean, optional): Start Claude in minimal mode, skipping local customization discovery.trueis a high-risk managed input.debugFile(string, optional): Write Claude debug output to a file. A non-empty path is a high-risk managed input.maxBudgetUsd(number, optional): Budget cap in USD for the requestmaxTurns(integer, optional): Agent-loop turn capeffort(string, optional): Reasoning effort (low|medium|high|xhigh|max)fallbackModel(string, optional): Auto-fallback model when the default is overloadedjsonSchema(string, optional): JSON Schema literal constraining structured outputaddDir(string[], optional): Additional workspace directories. A non-empty value is a high-risk managed input.noSessionPersistence(boolean, optional): Ephemeral session (not persisted to disk)settingSources/settings/tools(optional): Setting sources to load, settings JSON path/literal, built-in tool restriction. Non-empty setting sources, settings, or tool selections are high-risk managed inputs.pluginDir/pluginUrl(string[], optional): Load Claude plugins from local directories or URLs. Non-empty values are high-risk managed inputs.excludeDynamicSystemPromptSections(boolean, optional): Trim dynamic system prompt sectionsapprovalStrategy(string, optional):"legacy"(default) or"mcp_managed". Managed mode usesacceptEditsby default and forcesstrictMcpConfig:true, so Claude uses only the gateway-generated MCP configuration. A direct full-permission request requires all of an explicit caller request, an approval-manager approval, andLLM_GATEWAY_APPROVAL_ALLOW_BYPASS=1. Other high-risk inputs require the approval and operator setting too, but remain bounded and do not themselves select full permission.approvalPolicy(string, optional):"strict","balanced", or"permissive"mcpServers(string[], optional): Names of MCP servers to expose to Claude (default: none). Legacy requests resolve names from the local registry or Codex MCP config; unknown names are reported as unavailable. Undermcp_managed, Claude uses only the generated configuration and only registry entries explicitly provisioned as gateway-owned local commands are eligible. Dynamicnpxlaunchers, ambient-PATH commands, and Codex-config overrides are rejected. Configure and deploy the managed entries in the gateway environment.strictMcpConfig(boolean, optional): In legacy mode this defaults tofalse; settrueto require only the generated MCP config and fail if requested servers are unavailable. Undermcp_managed, the gateway forces it totrueand a caller-suppliedfalsecannot weaken that boundary.optimizePrompt(boolean, optional): Optimize prompt for token efficiency (44% reduction), default: falseoptimizeResponse(boolean, optional): Optimize response for token efficiency (37% reduction), default: falsecorrelationId(string, optional): Request trace ID (auto-generated if omitted)idleTimeoutMs(integer, optional): Kill a stuck process after output inactivity; 30,000 to 3,600,000 ms. Idle enforcement applies only whenoutputFormatisstream-json; it is ignored for text/json, which produce no output until the run completesworktree(boolean|object, optional): Run inside a gateway-owned git worktree (slice λ). A worktree requires a registered workspace selected explicitly, through caller-owned session metadata, or by the configured default; it never inherits process cwd or combines withworkingDir,addDir, orincludeDirs. Materialization suppresses repository, system, and global Git hooks and configured clean, smudge, and process checkout filters, so filter-dependent content such as Git LFS remains in its repository representation instead of executing host commands. Requesting a worktree is a high-risk managed input that requires approval andLLM_GATEWAY_APPROVAL_ALLOW_BYPASS=1, but remains bounded.promptParts(object, optional): Cache-aware structured prompt{ system?, tools?, context?, task }; mutually exclusive withpromptforceRefresh(boolean, optional): Bypass dedup and force a fresh CLI run, default: false
Workspace boundary: stdio callers may use machine-local paths directly. HTTP/tunnel callers must pass workspace or rely on a configured default/session workspace; path fields are then validated relative to that workspace. [workspaces].allow_unregistered_working_dir is an inert legacy key: it is still accepted so old configs keep loading, but nothing reads it at either value, and setting it now logs a warning at startup. It never allowed arbitrary HTTP working directories or additional directories.
Response extras:
approval: Approval decision record whenapprovalStrategy="mcp_managed"mcpServers: Requested/enabled/missing MCP servers for this call
Example:
{
"prompt": "Write a Python function to calculate fibonacci numbers",
"model": "sonnet",
"continueSession": true,
"optimizePrompt": true,
"optimizeResponse": true
}
codex_request
Execute a Codex request with optional session tracking.
Parameters:
prompt(string, optional*): The prompt to send (1-100,000 chars). *Exactly one ofpromptorpromptPartsis required (mutually exclusive)model(string, optional): Model name or alias (uselist_modelsfor available values; supportslatest, recommended:gpt-5.5)fullAuto(boolean, optional): Deprecated — expands to--sandbox workspace-writeonly (current Codex no longer accepts approval-policy flags); prefersandboxModesandboxMode(string, optional): Codex sandbox (read-only|workspace-write|danger-full-access).dangerouslyBypassApprovalsAndSandbox(boolean, optional): Request Codex's full approvals-and-sandbox bypass.dangerouslyBypassHookTrust(boolean, optional): Request Codex hook-trust bypass.approvalStrategy(string, optional):"legacy"is the only executable strategy."mcp_managed"is rejected before Codex launches because the adapter cannot isolate ambient MCP configuration.approvalPolicy(string, optional): Has no effect for Codex becausemcp_managedis unavailable.mcpServers(string[], optional): Metadata only. It does not configure or isolate Codex MCP servers.sessionId(string, optional): Session identifier for tracking.resumeLatest(boolean, optional): Resume a previous Codex session (codex exec resume --last). Do not rely on which session--lastselects or on the resumed working directory (#258):--lastis cwd-filtered upstream and the child is still spawned with the gateway-resolved cwd. Verify the target, or start a fresh session when it must be certain. Ignored ifsessionIdis set.createNewSession(boolean, optional): Always create a new sessionforceRefresh(boolean, optional): Bypass dedup and force a fresh CLI run, default: falseoutputFormat(string, optional):text(default) orjson(--jsonJSONL events for token usage extraction)outputSchema(string|object, optional): Codex--output-schema, path or inline JSON Schema.workingDir(string, optional): Working root for this session (-C/--cd; new sessions only). Personal Agent Config Kit mode requires an absolute path.addDir(string[], optional): Additional writable workspace directories (one--add-dirper entry; new sessions only).ephemeral(boolean, optional): Codex--ephemeral(no session persistence)images(string[], optional): Image attachments (one-i <path>per entry).profile(string, optional): Codex--profile <name>(new sessions only; ignored with a logged warning on resume).configOverrides(object, optional): Codex-c key=valueoverrides. Local callers only; remote HTTP/OAuth requests are rejected.enable/disable(string[], optional): Codex--enable/--disablefeature overrides. They are-c features.*equivalents and are also local-only.ignoreRules/ignoreUserConfig(boolean, optional): Codex--ignore-rules/--ignore-user-config.outputLastMessage(string, optional): Codex--output-last-message <path>.oss(boolean, optional): Codex--oss, selecting the open-source provider.localProvider(string, optional): Codex--local-provider <name>.worktree(boolean|object, optional): Run inside a gateway-owned git worktree (slice λ). A worktree requires a registered workspace selected explicitly, through caller-owned session metadata, or by the configured default; it never inherits process cwd or combines withworkingDir,addDir, orincludeDirs. Materialization suppresses repository, system, and global Git hooks and configured clean, smudge, and process checkout filters, so filter-dependent content such as Git LFS remains in its repository representation instead of executing host commands.promptParts(object, optional): Cache-aware structured prompt{ system?, tools?, context?, task }; mutually exclusive withpromptoptimizePrompt(boolean, optional): Optimize prompt for token efficiency, default: falseoptimizeResponse(boolean, optional): Optimize response for token efficiency, default: falsecorrelationId(string, optional): Request trace ID (auto-generated if omitted)idleTimeoutMs(integer, optional): Kill a stuck Codex process after output inactivity; 30,000 to 3,600,000 ms
Response extras:
mcpServers: Requested MCP-server metadata for this call
Example:
{
"prompt": "Create a REST API endpoint",
"model": "gpt-5.5",
"sandboxMode": "workspace-write",
"optimizePrompt": true
}
codex_fork_session
Fork an existing Codex session into a new branch (codex fork <SESSION_ID|--last> <prompt>), preserving the original session's history while the fork diverges. Unlike Codex new and resume requests, this command remains argv-bound and rejects oversized UTF-8 prompts as non-retryable input_too_large.
Parameters:
prompt(string, required): Prompt text for the forked session (1-100,000 chars)sessionId(string, optional): Codex session UUID to fork from (mutually exclusive withforkLast).forkLast(boolean, optional): Fork the most recent Codex session instead of naming one.model(string, optional): Model name or alias (e.g.gpt-5.5,latest)sandboxMode(string, optional): Codex sandbox (read-only|workspace-write|danger-full-access).approvalStrategy(string, optional):"legacy"is the only executable strategy."mcp_managed"is rejected before Codex launches because the adapter cannot isolate ambient MCP configuration.approvalPolicy(string, optional): Has no effect for Codex becausemcp_managedis unavailable.correlationId(string, optional): Request trace ID (auto-generated if omitted)idleTimeoutMs(number, optional): Idle timeout in ms (30s-1h, omit for CLI default)
gemini_request
Execute a Google Antigravity CLI (agy) request with session support.
Parameters:
prompt(string, optional*): The prompt to send (1-100,000 chars). *Exactly one ofpromptorpromptPartsis required (mutually exclusive)model(string, optional): Model name or alias (uselist_modelsfor available values; supportslatest,pro,flash)sessionId(string, optional): Session ID to resume.resumeLatest(boolean, optional): Resume the latest session automatically.createNewSession(boolean, optional): Always create a new sessionapprovalMode(string, optional): Antigravity approval mode in legacy mode:defaultleaves agy prompted,auto_editemits--mode accept-edits,planemits--mode plan, andyoloemits--dangerously-skip-permissions.approvalStrategy(string, optional):"legacy"is the only executable strategy."mcp_managed"is rejected before Antigravity launches because the adapter cannot isolate ambient MCP configuration.approvalPolicy(string, optional): Has no effect for Antigravity becausemcp_managedis unavailable.includeDirs(string[], optional): Additional workspace directories (passed as--add-dir).project(string, optional): Select the Antigravity project for this session (--project <ID>); mutually exclusive withnewProject.newProject(boolean, optional): Create a new Antigravity project for this session (--new-project); mutually exclusive withproject.sandbox(boolean, optional): Run Antigravity in sandbox mode (--sandbox)workingDir(string, optional): Local Antigravity process working directory. Stdio/local callers may pass local paths directly; remote HTTP/OAuth callers must use relative paths inside a selected registered workspace.includeDirsadds read paths but does not select cwd.workspace(string, optional): Registered gateway workspace alias that selects the Antigravity process cwd for remote HTTP/OAuth callers.outputFormat(string, optional):text(default),json, orstream-json. The async job recorder launches the transcript-capablestream-jsonwire independently of the requested presentation.mcpServers(string[], optional): Metadata only. Antigravity manages its own MCP configuration; this field does not create an allowlist.allowedTools,policyFiles,adminPolicyFiles,attachments(string[], optional) andskipTrust(boolean, optional): Unsupported by Antigravity CLI. Non-empty values, orskipTrust: true, are rejected with an explanatory error.yolo(boolean, optional): Auto-approve all; equivalent toapprovalMode: "yolo". Emits--dangerously-skip-permissionsin legacy mode.worktree(boolean|object, optional): Run inside a gateway-owned git worktree (slice λ). A worktree requires a registered workspace selected explicitly, through caller-owned session metadata, or by the configured default; it never inherits process cwd or combines withworkingDir,addDir, orincludeDirs. Materialization suppresses repository, system, and global Git hooks and configured clean, smudge, and process checkout filters, so filter-dependent content such as Git LFS remains in its repository representation instead of executing host commands.promptParts(object, optional): Cache-aware structured prompt{ system?, tools?, context?, task }; mutually exclusive withpromptoptimizePrompt(boolean, optional): Optimize prompt for token efficiency, default: falseoptimizeResponse(boolean, optional): Optimize response for token efficiency, default: falsecorrelationId(string, optional): Request trace ID (auto-generated if omitted)idleTimeoutMs(integer, optional): Total-runtime bound, not an idle timer: this provider emits no output until it exits, so the process is killed after this duration even while healthy. 30,000 to 3,600,000 ms, default 3,600,000 msforceRefresh(boolean, optional): Bypass dedup and force a fresh CLI run, default: false
Response extras:
mcpServers: Requested MCP-server metadata for this call
Example:
{
"prompt": "Explain quantum computing",
"model": "latest",
"resumeLatest": true,
"optimizePrompt": true
}
grok_request
Execute a Grok CLI (xAI) request with session support.
Parameters:
prompt(string, optional*): The prompt to send (1-100,000 chars). *Exactly one ofpromptorpromptPartsis required (mutually exclusive)model(string, optional): Model name or alias (e.g.grok-4.6,grok-4.5). Prefer live discovery vialist_modelsormodels://grok: the legacygrok-buildid was removed upstream and now hard-fails withInvalid params: "unknown model id".transport(string, optional):"cli"(default) runs the Grok CLI;"acp"routes through Grok's nativegrok agent stdiotransport when[acp].enabledand the provider'sruntime_enabledare set (fails closed otherwise). Both transports rejectapprovalStrategy:"mcp_managed";approvalPolicyhas no effect. Sync-only:grok_request_asyncalways runs the CLI transport and does not accepttransportoutputFormat(string, optional):"plain"(default),"json", or"streaming-json"sessionId(string, optional): Session ID to resume (--resume <id>).resumeLatest(boolean, optional): Resume the most recent session in the current cwd (--continue).createNewSession(boolean, optional): Always create a new sessionalwaysApprove(boolean, optional): Auto-approve all tool executions (--always-approve) in legacy mode.permissionMode(string, optional):default|acceptEdits|auto|dontAsk|bypassPermissions|plan.effort(string, optional):low|medium|high|xhigh|maxreasoningEffort(string, optional): Reasoning effort for reasoning modelsapprovalStrategy(string, optional):"legacy"is the only executable strategy."mcp_managed"is rejected before Grok launches because the adapter cannot isolate ambient MCP configuration.approvalPolicy(string, optional): Has no effect for Grok becausemcp_managedis unavailable.mcpServers(string[], optional): Metadata only. Grok manages its own MCP configuration viagrok mcp; this field does not create an allowlist.allowedTools(string[], optional): Allowed built-in tools (passed as--toolscomma list).disallowedTools(string[], optional): Disallowed built-in tools (passed as--disallowed-toolscomma list)maxTurns(integer, optional): Agent-loop iteration cap (--max-turns)workingDir(string, optional): Working directory for this invocation (--cwd)sandbox(string, optional): Sandbox profile for filesystem/network access (--sandbox, freeform; also viaGROK_SANDBOX).rules(string, optional): Extra rules appended to the system prompt (--rules; supports@fileprefix).systemPromptOverride(string, optional): Replace the agent's system prompt entirely.allow/deny(string[], optional): Permission allow/deny rules (one--allow/--denyper entry).compactionMode(string, optional):summary(default)|transcript|segmentscompactionDetail(string, optional):none|minimal|balanced|verbose(segments mode only)agent(string, optional): Agent name or definition file path.agents(string|object, optional): Inline subagent definitions JSON.disableWebSearch(boolean, optional): Disable web search and remote retrieval toolstodoGate(boolean, optional): Enable runtime turn-end TodoGate (session-scoped)verbatim(boolean, optional): Send the prompt exactly as given (also skips gateway prompt optimisation)promptFile/promptJson/single(optional): Single-turn prompt from a file / JSON blocks / literal.experimentalMemory/noMemory(boolean, optional): Enable/disable cross-session memory.noAltScreen/noPlan/noSubagents(boolean, optional): Disable alt screen / plan mode / subagent spawningoauth(boolean, optional): Use OAuth during authentication.restoreCode(boolean, optional): Check out the original session commit when resuming.leaderSocket(string, optional): Custom leader socket path (--leader-socket, Grok 0.2.32+; default~/.grok/leader.sock) targeting an isolated leader process, for example a local or branch Grok build.nativeWorktree(boolean|string, optional): Grok's own--worktreeflag (truemeans bare, string means named); distinct from the gatewayworktreeoption.worktreeRef(string, optional): Branch/tag/commit to base the native worktree on (--worktree-ref); requiresnativeWorktree.forkSession(boolean, optional): Fork the resumed session into a new branch instead of appending to it.jsonSchema(string|object, optional): JSON Schema (string or object) constraining structured output (--json-schema)worktree(boolean|object, optional): Run inside a gateway-owned git worktree (slice λ). Grok requires an explicit provider-nativesessionId; fresh,createNewSession, andresumeLatest-only worktree requests are rejected because they cannot durably reselect the worktree. A worktree requires a registered workspace selected explicitly, through caller-owned session metadata, or by the configured default; it never inherits process cwd or combines withworkingDir,addDir, orincludeDirs. Materialization suppresses repository, system, and global Git hooks and configured clean, smudge, and process checkout filters, so filter-dependent content such as Git LFS remains in its repository representation instead of executing host commands.promptParts(object, optional): Cache-aware structured prompt{ system?, tools?, context?, task }; mutually exclusive withpromptoptimizePrompt(boolean, optional): Optimize prompt for token efficiency, default: falseoptimizeResponse(boolean, optional): Optimize response for token efficiency, default: falsecorrelationId(string, optional): Request trace ID (auto-generated if omitted)idleTimeoutMs(integer, optional): Kill a stuck process after output inactivity; 30,000 to 3,600,000 msforceRefresh(boolean, optional): Bypass dedup and force a fresh CLI run, default: false
Example:
{
"prompt": "Summarize the latest commit message in 1 sentence",
"model": "grok-4.6",
"effort": "low"
}
Durable job results & automatic dedup
Every async job is persisted to a job store as it transitions through running → completed/failed/canceled. This makes the gateway a durable collection layer:
- Re-issuing a request is safe. Identical
*_request/*_request_asynccalls within the dedup window (default 1 hour) short-circuit onto the existing running or completed job — the caller gets back the same job ID instead of starting a duplicate run. This directly fixes the "agent times out polling, re-issues, and the whole job starts over" failure mode. llm_job_statusandllm_job_resultwork across gateway restarts. Job rows are retained until an operator configures a bound; callers can collect results long after the in-memory cache has evicted them.- A job is marked
orphanedonly when its owning gateway instance is provably gone, never because another instance restarted. Each instance holds a periodic heartbeat lease and stamps every job it owns; the recovery sweep orphans aqueued/runningjob only when that job's own lease has expired. On a shared store (backend = "postgres") this means a fresh instance never orphans another live instance's in-flight jobs. The captured partial output of a genuinely orphaned job remains readable, and a stale-then-reviving owner that later finishes self-heals to the correct terminal state (issue #139). - Pass
forceRefresh: trueon any request tool to bypass dedup and force a fresh CLI run.
Persistence configuration
The durable backend is configured by ~/.llm-cli-gateway/config.toml (override with LLM_GATEWAY_CONFIG=/path/to/config.toml). Example:
[persistence]
backend = "sqlite" # "sqlite" | "memory" | "postgres" | "none"
path = "~/.llm-cli-gateway/logs.db" # for sqlite
# dsn = "postgresql://user:pw@host/db" # for postgres
# retentionDays = 30 # optional legacy JOB-store bound; omitted means unbounded
dedupWindowMs = 3600000
acknowledgeEphemeral = false # required to enable async tools with memory backend
# One retention policy, over every subsystem. Every destructive bound is OFF
# unless you write a number, because deleting prompt, response, or transcript
# history is destructive and no upgrade should do it for you. Unknown keys are
# refused rather than silently applying no bound.
# `llm-cli-gateway doctor --json` -> .storage.retention reports what each bound
# would delete BEFORE you set it.
[persistence.retention]
# jobs = 30 # overrides retentionDays above
# requests = 90 # flight-recorder transcripts, incl. bodies
# wedgedValidationRuns = 30 # validation runs nothing can ever finalize
# sweepIntervalMs = 3600000 # how often the sweeper ticks
# Issue #139 durable orphan-recovery lease (defaults shown). Each instance
# advances a per-job lease on every heartbeat; the sweep orphans a job only
# after its own lease expires, so a fresh instance never orphans another live
# instance's jobs on a shared store. Validated: leaseTtl >= 2*heartbeat and
# httpJobGrace >= leaseTtl.
instanceHeartbeatMs = 15000 # heartbeat cadence
instanceLeaseTtlMs = 90000 # per-job lease TTL (6x heartbeat)
httpJobGraceMs = 300000 # extra grace for no-pid http jobs (5 min)
orphanSweepIntervalMs = 30000 # reaper cadence
instanceGcMs = 3600000 # gateway_instances GC horizon
# ownsOrphanRecovery = false # DEPRECATED (#139): superseded by the lease; parsed + warned, no longer used
# Optional, postgres only. One credential per class of work, for a deployment
# that has provisioned the RBAC in docs/plans/postgres-security-hardening.md.
# `app` is not a key here: the runtime credential is [persistence].dsn above.
# `migrate` is not a key either, and must not be held by a running gateway.
# A role left out degrades onto `app`, which llm_process_health reports as
# `persistence.roles.degraded` rather than implying separation is in force.
# [persistence.roles]
# reader = "postgresql://llmgw_reader@host/db" # transcript read-back
# analytics = "postgresql://llmgw_analytics@host/db" # aggregates, no body text
# retention = "postgresql://llmgw_retention@host/db" # job expiry
Backends:
sqlite(default) — durable, file-backed. Safe for single-instance deployments.postgres: PostgreSQL is authoritative for every backend-governed durable subsystem, including async jobs, dedup, orphan recovery, HTTP jobs, validation state, session metadata, and the flight recorder. File-backed operator records such as approvals, admin audit, and the workspace registry are not SQLite/PostgreSQL engine choices. Use this for multi-instance or service deployments. Requires the optional peer dependencypgto be installed alongside the gateway.memory— in-process Map. Lost on gateway exit. RequiresacknowledgeEphemeral = trueto be loaded. Suitable for tests and ephemeral CI gateways.none— no store.*_request_async,llm_job_status,llm_job_result, andllm_job_cancelare NOT registered on the gateway. This is a structural invariant: agents that try to call async tools against a gateway withbackend = "none"get a clean "tool not found" at connect time instead of silent in-memory loss after the 1-hour TTL. Usellm_process_healthto inspect the resolved persistence state programmatically.
backend = "postgres" is the whole engine decision. The configured dsn must be a PostgreSQL URL. The gateway does not infer deployment topology, resolve the host, restrict PostgreSQL to a local target, or render a DSN-derived target on diagnostics. If migration, connection, or an operation fails, the affected PostgreSQL subsystem fails closed and the gateway does not open SQLite as a fallback. Health surfaces identify the selected engine and report PostgreSQL failures generically.
Changing engines does not move data. Existing SQLite and PostgreSQL rows stay where they are: there is no automatic migration, dual-write, or cross-engine read. Plan and execute any data move separately before cutover if old history must remain available through the gateway.
backend = "none" and LLM_GATEWAY_LOGS_DB=none are different switches. The first disables async job persistence; the second disables request history. Setting the backend to "none" leaves the flight recorder writing, and disabling the recorder leaves the job store alone. Both are stated at startup in the Storage: block on stderr. `llm_process_health
Frequently asked questions
What is LLM CLI Gateway MCP Server?
One MCP endpoint for Claude Code, Codex, Gemini, Grok and Mistral CLIs, with durable async jobs.
How do I install LLM CLI Gateway MCP Server in Claude Desktop, Cursor, or VS Code?
Pick your client in the Install section on this page and copy the generated config into the client's config file. Step-by-step guides: Claude Desktop, Cursor, and VS Code. LLM CLI Gateway MCP Server runs locally from the npm package llm-cli-gateway with the command npx -y llm-cli-gateway@1.17.1.
Is LLM CLI Gateway MCP Server free and open source?
Yes. LLM CLI Gateway MCP Server is released under the MIT license, an OSI-approved open-source license, so you can use, modify, and self-host it under those terms.
Does LLM CLI Gateway MCP Server support remote (HTTP) connections?
No remote endpoint is listed for LLM CLI Gateway MCP Server. It runs locally on your machine over stdio, started by your MCP client.
What tools does LLM CLI Gateway MCP Server provide?
LLM CLI Gateway MCP Server provides 10 tools, including ask_model, consensus_check, list_available_models, and mcpServers. See the full tool list for descriptions and parameters.
How is LLM CLI Gateway MCP Server's trust score calculated?
LLM CLI Gateway MCP Server scores 70 out of 100 (Good). The score adds six capped public signals: registry status, maintenance, popularity, license, documentation, and security. Nobody can pay for points. Read the methodology for the full formula.
Reviews
No reviews yet—Be the first to review
No published reviews yet. Used it? Tell the next person how it went.
Sign inA verified email is required to review this server.
Add badge to your README
Paste either snippet into the repository README. The image links to this listing.