9router-mcp
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@9router-mcpcheck pool headroom and list available models"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
9router-mcp
MCP server (stdio, newline-delimited JSON-RPC 2.0) for a local 9router LLM gateway. No dependencies; requires Bun.
Tools
router_models- live models, pool headroom and seven-day call statisticsrouter_headroom- pool capacity, cooldowns and in-flight callsrouter_chat- chat with exactly one model; never silently switches models, suggests an alternative from the task rows on rate limitrouter_probe- sequential eight-token probesrouter_usage- read-only usage totals by key namerouter_search/router_fetch- search and page fetch; paid Firecrawl needsallow_firecrawl: true
Related MCP server: io.github.0xzr/freellmpool
Install
claude mcp add -s user 9router-mcp -- bun /absolute/path/to/9router-mcp/index.tsAdd -e NAME=value for any variable below.
Configuration (environment)
ROUTER_BASE: router origin; defaulthttp://127.0.0.1:20128. Loopback127.0.0.1only.ROUTER_CACHE: shared state directory (limits.json,calls.jsonl); default~/.cache/pi-runs.ROUTER_DB: router SQLite file; default~/.9router/data.sqlite. Read-only.ROUTER_HEADROOM_SCRIPT: executable run with--json; defaultmodel-headroom. Must print an array or{pools: [...]}of{pool, percent_left, status, reset_at}.ROUTER_TASK_ROWS: path to a JSON file of fallback rows; defaulttask-rows.jsonnext toindex.ts.
Task rows are ordered lists of model IDs from weakest to strongest:
[["glm/example-small"], ["cx/example-medium", "cx/example-large"]]When a model in a row is rate limited, the next healthy model in the same row is suggested as alternative.
Safety
Key redaction: values from the router
apiKeystable,sk-strings,Bearertokens and secret-named fields are replaced with[REDACTED]in all output and logs. Only key names are ever selected for usage.Rate limits: per-pool concurrency caps, cooldowns from
retry-after(or 5 minutes doubling to 60), a learned cap of N-1 after a 429, and a fusion-call cap.Prompts are never logged; the router DB is never written; no authorization header is sent.
Tests
bun test <file>Run files one at a time. mutation.test.ts temporarily edits router.ts and restores it; run it alone.
Known gaps
Search/fetch are not covered by the shared limits.
Upstream body reads lack independent deadlines.
A crashed process can leave a lock needing manual removal.
This server cannot be deployed
Maintenance
Related MCP Connectors
OpenAI-compatible LLM gateway: pay per request with an API key, signed receipt for each call.
Gateway between LLM agents and world data through eight tools and a bundled endpoint catalog.
LLM cost optimization gateway, repo token-waste auditor & model arbitrage MCP server.
LLM cost optimization gateway, repo token-waste auditor & model arbitrage MCP server.
Related MCP Servers
- AlicenseNot gradedqualityBmaintenanceExposes an OpenAI- and Anthropic-compatible HTTP, SSE, and stdio gateway that wraps multiple subscription CLIs, adding prompt-injection defense, PII redaction, cost-aware routing, and reasoning-trace capture for MCP-compatible clients like Claude Desktop and Cursor.114 npm16Apache 2.0
- FlicenseNot gradedqualityAmaintenanceEnables coding agents and OpenAI- or Anthropic-compatible clients to send chat requests through a single local pooled endpoint that spans free provider tiers, with keyless startup, automatic failover, model discovery, and capacity/health inspection tools.-
- FlicenseNot gradedqualityAmaintenanceExposes an OpenAI-compatible gateway that pools 178 enabled free-tier and keyless chat routes across 23 providers, enabling agent clients to list models, check capacity and provider health, and route or fail over requests. It can answer without credentials when a keyless route is available.-
- FlicenseNot gradedqualityAmaintenanceExposes a pooled gateway of free, enabled LLM chat routes and models across many providers through one OpenAI-compatible endpoint, automatically routing around rate limits and outages and letting sessions start without API keys when a keyless provider is available. Supports model listing and status queries so coding agents and OpenAI-compatible tools can use free tiers without individual provider setup.-