MuiRouter

Model Context Protocol (MCP) Router & Gateway

MCP Router & Integration Guide

MuiRouter provides a high-performance streamable-HTTP MCP server and router. Connect AI clients like Claude Desktop, Claude Code, Cursor, and Cline to route LLMs, aggregate multiple local and remote MCP servers, and access built-in account tools with your own API key.

1. Dual-Era Protocol Support
Built to support the latest 2026-07-28 stateless streamable-HTTP spec while seamlessly negotiating with legacy 2025-11-25 / 2025-06-18 clients.

Modern Spec (2026-07-28): Stateless streamable-HTTP, explicit _meta & headers (MCP-Protocol-Version), server/discover discovery, and DNS rebinding protection.

Legacy Compatibility (2025-11-25 / 2025-06-18): Automatic handshake negotiation for initialize-based clients.

2. Server Endpoint & Authentication
All MCP clients connect to the same streamable-HTTP URL using Bearer auth.
Endpoint
POST https://api.muirouter.com/mcp
Header
Authorization: Bearer sk-gw-xxxxxxxx
3. Multi-Server Aggregation (Claude Code)
Add MuiRouter alongside your local MCP servers in ~/.claude/mcp.json for centralized routing.
{
  "mcpServers": {
    "muirouter": {
      "url": "https://api.muirouter.com/mcp",
      "headers": {
        "Authorization": "Bearer sk-gw-xxxxxxxx"
      }
    },
    "local-tools": {
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/server-everything"]
    }
  }
}

Restart Claude Code and type /mcp to view the aggregated tool list across all connected servers.

4. Connect in Cursor / Claude Desktop / Cline
Configure streamable-HTTP with the same endpoint and Authorization header.

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

Claude Desktop: Edit configuration file (~/Library/Application Support/Claude/claude_desktop_config.json) with the same JSON configuration.

5. Built-in Account & AI Tools
Six built-in tools covering model routing, account queries, image generation, and instant 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" } }
6. Direct JSON-RPC & curl Debugging
Test server discovery, tool listing, and tool calls directly using curl without an MCP client.
# Discover server capabilities (Modern 2026-07-28)
curl -X POST https://api.muirouter.com/mcp \
  -H "Authorization: Bearer sk-gw-xxxxxxxx" \
  -H "MCP-Protocol-Version: 2026-07-28" \
  -H "Mcp-Method: server/discover" \
  -H "Content-Type: application/json" \
  -d '{"jsonrpc":"2.0","id":1,"method":"server/discover","params":{"_meta":{"protocolVersion":"2026-07-28"}}}'

# 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":2,"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":3,
    "method":"tools/call",
    "params": {"name":"get_balance","arguments":{}}
  }'
7. Security & Best Practices

Your sk-gw- API key acts as a credential — never expose it in public repositories. Revoke immediately on the Keys page if compromised.

Financial actions like image_generation and create_topup_session move funds; configure your AI client to require interactive confirmation.

Origin verification protects against DNS rebinding attacks; all calls respect standard account concurrency and rate limits.

Related Guides & Comparisons