userouter-mcp
Official<div align="center">
<picture>
<source media="(prefers-color-scheme: dark)" srcset="assets/logo-dark.png">
<img src="assets/logo-light.png" alt="Userouter" width="300">
</picture>
<h3>The official Model Context Protocol server for Userouter</h3>
<p>
Give Claude, Cursor, Windsurf, VS Code and any MCP client access to 400+ open and frontier LLMs<br>
through one API key, with private routing, live pricing and per-request cost reporting.
</p>
<p>
<a href="https://www.npmjs.com/package/userouter-mcp"><img src="https://img.shields.io/npm/v/userouter-mcp?style=flat-square&color=0b0614&label=npm" alt="npm version"></a>
<a href="https://www.npmjs.com/package/userouter-mcp"><img src="https://img.shields.io/npm/dm/userouter-mcp?style=flat-square&color=0b0614" alt="npm downloads"></a>
<a href="https://github.com/userouter/userouter-mcp/actions/workflows/ci.yml"><img src="https://img.shields.io/github/actions/workflow/status/userouter/userouter-mcp/ci.yml?branch=main&style=flat-square&label=CI" alt="CI status"></a>
<img src="https://img.shields.io/node/v/userouter-mcp?style=flat-square&color=0b0614" alt="Node.js version">
<a href="LICENSE"><img src="https://img.shields.io/badge/license-MIT-0b0614?style=flat-square" alt="MIT license"></a>
<a href="https://modelcontextprotocol.io"><img src="https://img.shields.io/badge/MCP-compatible-0b0614?style=flat-square" alt="MCP compatible"></a>
</p>
<p>
<a href="https://userouter.xyz"><b>Website</b></a> ·
<a href="https://userouter.xyz/account"><b>Get an API key</b></a> ·
<a href="https://x.com/userouter"><b>X</b></a> ·
<a href="https://github.com/userouter/userouter-mcp/issues"><b>Issues</b></a>
</p>
</div>
---
## Contents
- [Overview](#overview)
- [Quick start](#quick-start)
- [Client setup](#client-setup)
- [Tools](#tools)
- [Configuration](#configuration)
- [How it works](#how-it-works)
- [Privacy and security](#privacy-and-security)
- [Troubleshooting](#troubleshooting)
- [Development](#development)
- [Contributing](#contributing)
- [License](#license)
## Overview
[Userouter](https://userouter.xyz) is an OpenAI-compatible inference API that puts Qwen, DeepSeek, GLM, Claude and
hundreds of other models behind a single key. This server connects that API to your AI assistant over the
[Model Context Protocol](https://modelcontextprotocol.io), so the assistant can choose and call other models on its own.
| Capability | What it gives your assistant |
| :--- | :--- |
| **Model delegation** | Send a long summary to a fast, low-cost model, or ask a second model to review a result. |
| **Side-by-side comparison** | Run the same prompt on several models and compare the answers in one conversation. |
| **Cost awareness** | Every reply reports its token count and exact USD cost; balance and usage are one call away. |
| **Confidential inference** | Fetch the signed enclave receipt for any `tee/…` response and verify where it ran. |
| **Launchpad models** | Discover community models launched on Userouter and call the live ones by their `launch/…` id. |
## Quick start
**1. Create an API key** at [userouter.xyz/account](https://userouter.xyz/account). Keys start with `sk-userouter-`.
**2. Add the server to Claude Code:**
```bash
claude mcp add userouter -e USEROUTER_API_KEY=sk-userouter-... -- npx -y userouter-mcp
```
**3. Ask your assistant:**
> *"List the DeepSeek models on Userouter with their prices."*
>
> *"Ask qwen/qwen3.8-flash and z-ai/glm-5.3-flash to explain this function, then compare the answers."*
>
> *"Which launchpad models are live right now?"*
>
> *"How much have I spent on Userouter today?"*
No installation step is needed: `npx` downloads and runs the latest published version. Node.js 20 or later is required.
## Client setup
Every client uses the same command, `npx -y userouter-mcp`, with your key in the `USEROUTER_API_KEY` environment
variable.
<details open>
<summary><b>Claude Code</b></summary>
```bash
claude mcp add userouter -e USEROUTER_API_KEY=sk-userouter-... -- npx -y userouter-mcp
```
</details>
<details>
<summary><b>Claude Desktop</b></summary>
Open **Settings → Developer → Edit Config** and add to `claude_desktop_config.json`:
```json
{
"mcpServers": {
"userouter": {
"command": "npx",
"args": ["-y", "userouter-mcp"],
"env": { "USEROUTER_API_KEY": "sk-userouter-..." }
}
}
}
```
Restart Claude Desktop after saving.
</details>
<details>
<summary><b>Cursor</b></summary>
Add to `~/.cursor/mcp.json`, or to `.cursor/mcp.json` for a single project:
```json
{
"mcpServers": {
"userouter": {
"command": "npx",
"args": ["-y", "userouter-mcp"],
"env": { "USEROUTER_API_KEY": "sk-userouter-..." }
}
}
}
```
</details>
<details>
<summary><b>Windsurf</b></summary>
Add to `~/.codeium/windsurf/mcp_config.json`:
```json
{
"mcpServers": {
"userouter": {
"command": "npx",
"args": ["-y", "userouter-mcp"],
"env": { "USEROUTER_API_KEY": "sk-userouter-..." }
}
}
}
```
</details>
<details>
<summary><b>VS Code (Copilot agent mode)</b></summary>
Add to `.vscode/mcp.json`:
```json
{
"servers": {
"userouter": {
"command": "npx",
"args": ["-y", "userouter-mcp"],
"env": { "USEROUTER_API_KEY": "sk-userouter-..." }
}
}
}
```
</details>
<details>
<summary><b>Other MCP clients</b></summary>
Any client that supports stdio servers works. Configure:
- **Command:** `npx`
- **Arguments:** `-y userouter-mcp`
- **Environment:** `USEROUTER_API_KEY=sk-userouter-...`
</details>
## Tools
| Tool | Description | Key |
| :--- | :--- | :---: |
| [`list_models`](#list_models) | Available models with context length, vision and tool support, and USD price per 1M tokens. | — |
| [`list_launches`](#list_launches) | Community models on the Userouter launchpad, with status, token and price. | — |
| [`chat`](#chat) | Run a prompt or a full conversation on any model; returns the reply, tokens and cost. | ✓ |
| [`get_balance`](#get_balance) | Credit balance and free daily allowance. | ✓ |
| [`get_usage`](#get_usage) | Most recent billed requests, newest first. | ✓ |
| [`get_tee_receipt`](#get_tee_receipt) | Signed enclave receipt for a confidential (`tee/…`) response. | ✓ |
All tools except `chat` are read-only.
### `list_models`
| Parameter | Type | Description |
| :--- | :--- | :--- |
| `search` | string, optional | Case-insensitive match on model id or name, e.g. `qwen` or `deepseek`. |
```text
2 model(s):
- deepseek/deepseek-v4.1-flash (1049k ctx, vision, tools) $0.051 in / $0.567 out per 1M
- deepseek/deepseek-v4.1-flash:batch (1049k ctx, vision, tools) $0.050 in / $0.150 out per 1M
```
### `list_launches`
| Parameter | Type | Description |
| :--- | :--- | :--- |
| `limit` | integer, optional | Number of launches, 1–50. Default 20. |
Statuses are `bonding`, `graduated`, `live`, `paused` and `delisted`. Live launches include the model id to pass to `chat`.
### `chat`
| Parameter | Type | Description |
| :--- | :--- | :--- |
| `model` | string | Model id from `list_models` or `list_launches`. Optional when `USEROUTER_DEFAULT_MODEL` is set. |
| `prompt` | string | A single user message. |
| `system` | string, optional | System prompt, used together with `prompt`. |
| `messages` | array, optional | A full conversation of `{ role, content }` objects. Takes precedence over `prompt`. |
| `max_tokens` | integer, optional | Maximum tokens to generate. |
| `temperature` | number, optional | Sampling temperature, 0–2. |
Pass either `prompt` or `messages`. The reply is followed by a footer such as:
```text
model: qwen/qwen3.8-flash · tokens: 412 in / 96 out · cost: $0.000071
```
### `get_balance`
No parameters. Returns the account balance in USD and the free daily allowance, when one applies.
### `get_usage`
| Parameter | Type | Description |
| :--- | :--- | :--- |
| `limit` | integer, optional | Number of requests, 1–100. Default 20. |
### `get_tee_receipt`
| Parameter | Type | Description |
| :--- | :--- | :--- |
| `id` | string | Receipt id from the `x-userouter-tee-receipt` response header. |
## Configuration
| Variable | Default | Description |
| :--- | :--- | :--- |
| `USEROUTER_API_KEY` | — | Your API key. Without it, only `list_models` and `list_launches` are available. |
| `USEROUTER_DEFAULT_MODEL` | — | Model used by `chat` when none is given, e.g. `qwen/qwen3.8-flash`. |
| `USEROUTER_BASE_URL` | `https://api.userouter.xyz/api/v1` | API endpoint. Must use `https`; plain `http` is accepted for `localhost` only. |
| `USEROUTER_TIMEOUT_MS` | `120000` | Per-request timeout in milliseconds, at least `1000`. |
Invalid configuration stops the server at startup with a message that says what to fix.
## How it works
```mermaid
flowchart LR
A["MCP client<br/>Claude · Cursor · VS Code"] -- "stdio (JSON-RPC)" --> B["userouter-mcp<br/>runs on your machine"]
B -- "HTTPS + API key" --> C["api.userouter.xyz"]
C --> D["400+ models<br/>ZDR · TEE · launchpad"]
```
The server is a thin, local translation layer. Your client starts it as a child process and talks to it over stdio;
the server turns each tool call into a request to the Userouter API and returns a readable result.
## Privacy and security
- Your API key is sent only to `USEROUTER_BASE_URL`, over HTTPS, and is never logged or written to disk.
- The server opens no network ports and keeps no state between calls.
- Prompts and replies pass straight through; the server stores nothing.
- Every input is validated before a request is made, and API errors return as readable tool errors instead of
crashing the server.
See [SECURITY.md](SECURITY.md) to report a vulnerability.
## Troubleshooting
| Symptom | Fix |
| :--- | :--- |
| `USEROUTER_API_KEY is not set` | Add the key to the `env` block of your client config and restart the client. |
| `USEROUTER_API_KEY must start with "sk-userouter-"` | Copy the full key again from [userouter.xyz/account](https://userouter.xyz/account). |
| `HTTP 402` / insufficient balance | Top up your balance on [userouter.xyz](https://userouter.xyz). |
| `HTTP 429` | The API allows 120 requests per minute per key. Wait a moment and retry. |
| The server does not appear in the client | Run `npx -y userouter-mcp` in a terminal to see startup errors, and check that Node.js is 20 or later. |
## Development
```bash
git clone https://github.com/userouter/userouter-mcp.git
cd userouter-mcp
npm install
npm test # unit and protocol tests
npm run build # compile to dist/
```
Try the tools interactively with the MCP Inspector:
```bash
npx @modelcontextprotocol/inspector node dist/index.js
```
```text
src/
├── index.ts # stdio entry point
├── server.ts # MCP server setup
├── tools.ts # tool definitions and input schemas
├── client.ts # typed Userouter API client
├── config.ts # environment parsing and validation
└── format.ts # human-readable tool output
```
## Contributing
Issues and pull requests are welcome. Please read [CONTRIBUTING.md](CONTRIBUTING.md) first, and open an issue to
discuss anything larger than a small fix.
## License
Released under the [MIT License](LICENSE). © Userouter
TDQS
Scored across 6 tools
Most tools are cleanly separated by resource: chat, balance, usage, TEE receipts, model catalog, launchpad catalog. The only mild overlap is between list_models and list_launches, both 'list' operations over catalogs, though the descriptions (context length/pricing vs Hugging Face repo/bonding status/token address) make the boundary clear enough.
Five of six tools follow a clean verb_noun snake_case pattern (list_models, get_balance, get_usage, get_tee_receipt, list_launches). The single bare verb `chat` is the only deviation, but it's a natural and unambiguous name for the primary action.
Six tools is tightly scoped to the domain: catalog discovery, inference, billing visibility, verification, and launchpad access. Each tool maps to a distinct capability with no filler.
Core workflow is fully covered: discover models/launches, chat with either, check balance and usage, and verify confidential responses via TEE receipt. Minor gaps exist around key/account management and single-model detail lookup, but agents can work around these via list_models with search.