Inference Mcp

io.github.BSVKey由 GitHub 账号 BSVKey 发布v1.3.6更新于 Oct 30, 2026

Pay-per-token Claude & Grok inference, settled in Bitcoin BSV. npm package or hosted remote.

已验证Streamable HTTP可网页运行金融AI 与机器学习

概览

AI 生成的概览

通过托管网关按 token 计费购买 Claude 与 Grok 推理,以比特币 BSV 结算,也可按次用 BSV 或 XRP 付款。

可以做什么
  • 列出网关提供的模型及实时每千 token 聪价格
  • 执行一次 OpenAI 兼容推理,从预付通道按 token 扣费,返回结果与签名用量收据
  • 查询通道剩余 BSV 余额、已花费金额与请求次数
  • 说明如何开通并充值预付通道
  • 通过 x402 按次用 BSV 付款:先取报价,在自己的钱包中签名,再带付款重新调用
  • 在 XRP Ledger 上以同样两步方式按次用 XRP 付款
适用场景
适合需要 Claude 或 Grok 补全、但没有信用卡、订阅或模型厂商账号,并愿意用 BSV 或 XRP 付费的智能体。也适合希望借助签名收据获得可审计的按 token 计量的无人值守客户端。
运行要求
可使用托管远程端点,或在本地以 Node 18 及以上运行 npm 包(XRP 付款需 Node 20.19+ 或 22.12+)。infer 与 channel_balance 需要预付通道密钥,放在 BSVKEY_API_KEY 或 Authorization 头中;x402_infer 需要已充值的 BSV WIF(BSVKEY_WIF);xrp_infer 需要已充值的 XRP 种子(BSVKEY_XRP_SEED)。本地签名与收据校验需额外可选包。需要能访问网关的网络。
安装前请注意
每次付费调用都会花费真实加密货币:通道资金按 token 扣减,按次付款在链上结算。BSVKEY_WIF 与 BSVKEY_XRP_SEED 是已充值的私钥或种子;托管服务器会拒绝它们,只有本地包会使用。若按次付款已结算但模型提供方随后失败,不会自动退款。收据校验依赖固定的密钥端点,未设置 BSVKEY_RECEIPT_STATE 时序列连续性只保存在内存中。

安装

在 SourceWeft 中

  1. 打开 控制台中的 Inference Mcp,将其添加到工作区。
  2. 为需要使用其工具的对话启用该服务。

Web executable,通过 Streamable HTTP。 远程服务在工作区中配置后即可从网页运行时运行。

交给智能体安装

把这段提示词粘贴到 Claude Code、Codex、Cursor 等智能体,或 SourceWeft 对话中。智能体会读取该服务器的安装指南,先向你展示发布者、端点和登录方式,经你同意后再把它添加到你的客户端。密钥不会写进任何命令。

阅读 https://sourceweft.com/mcp/io.github.BSVKey%2Finference-mcp/install.md,并按其中说明把这个 MCP 服务器接入我的客户端。修改任何配置之前,先告诉我它的发布者、端点和登录方式,等我确认。不要把 API 密钥写进命令或我会提交的文件;问我密钥应从哪里获取。

查看智能体所依据的安装指南

其他 MCP 客户端

把它添加到你客户端的 mcpServers 配置中。

{
  "mcpServers": {
    "inference": {
      "type": "http",
      "url": "https://inference.bsvkey.com/mcp"
    }
  }
}

README

@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, receiptVerified is null (unknown), never true — a down pin weakens the check to unknown, not to trusted.
  • Supply your funded amount. Set BSVKEY_FUNDED_SATS (or pass fundedSats) to the amount you funded on-chain. The receipt's own fundedSats is 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_STATE to a file path to persist per-channel seq/totals so replays are caught across restarts.
  • The receipt is the ledger. The GET /v1/channels/:id balance 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

  1. 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.
  2. Add the MCP server to your agent host (below), with that key in BSVKEY_API_KEY.
  3. Ask your agent to run inference — it calls infer and pays per token.

list_models and open_channel work with no key; infer and channel_balance need a funded channel key.

Install

Published on npm as @bsvkey/inference-mcp.

Claude Code

bash
claude mcp add bsvkey-inference \  --env BSVKEY_API_KEY=channelId:channelSecret \  -- npx -y @bsvkey/inference-mcp

Claude Desktop / Codex / any MCP host (JSON config)

json
{  "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.

bash
claude mcp add --transport http bsvkey-inference https://inference.bsvkey.com/mcp \  --header "Authorization: Bearer channelId:channelSecret"
json
{  "mcpServers": {    "bsvkey-inference": {      "type": "http",      "url": "https://inference.bsvkey.com/mcp",      "headers": { "Authorization": "Bearer channelId:channelSecret" }    }  }}
  • list_models and open_channel need no header.
  • infer and channel_balance use the prepaid channel key in the Authorization header (or apiKey per call).
  • The hosted server never takes a private key. x402_infer (Bitcoin BSV) and xrp_infer (XRP) are two steps there: call without payment to get the quote, sign it in your own wallet, then call again with payment (the base64 X-PAYMENT value). A wif or xrpSeed argument 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)

VarDefaultMeaning
BSVKEY_BASE_URLhttps://inference.bsvkey.com/v1Gateway base URL (set to a self-hosted deployment if you run your own).
BSVKEY_API_KEY—channelId:channelSecret for a funded channel. Optional; can also be passed per call as apiKey.
BSVKEY_FUNDED_SATS—The amount you funded your channel with on-chain. When set, receipts are verified against it instead of the broker-signed fundedSats. Optional; per-call fundedSats.
BSVKEY_XRP_SEEDnoneAn XRP wallet seed for xrp_infer. Optional; can also be passed per call as xrpSeed. Never leaves this process.
BSVKEY_RECEIPT_STATE—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, ...]
CodeStatusToolWhat it meansWhat to do
no_channel_keyinfer, channel_balanceNo apiKey and no BSVKEY_API_KEYOpen a channel at the site (see open_channel)
invalid_channel401 / 404infer, channel_balanceChannel not found, wrong secret, or closedOpen a new channel
insufficient_balance402inferThe channel can't cover the worst case for this call; extras give requiredSats and balanceSatsTop up at the site, or lower maxTokens / turn off webSearch
invalid_request400infer, x402_inferUnknown model or policy, a model whose provider isn't enabled, or bad inputCall list_models
upstream_failed502inferThe model provider failedNothing is charged; retry or pick another model
no_wifx402_inferNo wif and no BSVKEY_WIFPass a funded key
verifier_missingx402_infer@bsvkey/x402-bsv-client / @bsv/sdk not installednpm i @bsvkey/x402-bsv-client @bsv/sdk
payment_failed402x402_inferThe payment didn't settle (e.g. the key's address is unfunded); extras give the reasonFund the address; nothing was spent
upstream_failed502x402_inferThe payment settled but the provider then failed; extras give settlementTxidNo automatic refund: email [email protected] with the txid
no_xrp_seedxrp_inferNo xrpSeed and no BSVKEY_XRP_SEEDPass a funded XRP seed
xrpl_missingxrp_inferThe xrpl package isn't installednpm i xrpl
node_too_oldxrp_inferNode is older than 20.19 / 22.12, which the xrpl package needsUpgrade Node (the other tools run on Node 18+)
insufficient_xrpxrp_inferThe wallet isn't activated, or can't cover the quote above its 1 XRP reserveFund it; nothing was spent
payment_failed402xrp_inferThe payment was refused before broadcast, or didn't settle; extras give the reasonNothing was spent unless a settlement tx is included
upstream_failed502xrp_inferThe payment settled but the provider then failed; extras give the settlement txNo automatic refund: email [email protected] 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)

bash
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.js

Marketplace 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 @bsvkey org (owner: interence). First publish: v1.0.0.
  • To ship an update: bump version in package.json, then npm 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.

来源:README.md,提交 32165ca

工具

6

list_models

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.

无需输入参数。

infer

Run one metered inference (OpenAI-compatible), paid per token in Bitcoin BSV from your prepaid channel. Returns the completion plus a receipt: satoshis charged, model routed to, remaining balance, and the broker-signed usage receipt. Needs a funded channel key: send the HTTP header "Authorization: Bearer channelId:channelSecret" with the MCP request, or pass apiKey. 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. On failure the tool returns isError with text "error: <code> (<http status>): <message>". Codes: no_channel_key (no Authorization header and no apiKey); invalid_channel (401: channel not found, bad secret, or closed; open a new one); insufficient_balance (402: the channel cannot cover the worst case for this call; the text includes requiredSats and balanceSats; top up at the website, or lower maxTokens / turn off webSearch); invalid_request (400: unknown model or policy, a model whose provider is not enabled, or a malformed prompt; call list_models); upstream_failed (502: the model provider failed; nothing is charged, retry or pick another model). Nothing is charged on any error. This server does not verify its own receipt: check usageReceipt offline with @bsvkey/x402-bsv-client (verifyReceipt, verifyCharge, verifyMeter) against the key at /v1/receipt-key.

输入参数modelapiKeyprompt必填systemmaxTokenswebSearch

channel_balance

Check a prepaid channel’s remaining Bitcoin BSV balance, spend, and request count. Uses the Authorization header or apiKey. On failure returns isError "error: <code> (<status>): <message>": no_channel_key, or invalid_channel (401/404: not found, bad secret, or closed).

输入参数apiKey

open_channel

Explains how to open + fund a prepaid channel. Funding is a real Bitcoin BSV payment signed by a wallet, so it is done once at the website; you then send the returned channel key as "Authorization: Bearer channelId:channelSecret" (or pass it as apiKey).

无需输入参数。

x402_infer

Run one inference paid PER CALL in Bitcoin BSV via x402, no prepaid channel. Non-custodial, two steps: (1) call without payment to get the 402 quote (status payment_required, accepts[]); nothing is spent. (2) Build and sign a BSV payment for that quote in your own wallet (for example fetchWithX402 / buildPayment in @bsvkey/x402-bsv-client) and call again with the same prompt, model, maxTokens and webSearch plus payment = the base64 X-PAYMENT value. Returns the completion plus the on-chain settlement txid. This server never takes a private key: a wif argument is refused. On failure returns isError "error: <code> (<status>): <message>". Codes: key_refused (a private key was sent; it was not used or forwarded); payment_failed (402: the payment did not settle; nothing is spent); invalid_request (400: unknown model or bad input; nothing is spent); upstream_failed (502: the payment SETTLED but the model provider then failed; the text includes the settlement txid. There is no automatic refund: contact [email protected] with that txid).

输入参数modelprompt必填systempaymentmaxTokenswebSearch

xrp_infer

Run one inference paid PER CALL in XRP on the XRP Ledger via x402, no channel. Non-custodial, two steps: (1) call without payment to get the 402 quote (exact drops, destination, destination tag, signed quote; priced from the XRP Ledger's own XRP/RLUSD market); nothing is spent. (2) Sign one XRP Payment for exactly that in your own wallet and call again with the same prompt, model and maxTokens plus payment = base64 of {"x402Version":1,"scheme":"exact","network":<from quote>,"payload":{"txBlob":<signed blob>,"quote":<accepts[0].extra.quote>}}. The broker checks the payment before broadcasting it, waits for validation (a few seconds), and returns the completion, the settlement tx hash, and a signed receipt. This server never takes a wallet seed: an xrpSeed argument is refused. On failure returns isError "error: <code> (<status>): <message>". Codes: key_refused; pending (202: submitted but not validated yet; call again with the same payment); payment_failed (402: the payment was refused before broadcast or did not settle; nothing is spent unless the text includes a settlement tx); invalid_request (400); upstream_failed (502: the payment SETTLED but the model provider then failed; the text includes the settlement tx. No automatic refund: contact [email protected] with it).

输入参数modelprompt必填systempaymentmaxTokens

版本历史

7
  1. v1.3.6最新Oct 30, 2026
  2. v1.3.5Oct 26, 2026
  3. v1.3.4Oct 13, 2026
  4. v1.3.3Oct 1, 2026
  5. v1.3.2Sep 23, 2026
  6. v1.2.4Sep 23, 2026
  7. v1.2.2Sep 16, 2026

评分

已满足适用检查项的 100%

该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。

  • 近 30 天内可连通必需25 分
  • 已声明认证方式必需10 分
  • 已列出工具必需15 分
  • 描述必需15 分
  • 图标10 分
  • 文档15 分
  • 许可证10 分