Unified (@ask-llm/mcp)
@ask-llm/mcp default per provider
All providers in one MCP server. Detects which provider CLIs/endpoints are available and whether XAI_API_KEY configures Grok, then registers only the available providers. One install, all providers.
Best for: installing once and letting the orchestrator route each request to whatever provider you have, or fanning the same prompt out to several at once. The recommended starting point. Not for: nothing in particular; if you're unsure which provider to install, start here.
Installation
1. Provider CLI
# no extra CLI: auto-detects the provider CLIs you already have2. Register the MCP server (Claude Code shown; see Quick Start for other clients)
claude mcp add --scope user ask-llm -- npx -y @ask-llm/mcpOr install globally: npm install -g @ask-llm/mcp. The installed ask-llm-mcp binary starts the MCP server only when invoked without arguments; see CLI argument contract for its command-line modes.
Prerequisites
- Node.js v20.0.0 or higher
- At least one provider installed and authenticated:
- Gemini CLI for
ask-geminitools - Codex CLI for
ask-codextools - Claude Code CLI for Codex and other non-Claude hosts to consult Claude
- xAI API key in
XAI_API_KEYfor the default metered Grok harness, or authenticated official Grok Build with headless JSON support (pinharness: "grok-cli"per request, or setASK_GROK_HARNESS=grok-clito make it the default; never automatic failover) - Cursor CLI authenticated for the optional model-neutral
ask-cursor-agenttool - Ollama running locally for
ask-ollamatools
- Gemini CLI for
How It Works
On startup, the unified server:
- Checks for CLI availability (Gemini, Codex, Claude, Antigravity)
- Checks HTTP readiness for Ollama and the explicitly configured Grok harness (
XAI_API_KEYfor API, headless JSON capability for CLI) without making a billed inference - Dynamically imports and registers tools from available providers
- Exposes only the tools for providers that are actually installed
Tools
The orchestrator exposes a single ask-llm tool (not one per provider), so the same tool surface is registered whenever any provider is installed:
| Tool | Purpose |
|---|---|
ask-llm | Single unified tool; picks the provider via provider parameter (gemini, codex, claude, grok, ollama, antigravity). Optional harness (Grok only), includeDirs (Codex/Claude/Antigravity) and reasoningEffort (Codex/Grok) are forwarded; unsupported combinations fail validation instead of being stripped. For Codex continuity, pass sessionId: "" first, then resume with the returned ID; resumed Codex calls reject includeDirs |
ask-cursor-agent | Model-neutral Cursor Agent harness. Requires separate provider (claude, codex, gemini, grok), exact model from agent --list-models, and prompt; the requested model must match the provider family (Auto and noncanonical IDs are refused) and is echoed back as model, with Cursor's display label in optional reportedModel; optional relative includeDirs map to repeated --add-dir, and the returned Cursor conversation sessionId can be passed back to resume; prompts above 16 KB are piped over stdin; read-only ask mode, no fallback |
multi-llm | Dispatch the same prompt to multiple providers in parallel; returns per-provider responses + usage in one call |
get-usage-stats | Per-session token totals + breakdowns by provider/model; in-memory, no persistence |
diagnose | Self-diagnosis: Node version, PATH, provider CLI presence + versions. Read-only |
ping | Connection test |
The orchestrator uses a single ask-llm provider-routing tool (not one per provider) for token efficiency. All ask-* tools return both human-readable text and a structured AskResponse (provider, response, model, sessionId, usage) via MCP outputSchema.
Codex calls are ephemeral when sessionId is omitted. To create a resumable Codex conversation, pass sessionId: "" on the first ask-llm call and pass its returned Thread ID on follow-ups.
It also exposes usage://current-session as an MCP Resource for live JSON snapshots of token spend.
Parallel dispatch
multi-llm fans one prompt out to every requested provider at once, running them concurrently and collecting each response with per-provider failure isolation.
CLI argument contract
Run ask-llm-mcp --help for the canonical list of supported commands and options. With no arguments, the binary starts the stdio MCP server. Help and version flags print and exit without provider detection or server startup; unsupported commands and arguments print usage and exit nonzero. The binary's help output remains the command reference so this installation page does not duplicate it.
Key Features
- Single server for all providers
- Auto-detection of installed CLIs
- Host-aware Claude routing: Claude is available to Codex and other clients, but suppressed when the host is Claude Code because nested Claude sessions are unsupported
- Single unified
ask-llmprovider tool plus an explicit model-neutralask-cursor-agentharness tool - Multi-provider parallel dispatch via
multi-llm(Promise.all internally; per-provider failure isolation) - Grok harness selection:
xai-api(default) or official headlessgrok-cli, never automatic failover - Cursor Agent harness: exact account model ID + separate provider attribution verified against the model family,
--mode ask, no force/trust/spend changes/fallback - Grok API cost safety: exact model IDs, no fallback,
store:false, no billing/credits/priority changes - Session continuity across four session-capable providers: Claude/Gemini (
--resume), Codex (exec resume), Ollama (server-side replay), plus Cursor Agent conversations (--resume); Grok and Antigravity are single-turn - Graceful degradation if a provider is unavailable
npm
- Package: @ask-llm/mcp
- Binary:
ask-llm-mcp