routstr-mcp
This MCP server lets an AI agent query many LLMs sold on Routstr, paying per call in sats from a prepaid Lightning balance.
Ask a single model (
ask): send a model id, prompt and optional system prompt; get the answer plus a structured cost receipt, with a spend cap viamax_sats(default 100, max 500 sats).Compare several models (
council): ask 2 to 5 models the same question at once and get each answer with its own cost, for side-by-side comparison.Discover and price models (
find_models): search approved Routstr nodes' catalogs by keyword (e.g. "claude", "gpt 5", "qwen coder"), listed cheapest first with prices in sats.Check your funds (
balance): see sats remaining per node and how to top up.Calls are read-only or paid-but-bounded actions: the prepaid balance is a hard cap, each call has a spend target, and no tool can move funds (no funding/refund tool exposed).
The full project also ships
delegate,quoteand CLI commands (fund, refund, spend, nodes, import) beyond the four tools listed in this schema.
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., "@routstr-mcp ask gpt-5 for a second opinion on this function"
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.
routstr-mcp
Give your AI agent every model sold on Routstr, paid in sats.
routstr-mcp is an MCP server. Add it to Claude Code, Codex, Cursor, Claude Desktop or any other MCP app, and the agent gets these tools:
Tool | What it does |
| Ask one model and get its answer and a structured cost receipt |
| Ask 2 to 5 models the same question and get a cost receipt for each answer |
| Hand a whole task to another model, which works in your project on its own with file tools |
| Estimate the cost and output limit for an exact prompt without calling a model |
| Search the models on approved Routstr nodes, cheapest first, with prices in sats |
| Sats left, per node, and what was spent today |
Use it to put the right model on each job: a second opinion from a different model, several models compared side by side, or a review or a self-contained change handed to a cheaper one such as Kimi, GLM, DeepSeek or Qwen. There is no account and no card: you prepay a few sats over Lightning, and that prepaid balance is the most the agent can ever spend.
ask, council and quote
Pass files (project paths) to send files along with the prompt, and images (project paths or https URLs) for a model that takes images. find_models with vision: true lists those. Secret files such as .env and keys are refused, and key-shaped strings in a file are removed before it leaves your machine.
Call quote with the same model, prompt, optional system, and max_sats you plan to pass to ask. It returns the selected model and node, advertised rates, and the estimated cost of the initial request. Pass the returned model and node to ask to keep the request on that node. The quote uses catalog prices, and the node can select its own upstream route and settle a different amount.
ask returns its receipt in structuredContent.receipt. It includes the estimate, output limit, and node charge when available. The receipt also records the request ID, upstream provider, token counts (including reasoning and cache counts), and finish reason when reported. costSource distinguishes node-reported charges, estimates based on token usage, and unavailable costs. overTarget flags a reported charge above the requested target, and extraFees flags a model whose node also bills web search or reasoning.
For reasoning models, pass reasoning_effort (for example "low") to request less thinking. The serving route determines which efforts it supports.
delegate
delegate runs a subagent: the model you name gets the task and tools to list, read, glob and grep files and to look at git (status, diff, log, show), and works through it step by step until it reports back. You get its report, the files it changed as a diff, the commands it ran and the cost.
access: "read"(the default) only looks. When the model edits a file, the change is kept as a proposal and comes back as a patch you can apply withgit apply. Up to 3modelscan do the same task at once, to compare their work.access: "edit"also writes files in the project.access: "shell"also runs commands, such as tests, in a sandbox with no network. Reads stay inside the project, system folders and your toolchains; writes stay inside the project, and.git, git hooks and shell settings stay read-only, so a command cannot plant code that runs later. It uses sandbox-runtime: macOS needs nothing extra, Linux needsbubblewrap,socatandripgrep.
Use edit or shell on a clean git tree, so you can see and undo every change. The subagent works in the folders your MCP app has open, else ROUTSTR_WORKSPACE, else the folder the app started the server in; cwd narrows it to a subfolder. It never reads secret files or folders (.env, keys, .git internals, ~/.ssh, wallets).
max_sats is the budget for the whole run (default 300, at most 2000) and max_steps the most model calls (default 30). Each step is paid as it goes, and the model is told to wrap up when the budget runs low. The report ends with a session id: pass it as session with a follow-up task within 30 minutes to continue the same run. Long runs send progress notes, and cancelling the tool call stops the run.
Set up
Add it to your MCP app. For Claude Code:
claude mcp add routstr -- npx -y routstr-mcpFor Codex, in
~/.codex/config.toml(a longer tool timeout letsdelegatefinish):[mcp_servers.routstr] command = "npx" args = ["-y", "routstr-mcp"] tool_timeout_sec = 900For Cursor (
.cursor/mcp.json), Claude Desktop and other apps:{ "mcpServers": { "routstr": { "command": "npx", "args": ["-y", "routstr-mcp"] } } }In Claude Code,
MCP_TOOL_TIMEOUT=900000gives longdelegateruns room too.Add sats. In a terminal:
npx routstr-mcp fund 2000It shows a Lightning invoice as a QR code. Pay it from any Lightning wallet and you are done. To fund the node that sells a model cheapest, add
--model <id>.Ask your agent something like "ask gpt-5 for a second opinion on this function", "run a council of three models on this question" or "delegate a security review of src/ to kimi".
Related MCP server: Maximum Sats MCP
Commands
routstr-mcp start the MCP server (what your MCP app runs)
routstr-mcp fund <sats> pay a Lightning invoice to add sats
--model <id> on the cheapest node that sells this model
--node <url> on this node
routstr-mcp balance sats left, per node
routstr-mcp refund take all unspent sats back as a Cashu token
--to <lightning address> or send them to a Lightning address
--node <url> only from this node
routstr-mcp spend what calls cost: today, per day and per model
--days <n> look back this many days (default 7)
routstr-mcp nodes approved nodes and how many models each sells
routstr-mcp import --node <url> add a Routstr key you already have (read from stdin)How your sats stay safe
The prepaid balance is a hard cap. Your sats sit on the node as the balance of a Routstr API key. Nothing can spend more than you paid in.
Each call has a spend target. The agent can pass
max_sats(default 100, at most 500). This sizes the output token limit using the catalog estimate. The node settles the charge, which can exceed the target. Adelegaterun has a budget for all its steps.You can set a daily limit. With
ROUTSTR_DAILY_SATS, calls stop for the day once that much is spent. Every paid call is logged to~/.routstr-mcp/spend.jsonl;routstr-mcp spendsums it up.The agent never sees a secret. API keys, invoices and Cashu tokens stay in the wallet file and the terminal, and are removed from anything a node sends back. There is no tool that funds or refunds, so the MCP tools alone cannot move your sats. An agent that also has a shell (Claude Code, Cursor) could still run the CLI or read the wallet file, so keep your app asking before it runs commands. A
delegatesubagent cannot reach the wallet: it is outside the project, and the shell sandbox blocks the home folder.The wallet is private. It lives in
~/.routstr-mcp/wallet.json, readable only by you. A refund token is also saved in~/.routstr-mcp/refunds/before the key is dropped, so a crash cannot lose it.A stopped payment is not lost. If you pay after closing the
fundcommand, the sats are picked up the next time the wallet is used.
Which nodes it uses
Nodes announce themselves on Nostr. routstr-mcp uses the same rule as the Routstr SDK: a node is used only when the Routstr curator's latest review of it is positive (trusted, verified, lgtm) and no review is negative. Only public HTTPS addresses are used, never a local network, localhost or onion address. If a node is down, out of sats for you or cannot serve the model right now, a call moves to the next node where you have sats. It never moves on once a node may have charged for the call.
Settings
Variable | Default | |
| found on Nostr | Comma separated node URLs to use instead of discovery |
|
| Default spend target in sats |
|
| Maximum spend target the agent can request |
|
| Default budget for one |
|
| Maximum budget the agent can give one |
| none | Most that all calls together may spend in a day |
| the open folder | Comma separated project folders for |
| damus, nos.lol, relay.routstr.com | Nostr relays for discovery |
| the Routstr curator | Pubkey whose reviews approve nodes |
|
| Where the wallet lives |
Development
Node 22 or newer.
npm install
npm test # logic testsThe end to end tests run a real stack on your machine: two routstr-core nodes, a real Cashu mint (nutshell, with fake Lightning so invoices pay at once) and a fake AI. They need uv, Python 3.12 and a routstr-core checkout with its venv:
git clone https://github.com/Routstr/routstr-core && (cd routstr-core && uv sync --frozen --no-dev --python 3.12)
KIT_CORE_DIR=$PWD/routstr-core npm run test:e2eSet E2E_PYTHON if your Python 3.12 is not at /usr/bin/python3.12.
License
MIT
Available Tools
4 toolsaskAsk a Routstr modelA
Ask any model sold on Routstr and get its answer, paid in sats from the user's prepaid balance. Good for a second opinion, a model with different strengths, or a cheap model for a simple job. The cost is shown.
Inputs: model (required), prompt (required), system, max_sats.
balanceRoutstr balanceARead-only
Show the sats left in the user's Routstr wallet, per node, and how to add more.
Inputs: no named parameters.
councilAsk several Routstr modelsA
Ask 2 to 5 models the same question at once and get every answer with its cost, to compare them. You weigh the answers yourself.
Inputs: models (required), prompt (required), system, max_sats_each.
find_modelsFind Routstr modelsARead-only
Search the models sold by approved Routstr nodes, cheapest first, with prices in sats. Every word of the query must match, e.g. "claude", "gpt 5", "qwen coder". Empty lists the cheapest.
Inputs: limit, query.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 4 tools
Each tool targets a clearly distinct action: discovery (find_models), single-model query (ask), multi-model comparison (council), and wallet inspection (balance). The only close pair, ask vs council, is explicitly separated by 'one model' vs '2 to 5 models at once'. An agent can select correctly from names alone.
Names mix verbs (ask, find_models) with bare nouns (council, balance), so there is no predictable verb_noun pattern. Each name is still short and readable, but the convention is inconsistent across the set.
Four tools is on the thin side but each maps to a genuine step in the workflow: find a model, query one, compare several, check funds. Nothing is redundant and nothing feels bolted on.
The read/query lifecycle is covered, but there is no tool to actually add sats to the balance (only a description of 'how to add more'), and no request/cost history for auditing spend. These gaps force agents into dead ends for anything beyond a one-shot query.
Maintenance
Related MCP Connectors
Pay-per-action access to APIs and MCP tools over Lightning L402 and Base USDC x402.
Pay-per-call LLM chat plus data tools: DNS, crypto, Base gas, Wikipedia. x402 USDC or Lightning.
17-model LLM gateway + 350+ data/KYB/sanctions tools. Pay-per-call USDC via x402, no API key.
Agent registry with Nostr identity, reputation, escrow, observability, and Lightning payments.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceEnables AI models to interact with the Lightning Network by providing an MCP-compliant API to pay invoices.38 npm6MIT
- AlicenseAqualityDmaintenanceProvides tools for AI agents to access Bitcoin, Lightning Network, and Nostr knowledge, including real-time network statistics and Web of Trust reputation data. It features an integrated Lightning Network payment system for micro-transactions and query-based interactions.126 npm2MIT
- AlicenseAqualityBmaintenancePay-per-request AI with Bitcoin Lightning: Claude, GPT, Gemini, DeepSeek, Mistral and more. Load a prepaid spend token, no account or provider API keys. You only pay for successful calls.5223 npm2MIT
- AlicenseNot gradedqualityDmaintenanceLightning Network trust oracle for AI agents. Provides real-time node reachability checks, trust scores, and personalized pathfinding for 17,000+ Lightning nodes via 12 MCP tools.3 npmAGPL 3.0