for tool builders
Add a price to any MCP tool or endpoint in a few lines with bolthub Pay: agents pay per call and you settle on the rail you choose, Lightning today and stablecoins (x402) next. No KYC, no middleman holding your funds.
import { createPaywall, l402Rail } from "@bolthub/pay";
// A rail needs a signing secret and something that makes invoices —// your wallet (NWC / LND / phoenixd / LNbits) or a bolthub facilitator.const pay = createPaywall({ rails: [l402Rail({ secret: process.env.PAY_SECRET!, invoiceProvider })],});
// Charge 2000 sats for one MCP tool call:pay.tool(server, "get_satellite_image", "Recent satellite imagery", schema, { price: { amount: 2000 } }, async (args) => ({ content: [{ type: "text", text: await fetchImage(args) }] }),);The agent-to-tool protocol standardises what a tool does, but it has no slot for what it costs. Card processors won’t touch a fraction-of-a-cent API call, so most tools fall back to subscriptions, prepaid credits, and the busywork of issuing and revoking API keys.
bolthub Pay fills that slot: a paid tool answers an unpaid call with a payment_required challenge and runs only once a valid proof comes back — over whatever rail you accept.
Price a tool once and accept Lightning today, stablecoins (x402) next — behind the same interface. Buyers pay in whatever they hold.
A few lines wrap a tool. No sales call, no KYC, no card processor onboarding. Your first paid call can happen today.
Payments settle straight to your wallet. bolthub is never in the funds path, so there is no balance to withdraw and nothing to freeze.
Wrap the tool, name a price, and you’re charging. Swap the rail later without rewriting the handler. The SDK is open source (MIT) and free to self-host, no account needed.
bun add @bolthub/payRun the SDK yourself for free, or connect a wallet once in the dashboard and point bolthub Pay at the hosted facilitator: replay protection, usage metering, analytics, and one-click setup. Same code, one swapped rail. Sats still land in your wallet; bolthub only ever sees the metering path. See pricing.
Building the other side? Give your agent a budget and let it pay for tools across rails. New to the wire format? Read L402 vs x402 — you don’t have to choose.
start selling
Self-host the SDK free, or start on the hosted platform: 1-month free trial, usage-based billing after that.