products / toolclient
Your agent calls every tool through ToolClient: free tools pass through untouched, paid tools just work inside the budget you set. Nothing can be spent that you didn't explicitly allow, including zero.
import { ToolClient, l402Payer } from "@bolthub/pay";
const client = new ToolClient({ payers: [l402Payer({ wallet })], maxTotal: { sat: 10_000 }, // lifetime ceiling, per asset maxPerCall: { sat: 500 }, // per-call ceiling onPaid: ({ amount, asset, resource }) => console.log(`paid ${amount} ${asset} for ${resource}`),});
// Free tools pass through untouched. Paid tools are paid within the// budget and retried with proof — or refused if they'd exceed it.const result = await client.callTool(mcp, "get_satellite_image", { lat: 47.4979, lon: 19.0402,});Because the day a tool starts charging, or your agent wanders into a paid one, is not the day you want to discover your spend controls don’t exist. With ToolClient in the path from day one, paid tools are a budget line you already control instead of an integration project — and until then it does nothing but pass calls through.
Per-asset ceilings, lifetime and per call, enforced before any payment leaves. Configure zero and the agent can't spend at all — free tools still work.
Open source (MIT) with zero runtime dependencies. You can audit exactly what sits between your agent and its tools — and there isn't much.
onPaid and stage callbacks report what was paid, to whom, on which rail, so spend is loggable and alertable like any other telemetry.
Budgets are per asset because sats and stablecoins aren’t comparable. Reservations are taken synchronously, so concurrent calls can’t race past the ceiling.
bun add @bolthub/payToolClient speaks the open wire formats, not a bolthub API. The L402 payer answers any conforming Lightning challenge, and the x402 payer signs the standard stablecoin authorization used across the x402 ecosystem, so tools that have never heard of bolthub can still get paid. Read L402 vs x402 for how the rails differ.
The next release adds a proxy: a single entry in Cursor or Claude Desktop that wraps every MCP server you use. Free tools pass straight through; payment challenges are handled inside your budget. It runs locally, stays open source, and any telemetry is opt-in only.
Real-world use
Your agent pulls from a dozen MCP tools; two charge per call. Give ToolClient a 10,000-sat lifetime budget and a 500-sat per-call cap. The agent works normally, pays the two paid tools as it goes, refuses anything above the cap, and stops spending at 10,000 sats no matter what it decides to do. You read the spend from the onPaid log like any other metric.
start calling
Wire bolthub into Cursor, Claude Desktop, or your own orchestrator. Add your wallet, set a budget, and your agent can discover and call any listed tool. Building in code? Python and TypeScript SDKs call any hub API directly.