MuiRouter

Model Context Protocol

MCP integration guide

MuiRouter runs a streamable-HTTP MCP server so AI clients like Claude Desktop, Claude Code, Cursor and Cline can call it directly — your AI assistant can check your balance, view usage, list models, generate images and even start a top-up. Everything is authenticated with your own sk-gw- API key, so neither third parties nor AI clients need a new account.

1. Server endpoint
All MCP clients connect to the same URL using Bearer auth.
Endpoint
POST https://api.muirouter.com/mcp
Header
Authorization: Bearer sk-gw-xxxxxxxx

Protocol version: MCP 2025-06-18, transport: streamable-http, stateless JSON-RPC 2.0.

2. Connect in Claude Code
Edit ~/.claude/mcp.json and add the muirouter server.
{
  "mcpServers": {
    "muirouter": {
      "url": "https://api.muirouter.com/mcp",
      "headers": {
        "Authorization": "Bearer sk-gw-xxxxxxxx"
      }
    }
  }
}

After restarting Claude Code, type /mcp to see the muirouter tool list.

3. Connect in Cursor / Claude Desktop
Fill in the same URL and Authorization header.

Cursor: Settings → MCP → Add new server, choose the streamable-http type, set the URL to https://api.muirouter.com/mcp, and add a custom header Authorization: Bearer sk-gw-....

Claude Desktop: edit the config file (macOS: ~/Library/Application Support/Claude/claude_desktop_config.json) with the same configuration as Claude Code above.

4. Available tools
Six tools covering account queries, pricing, image generation and top-ups.
get_balance

Query the wallet balance, total top-ups and total spending for the user that owns the current API key.

{ "name": "get_balance", "arguments": {} }
get_usage

Paginate through the current user's API usage, filterable by model and time range.

{ "name": "get_usage", "arguments": { "limit": 20, "model": "gpt-4o" } }
list_recharges

Paginate through the current user's top-up records.

{ "name": "list_recharges", "arguments": { "limit": 20 } }
list_models

List every model MuiRouter currently supports and its pricing (input/output, markup_rate).

{ "name": "list_models", "arguments": {} }
create_topup_session

Create a Stripe top-up session and return a payment link the AI client can guide the user through.

{ "name": "create_topup_session", "arguments": { "amount_cents": 1000, "currency": "usd" } }
image_generation

Call the OpenAI-compatible image generation endpoint through MuiRouter (consumes wallet balance).

{ "name": "image_generation", "arguments": { "model": "gpt-image-2", "prompt": "a cute cat" } }
5. Direct JSON-RPC calls
You can also call it directly with curl, without an MCP client.
# List tools
curl -X POST https://api.muirouter.com/mcp \
  -H "Authorization: Bearer sk-gw-xxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{"jsonrpc":"2.0","id":1,"method":"tools/list"}'

# Call get_balance
curl -X POST https://api.muirouter.com/mcp \
  -H "Authorization: Bearer sk-gw-xxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{
    "jsonrpc":"2.0",
    "id":2,
    "method":"tools/call",
    "params": {"name":"get_balance","arguments":{}}
  }'
6. Security notes

Your API key is like a password — never expose it in a public repository or chat log. If you suspect it leaked, revoke it immediately on the Keys page.

image_generation and create_topup_session spend or move money. Consider setting these two tools to require confirmation in your AI client.

Every request is tied to the account behind its sk-gw- key, with the same concurrency and billing rules as calling the REST API directly.

Related