@bsvkey/inference-mcp
An MCP server for buying Claude & Grok inference metered per token and settled in BSV via a prepaid channel.
List available models with live retail prices in satoshis per 1,000 tokens.
Run metered inference with a prompt, optional system prompt, model/policy, max tokens, and optional web search, paid from a funded BSV channel.
Check a prepaid channel’s remaining BSV balance, spend, and request count.
Learn how to open and fund a prepaid channel, which is done once on the website.
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., "@@bsvkey/inference-mcp Use Claude to summarize this article and show the BSV cost."
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.
@bsvkey/inference-mcp
An MCP server that lets any agent buy Claude & Grok inference metered per token,
settled in BSV, through the hosted gateway at inference.bsvkey.com. Zero
dependencies (Node ≥ 18, uses global fetch). It's a thin HTTP client — it never
holds your keys or runs models; every call is billed through the gateway.
Tools: list_models, infer, channel_balance, open_channel, x402_infer, xrp_infer.
Two ways to pay: a prepaid channel (infer, fund once, draw down per token) or
per call via x402 (x402_infer — no channel; the agent pays each request in BSV
with its own key). x402_infer needs a funded WIF (wif arg or BSVKEY_WIF) and the
optional @bsvkey/x402-bsv-client + @bsv/sdk packages (installed with this one).
Pay per call in XRP with xrp_infer: the tool gets a quote in XRP (priced from
the XRP Ledger's own XRP/RLUSD market), signs one XRP Payment for exactly that
locally, and the gateway checks it before broadcasting, waits for validation (a few
seconds), and returns the answer, the settlement tx, and a signed receipt. It needs
a funded XRP seed (xrpSeed arg or BSVKEY_XRP_SEED; create one at
xrp.bsvkey.com/wallet) and the optional xrpl
package (installed with this one; it needs Node 20.19+ or 22.12+). The account
keeps a 1 XRP reserve that can't be spent.
Verifiable metering. Each infer call returns a signed usage receipt, and the
tool auto-verifies it offline (with the optional packages installed): the result
includes receiptVerified and meterVerified (true, false + receiptCheck,
or null). It recovers the broker key (pinned from GET /v1/receipt-key); binds
the receipt to the channel you called (from your API key, not the receipt's
self-report); checks a monotonic sequence (no replay/gap) and running totals within
the funded amount; recomputes the charge from the published rate (you can never
be overcharged); and recomputes the token count from the exact bytes of your
messages and the completion, under the pinned bsvkey-meter/1 tokenizer. So the
channel payment is on-chain and both the meter and the charge are auditable,
without trusting the broker's word.
Four things an unattended client should know:
Fails closed. If the pinned-key endpoint is unreachable,
receiptVerifiedisnull(unknown), nevertrue— a down pin weakens the check to unknown, not to trusted.Supply your funded amount. Set
BSVKEY_FUNDED_SATS(or passfundedSats) to the amount you funded on-chain. The receipt's ownfundedSatsis the broker's assertion; when you supply yours, a receipt claiming a different amount is rejected and totals are checked against what you actually paid.Persist across restarts. Sequence continuity is in-memory by default (a replay before the first receipt this process sees would be invisible). Set
BSVKEY_RECEIPT_STATEto a file path to persist per-channelseq/totals so replays are caught across restarts.The receipt is the ledger. The
GET /v1/channels/:idbalance endpoint can lag the signed receipt by ~20s; trust the receipt, treat the endpoint as a cache.
Spec: https://inference.bsvkey.com/usage-receipts.md
Quick start
Fund a channel once at https://inference.bsvkey.com (BRC-100 wallet, or load a key in-page). Copy the key it returns:
channelId:channelSecret.Add the MCP server to your agent host (below), with that key in
BSVKEY_API_KEY.Ask your agent to run inference — it calls
inferand pays per token.
list_models and open_channel work with no key; infer and channel_balance
need a funded channel key.
Related MCP server: x402-gateway-mcp
Install
Published on npm as @bsvkey/inference-mcp.
Claude Code
claude mcp add bsvkey-inference \
--env BSVKEY_API_KEY=channelId:channelSecret \
-- npx -y @bsvkey/inference-mcpClaude Desktop / Codex / any MCP host (JSON config)
{
"mcpServers": {
"bsvkey-inference": {
"command": "npx",
"args": ["-y", "@bsvkey/inference-mcp"],
"env": { "BSVKEY_API_KEY": "channelId:channelSecret" }
}
}
}No npm? Grab the single-file server directly (https://inference.bsvkey.com/mcp/server.js) and use "command": "node", "args": ["server.js"].
Hosted (no install)
Any MCP host that supports remote servers can connect to
https://inference.bsvkey.com/mcp (Streamable HTTP). Same six tools, nothing
to install.
claude mcp add --transport http bsvkey-inference https://inference.bsvkey.com/mcp \
--header "Authorization: Bearer channelId:channelSecret"{
"mcpServers": {
"bsvkey-inference": {
"type": "http",
"url": "https://inference.bsvkey.com/mcp",
"headers": { "Authorization": "Bearer channelId:channelSecret" }
}
}
}list_modelsandopen_channelneed no header.inferandchannel_balanceuse the prepaid channel key in theAuthorizationheader (orapiKeyper call).The hosted server never takes a private key.
x402_infer(Bitcoin BSV) andxrp_infer(XRP) are two steps there: call withoutpaymentto get the quote, sign it in your own wallet, then call again withpayment(the base64X-PAYMENTvalue). AwiforxrpSeedargument is refused.The hosted server returns the signed usage receipt but does not verify it for you; verify it offline with
@bsvkey/x402-bsv-client. To sign payments and verify receipts locally from a key, use the npm package above.
Configuration (env)
Var | Default | Meaning |
|
| Gateway base URL (set to a self-hosted deployment if you run your own). |
| — |
|
| — | The amount you funded your channel with on-chain. When set, receipts are verified against it instead of the broker-signed |
| none | An XRP wallet seed for |
| — | Path to a JSON file for persisting per-channel receipt continuity (seq + totals) across restarts. Optional; in-memory only if unset. |
Errors
A failed tool call returns isError: true with text in one fixed shape, so an
agent can branch on the code without parsing prose:
error: <code> (<http status>): <message> [extra=value, ...]Code | Status | Tool | What it means | What to do |
|
| No | Open a channel at the site (see | |
| 401 / 404 |
| Channel not found, wrong secret, or closed | Open a new channel |
| 402 |
| The channel can't cover the worst case for this call; extras give | Top up at the site, or lower |
| 400 |
| Unknown model or policy, a model whose provider isn't enabled, or bad input | Call |
| 502 |
| The model provider failed | Nothing is charged; retry or pick another model |
|
| No | Pass a funded key | |
|
|
|
| |
| 402 |
| The payment didn't settle (e.g. the key's address is unfunded); extras give the | Fund the address; nothing was spent |
| 502 |
| The payment settled but the provider then failed; extras give | No automatic refund: email embryospace@gmail.com with the txid |
|
| No | Pass a funded XRP seed | |
|
| The |
| |
|
| Node is older than 20.19 / 22.12, which the | Upgrade Node (the other tools run on Node 18+) | |
|
| The wallet isn't activated, or can't cover the quote above its 1 XRP reserve | Fund it; nothing was spent | |
| 402 |
| The payment was refused before broadcast, or didn't settle; extras give the | Nothing was spent unless a settlement tx is included |
| 502 |
| The payment settled but the provider then failed; extras give the settlement tx | No automatic refund: email embryospace@gmail.com with the tx |
On a prepaid channel nothing is charged on any error. A successful infer can
still report receiptVerified: false (the signed receipt didn't check out; see
receiptCheck) or null (couldn't check: verifier missing, or the receipt-key
endpoint was down).
Thinking models (claude-sonnet-5, claude-opus-5, claude-opus-5-5,
claude-fable-5-1) bill their hidden reasoning as output, and maxTokens is
raised to at least 1024 for them.
Verify it's wired (no key needed)
printf '%s\n' \
'{"jsonrpc":"2.0","id":1,"method":"initialize","params":{}}' \
'{"jsonrpc":"2.0","id":2,"method":"tools/list","params":{}}' \
'{"jsonrpc":"2.0","id":3,"method":"tools/call","params":{"name":"list_models","arguments":{}}}' \
| node server.jsMarketplace listing blurb
BSV Inference — Pay-per-token Claude & Grok, settled in BSV. Prepay a channel once, then meter every token with no subscription, account, or card. OpenAI- compatible, optional live web search, on-chain settlement. MCP + portable SKILL.md.
Publishing (operator)
Live on npm under the
@bsvkeyorg (owner:interence). First publish: v1.0.0.To ship an update: bump
versioninpackage.json, thennpm publish --access public(2FA/security-key prompt applies).Canonical source: https://github.com/BSVKey/inference-mcp
To list on a skills marketplace (e.g. bopen.ai), submit
SKILL.md+ this README.
Available Tools
4 toolschannel_balanceAInspect
Check a prepaid channel’s remaining BSV balance, spend, and request count.
Inputs: apiKey.
inferAInspect
Run one metered inference (OpenAI-compatible), paid per token in BSV from your prepaid channel. Returns the completion plus a receipt: satoshis charged, model routed to, and remaining balance. Requires a funded channel key (apiKey or BSVKEY_API_KEY).
Inputs: prompt (required), model, apiKey, system, +2 more.
list_modelsAInspect
List the models this BSV inference gateway sells, with LIVE retail price (satoshis per 1,000 tokens) at the current BSV/USD rate. No key needed. Call first to choose a model.
Inputs: no named parameters.
open_channelAInspect
Explains how to open + fund a prepaid channel. Funding is a real BSV payment signed by a wallet, so it is done once at the website; you then paste the returned channel key here (or set BSVKEY_API_KEY).
Inputs: no named parameters.
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 has a clearly distinct purpose: listing models, running inference, checking balance, and explaining channel setup. There is no meaningful overlap or ambiguity between them.
list_models and open_channel follow a verb_noun pattern, but infer is a bare verb and channel_balance is a noun phrase without an action verb. The names are readable and predictable in context, but the conventions are mixed.
Four tools is well-scoped for a paid inference gateway: discovery, usage, balance checking, and onboarding. Each tool serves a distinct and necessary step in the core workflow.
The core loop of choosing a model, running inference, checking balance, and funding/opening a channel is covered. Minor gaps like detailed transaction history or channel closure are absent, but agents can accomplish the primary purpose without dead ends.
Maintenance
Related MCP Connectors
Pay-per-call LLM + extract (no API key), prepaid wallets, scoped keys, BSV x402 MCP.
Prepaid inference for agents over hosted MCP. Chat, image, and video.
OpenAI-compatible LLM gateway: pay per request with an API key, signed receipt for each call.
Pay-per-call AI gateway: models, speech, web search, on-chain reads and NLP tools, via x402.
Related MCP Servers
- 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
- AlicenseAqualityFmaintenanceEnables MCP clients to access all endpoints of an x402 gateway by paying real-time microtransactions (USDC on Base) per API call, with automatic tool discovery and spend guardrails.2369 npmMIT
- AlicenseNot gradedqualityFmaintenanceEnables AI agents to pay per call for AI compute in Kaspa (KAS) over HTTP 402, with no account, API key, or human in the loop, settling each request on-chain.4MIT

Agentware MCPofficial
AlicenseAqualityCmaintenanceEnables MCP clients to browse and purchase agent packages and pay per call for model inference on Robinhood Chain using USDG, with no account or API key required.915 npmMIT