MCP Directory

How to add llm-router to Cursor

Local-first LLM router for AI coding tools — routes prompts to the cheapest capable model with automatic provider fallback. Paste the config into ~/.cursor/mcp.json and restart Cursor.

Last updated June 14, 2026 · 33 · stdio · no auth

Cursor config for llm-router

pip install llm-routing && llm-router install
{
  "mcpServers": {
    "llm-router": {
      "command": "llm-router",
      "args": [
        "install"
      ]
    }
  }
}

Setup steps

  1. 1Open Cursor → Settings → MCP → Add new MCP server (or edit ~/.cursor/mcp.json directly).
  2. 2Paste the llm-router config below into the "mcpServers" object.
  3. 3Fill in placeholder secrets, then save.
  4. 4Cursor reloads MCP servers automatically — check Settings → MCP for a green status dot.
  5. 5Ask Cursor to use one of llm-router's tools to confirm it's connected.

Before you start

  • Python 3.10+
  • An MCP host (Claude Code, Codex CLI, Gemini CLI, VS Code, or Cursor)
  • Optional provider API keys (e.g. OPENAI_API_KEY, GEMINI_API_KEY, OPENROUTER_API_KEY) or a local Ollama instance (OLLAMA_BASE_URL); works with zero keys on Claude Code Pro/Max

What llm-router can do in Cursor

llm_route

Route a prompt to the most cost-effective capable model based on the active policy and provider chain.

llm_classify

Classify prompt complexity (heuristic or model-assisted) to drive routing decisions.

llm_auto

Automatic routing entry point used by hook-driven auto-routing.

llm_stream

Stream a routed model response.

llm_query

General-purpose text query routed through the free-first chain (primary manual tool for MCP clients like VS Code/Cursor).

llm_code

Code-oriented generation routed to an appropriate coding model.

llm_analyze

Analysis-oriented text task routed to a capable model.

llm_research

Research-oriented query, optionally using web-grounded providers.

Security

Runs locally with no hosted proxy, telemetry, or account. API keys live in local files (.env or ~/.llm-router/config.yaml) and are never transmitted by the router; keys are scrubbed from structured logs. Usage logs are stored as UNENCRYPTED SQLite at ~/.llm-router/usage.db — use full-disk encryption if needed (chmod 700 ~/.llm-router, 600 config.yaml recommended). Prompts are sent to whichever provider the router selects, so review each provider's privacy policy. The router cannot prevent provider-level jailbreaks or prompt injection. Hook scripts are local, inspectable shell scripts in ~/.claude/hooks/.

llm-router + Cursor FAQ

Where is the Cursor config file?

Cursor reads MCP servers from ~/.cursor/mcp.json. Paste the llm-router config there under the "mcpServers" key and restart the client.

Is llm-router safe to use with Cursor?

Runs locally with no hosted proxy, telemetry, or account. API keys live in local files (.env or ~/.llm-router/config.yaml) and are never transmitted by the router; keys are scrubbed from structured logs. Usage logs are stored as UNENCRYPTED SQLite at ~/.llm-router/usage.db — use full-disk encryption if needed (chmod 700 ~/.llm-router, 600 config.yaml recommended). Prompts are sent to whichever provider the router selects, so review each provider's privacy policy. The router cannot prevent provider-level jailbreaks or prompt injection. Hook scripts are local, inspectable shell scripts in ~/.claude/hooks/.

Do I need API keys to use it?

No. It works with zero API keys on Claude Code Pro/Max subscriptions, where routing uses MCP tools that only call external models when beneficial. Adding provider keys (e.g. OPENROUTER_API_KEY) widens the routing chain and unlocks policies like cost_aggressive.

What is the PyPI package name?

The package is `llm-routing` (`pip install llm-routing`); the CLI command and GitHub repo are named `llm-router`. The older `claude-code-llm-router` package is deprecated and redirects to `llm-routing`.

How do I add it to a host other than Claude Code?

Run `llm-router install` (defaults to Claude Code) or pass a host flag: `--host codex`, `--host gemini-cli`, `--host vscode`, or `--host cursor`. Any MCP client can also use the manual tools such as `llm_query`.

View repo Full llm-router page