Skip to content

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 have

2. Register the MCP server (Claude Code shown; see Quick Start for other clients)

claude mcp add --scope user ask-llm -- npx -y @ask-llm/mcp

Or 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

  1. Node.js v20.0.0 or higher
  2. At least one provider installed and authenticated:
    • Gemini CLI for ask-gemini tools
    • Codex CLI for ask-codex tools
    • Claude Code CLI for Codex and other non-Claude hosts to consult Claude
    • xAI API key in XAI_API_KEY for the default metered Grok harness, or authenticated official Grok Build with headless JSON support (pin harness: "grok-cli" per request, or set ASK_GROK_HARNESS=grok-cli to make it the default; never automatic failover)
    • Cursor CLI authenticated for the optional model-neutral ask-cursor-agent tool
    • Ollama running locally for ask-ollama tools

How It Works

On startup, the unified server:

  1. Checks for CLI availability (Gemini, Codex, Claude, Antigravity)
  2. Checks HTTP readiness for Ollama and the explicitly configured Grok harness (XAI_API_KEY for API, headless JSON capability for CLI) without making a billed inference
  3. Dynamically imports and registers tools from available providers
  4. 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:

ToolPurpose
ask-llmSingle 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-agentModel-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-llmDispatch the same prompt to multiple providers in parallel; returns per-provider responses + usage in one call
get-usage-statsPer-session token totals + breakdowns by provider/model; in-memory, no persistence
diagnoseSelf-diagnosis: Node version, PATH, provider CLI presence + versions. Read-only
pingConnection 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.

multi-llmcodexclaudeantigravityollama
multi-llm dispatches the same prompt in parallel. A provider failing or hitting quota does not fail the others.

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-llm provider tool plus an explicit model-neutral ask-cursor-agent harness tool
  • Multi-provider parallel dispatch via multi-llm (Promise.all internally; per-provider failure isolation)
  • Grok harness selection: xai-api (default) or official headless grok-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

Released under the MIT License.