@zeam-labs/x402-mcp-bridge
OfficialProvides an ethers 6+ provider (PrismProvider) that connects to the x402 bridge, enabling paid RPC calls, line-based time purchases, and channel management through ethers-compatible clients.
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
@zeampass/client
@zeampass/client, version 4.1.1. Source: https://github.com/zeam-labs/pass-client
The buyer side of ZEAM :: Pass, for an agent that carries its own wallet: it stands in front of a paid MCP server or URL and pays from that wallet. To fund an agent without installing anything, give it a pass, a funded link: https://zeampass.com/
ZEAM :: Pass is the buyer side: a pass, or this client. Over MCP the client pays x402: per call, or it buys time and
rides a line on a ZEAM :: Bridge seller. Over HTTP, paid_fetch pays a URL's 402 as an x402 exact payment, as an
MPP charge, or from an x402 batch-settlement channel. It works with ZEAM :: Prism, with any ZEAM :: Bridge seller over MCP and over HTTP, with any x402 seller and, over HTTP, with a URL that takes an MPP evm charge.
With a session escrow pinned in PASS_SESSION_ESCROW it also pays by MPP session, over MCP and over HTTP: see
Paying by session.
Run it
--help and --version print and exit; neither contacts a server.
It needs Node.js 20 or later. Export your key as PASS_PRIVATE_KEY. It signs locally and is never sent.
npx -y @zeampass/client --tools
npx -y @zeampass/client --call call_rpc \
'{"chain":"base","method":"eth_blockNumber","params":[]}'
PASS_MCP_URL=https://seller.example/agents/mcp \
npx -y @zeampass/client --call add '{"a":1,"b":2}'--times N repeats a --call in one process. With no arguments the client is an MCP stdio server:
{
"mcpServers": {
"prism": {
"command": "npx",
"args": ["-y", "@zeampass/client@4.1.1"],
"env": { "PASS_PRIVATE_KEY": "0x..." }
}
}
}Without a key it serves tools/list and the free tools; a paid call returns the seller's terms. --tools and
--call do the same: a free tool runs, and a paid one prints the seller's terms and exits 1. --refund and
paid_fetch need the key. A key that is set and malformed is reported as that, and --call stops.
The seller's instructions reach your MCP client, under a note that the client is paying.
Results pass through whole: content, structuredContent, isError and _meta.
Related MCP server: x402 MCP Proxy
Paying per call
The client reads the terms once from the seller's
/.well-known/x402(Prism publishes it) and pays from them. A seller that publishes none, as a ZEAM :: Bridge seller does not, is asked each time: before every paid call and everybuy_timepurchase the client sends the call unpaid and pays from the 402 that answers it. A run withPASS_LINE=onthat does not yet know which channel this key andPASS_SALTpay this seller asks once before its first purchase: a first run, a run whose state directory holds only other channels, and a run whose recorded channel the seller answersunknown_channel. That one ask is the unpaidbuy_timethat learns the channel, after which the client asks for a line on it (a channel the seller does not know yet answersunknown_channel) and, when it must buy time, pays from that same 402.The first paid call deposits into a batch-settlement channel: price ×
PASS_DEPOSIT_MULTIPLIER(default 40, minimum 3), raised to the seller's floor (the 402'sdepositline, orneededMicroUSD), and no more thanPASS_MAX_SPENDleaves room for. On Prism: 250 µUSD × 40 = $0.01.Later calls sign vouchers against that deposit, with no gas. With the seller's
/.well-known/x402terms no round trip asks the price; without them each paid call is the unpaid call and then the paid one.
The deposit sits in x402's batch-settlement escrow 0x4020074e9dF2ce1deE5A9C1b5c3f541D02a10003, hardcoded in
@x402/evm. No owner, no pause, no upgrade. Only your key can withdraw it.
Line time
A ZEAM :: Bridge seller that sells time lists buy_time and line, and tags its time tools {"per":"time"}. Prism:
1 µUSD per ms. A paid call without a line costs $0.00025 and runs at most 250 ms. On a line a call costs the
milliseconds it runs; calls at once burn once.
Buy.
buy_time {"ms": N}pays for N milliseconds from the channel. Before a call the client fills an empty line toPASS_LINE_AHEAD_MS(default 2000 ms): no more per purchase than the channel's collateral covers, never less than 250 ms. A seller on an older version of the plugin that sells time in blocks is asked for blocks.Open.
POST <base>/line {"op":"open","channelId"}returns a message. The client signs it (EIP-191) with the payer key and posts{"op":"prove","channelId","nonce","signature"}; the answer carries the credential. A line opened on a channel with no other line open switches the channel's meter on. A line opened while another line is open on the channel leaves the meter as it is: if an agent switched it off, the answer'smeteringisfalse, and the client sends{"op":"on"}before it rides.Ride. Each time-tool call carries the credential in
_meta["zeam-pass/line"]; no payment per call. The answer's_meta["zeam-pass/meter"]statesmsRemaining. A call runs until the seller answers or the MCP client that asked cancels it, which the client passes on to the seller and which stops its purchases. A hang-up ends the call and its bill on a Node seller and on a Python seller served over ASGI; a WordPress seller, and a Python seller served over WSGI, cannot see one, and the call burns until it returns. Cancel a call before you hang up.Stay ahead. While a call runs the line burns 1 ms per ms and the seller keeps the call going as long as the line holds time. When half of
PASS_LINE_AHEAD_MSis left (or twice the slowest purchase so far, if longer; one that carried a deposit counts only while the next will carry one) the client buys again: as much as the call has run so far, at least twice that threshold (PASS_LINE_AHEAD_MS, or four times the slowest purchase, so a slow purchase still lands with time in hand): no more per purchase than the channel's collateral covers orPASS_MAX_SPENDleaves room for, never less than 250 ms. It buys only while a call runs: a purchase whose turn comes after the last call has ended is not made, and one whose price is answered after that is not signed. One already signed when the call ends is completed, and its time stays on the line until a refund returns it. The call is not run again. AtPASS_MAX_SPENDit stops buying; the call ends when the line runs out and the answer isx402_bridge_spend_cap_reached. A purchase that fails is said and tried again; the call runs on what is left.Meter. After
PASS_LINE_IDLE_MS(default 1000) with no call the client sends{"op":"off"}; the next call sends{"op":"on"}. The meter is the channel's, not the line's: thisoff, and theoffon exit, switch it off for every line open on that channel, and another agent riding the same channel must sendonagain.closeends only the client's own line; it leaves the meter and every other line as they are.meter_offis switched on and called again;line_unknownopens a new line;out_of_time, which now means a purchase failed or came late, buys twice the time and calls again.Exit. Every exit takes one path: the end of
--callor--tools, an error, stdin closing, SIGINT or SIGTERM. The client signs nothing new, waits up toPASS_EXIT_WAIT_MS(default 30000) for every purchase still in flight, deposit or voucher, and records each answer inPASS_STATE_DIR; then it sendsoff, thenclose. A purchase still unanswered at that bound is said, and the line is let go without its answer. Unburned time comes back with a refund.
PASS_LINE:
auto(default): per call until 2 time-tool calls arrive within 10 s (PASS_AUTO_FAST_RUN,PASS_AUTO_GAP_MS), then a line while it holds time. A call cut for running past what one call buys (out_of_time) is called again on a line. When the seller says how much more the call needs (needsMs), the client runs the whole call again, so it buys what the call already ran (the time one call buys) plusneedsMs, plus a quarter, and never less thanPASS_LINE_AHEAD_MS, before it calls again. A call already on a line that is cut withneedsMsis called again on what it ran plusneedsMs, plus half; no purchase is under 250 ms. It calls a cut call again at most three times on a line; a call still cut after that answers with the seller's cut: what the call got done, andneedsMsfor what is left. Where the seller's cut says how to continue, continue from that answer, and continue a continuation that is cut again the same way, from its own answer: the wallet-audits scans say to call again withto_blockone belowscanned.from, and each cut'sneedsMsis for what is left below its ownscanned.from, so a continuation cut again is called withto_blockone below the newscanned.from, and needs the newneedsMs.on: every time-tool call rides a line.off: per call only.
Tools priced per call never ride a line.
Refunds
npx -y @zeampass/client --refundThe client posts
{channelId, issued, signature}to the refund route the seller names (its 402 or/.well-known/x402), else<base>/refund. The channel is the one this key andPASS_SALTpay: the one the seller's/.well-known/x402fixes, or, against a seller that publishes none, the one a run from thisPASS_STATE_DIRlast paid into with them. The seller is the one inPASS_MCP_URL, by its origin: a state directory shared by several sellers keeps each one's refund route and channel apart, and--refundasks only that seller, for its own channel. When no run from thisPASS_STATE_DIRrecorded that channel (a state directory from 4.0.0 or earlier, or a lost one), the client works it out from this key,PASS_SALTand the seller's terms (against a seller that publishes none, it calls one paid tool unpaid,buy_timewhere there is one, to read its 402), and asks for it when it holds something the payer can withdraw: the escrow's balance for it, less what the seller has claimed or is owed (the larger of the escrow'stotalClaimedand the amount charged that this state directory records), as the seller judges a refund; it then records it. When that channel holds nothing the payer can withdraw,--refundsays so, with its balance and what the seller has claimed or is owed, asks nobody and exits 2. A channel recorded at another seller, or paid with another key orPASS_SALT, is never asked for; when none is this seller's,--refundsays so and asks nobody.--refund --channel <id>asks this seller for that channel by name: the seller refunds it only to a proof signed by the channel's payer, and a channel whose voucher in the state directory another key signed is not asked for. The key signs:ZEAM Pass refund channel: <channel id, lowercase> issued: <ISO time>Our relay pays the gas of a refund when our fee on what the buyer spent covers the gas of the deposit, of the refund and of settling any calls not yet settled, and of every further deposit and every earlier refund it paid for on that channel, with a 15% margin; otherwise the buyer pays the refund's gas, with a 15% margin, in USDC, quoted before the buyer signs that payment. Our fee is the fee share the seller's
refundterms name: 9.99% for most sellers, 100% at Prism. The seller counts the gas at the current gas and ETH price: free whenfeeMicroUSD >= coverMicroUSD. Then the seller sends the balance and the unburned time:returnedMicroUSD,timeReturnedMs,gasMicroUSD: 0.When they do not, the seller answers 409
refund_quotewithfeeMicroUSD,coverMicroUSDandgasMicroUSD: this refund's gas, as the relay estimates it now, plus 15%. The client signs a gasless USDC payment of it and posts again; one transaction returns the rest. If the gas has risen past the payment by the time the relay sends, nothing is sent and the answer isrefund_quotewithrequoted: trueand the new figure: run--refundagain.When the gas is more than what is left:
nothing_to_returnwith the numbers.
--refund --self-send asks for a signed refund of all of it and sends it from your key, at your gas, if the key holds
ETH on Base. Otherwise it prints the transaction for any wallet to send.
No answer from the seller: initiateWithdraw, then finalizeWithdraw after the channel's withdrawDelay.
--refund also closes the MPP session channels opened at that seller: see Paying by session.
Paying by session
An MPP session (draft-evm-session-00, method evm) is a payment channel in an escrow contract: one deposit, then
one signed voucher per call for the running total, and what is not spent comes back when the channel closes. The
seller's relay sends the deposit from an EIP-3009 authorization the key signs, so the key needs USDC and no ETH.
It is off until you pin an escrow. No escrow is built in. ZEAM's session contracts are the escrow EvmPaymentChannel
at 0x5e09aD70b644414cD1cD7Df1d9a10fF7899D92B8 on Base and its payee factory at
0xE18fCE1266056becA4a3B0edfc15F8634EA6901B: both deployed on 2026-10-13, immutable, and not audited.
PASS_SESSION_ESCROW: the escrow, or escrows, the client may pay into. A session into any other escrow is not paid.PASS_SESSION_FACTORY: that escrow's payee factory. With it, before the deposit, the client checks that the payee in the challenge is the factory's address for the seller's signer and split (receiverAuthorizerandpayToin the seller's 402) and signs nothing when it is not. Without it, or when the 402 names neither, the client says the payee could not be checked, and pays.PASS_SESSION(defaultauto):autopays by session when the seller offers one into a pinned escrow: after an x402exactquote, before an MPP charge and before a newbatch-settlementchannel. Abatch-settlementchannel that still holds money is spent first; an open session channel is used before either.onpays by session first whenever one is offered.offnever does.
Over MCP, with an escrow pinned, a tool priced per call is asked without payment for its session challenge: once
when it offers none, and again each time the challenge is about to expire when it does. The answer of a free tool is
returned as it is. A tool sold by time is paid the same way when it does not ride a line: with PASS_LINE=off, and
with auto until a line holds time. A session channel opened over HTTP pays the MCP calls to the same seller.
What it signs, over MCP and in paid_fetch alike:
The deposit is price ×
PASS_DEPOSIT_MULTIPLIER, at least the seller'ssuggestedDeposit. When the next call would pass the deposit, a top-up of the same size is signed first.A voucher is for what the seller's receipts show spent plus the price of the call, and never for more than the deposit. A receipt that claims more than the key has signed is refused, and nothing more is signed on that channel.
The deposit and every top-up count toward
PASS_MAX_SPENDwhen they are signed, and one that would pass it is not signed. A call paid out of a deposit this run signed is not counted again; a call paid out of an earlier run's deposit is. Inpaid_fetch,maxAmountrefuses a deposit or top-up above it, as it refuses a price.One channel per seller, payee, token and escrow. Its record is
<state directory>/session/<channel id>.json; it holds amounts and addresses, and the signed payments the client may have to send again rather than sign a second one: a deposit or top-up until the escrow shows it, the gas payment of a close, and, after--refund --exit, the withdrawal and gas payment the relay holds. Each pays only the addresses it names (the escrow, the relay's gas wallet, the key), so the file cannot send money anywhere else, but anyone who reads it can send them while they are valid: keep the state directory private. A new run resumes the channel after checking the record against the escrow. When a seller later names another escrow or payee, nothing is signed and the open channel stays where it is until you close it.
Leaving:
--refundasks the seller to close the channel: the seller is paid what was spent and the rest returns to the key in the same transaction. When the channel's fees do not cover that transaction's gas plus 15%, the seller quotes it and the client pays it in USDC out of what returns, under the checks in Limits. The key needs no ETH.--refund --exitleaves without the seller and without ETH, through the relay: a close request signed by the key, and, run again after the escrow's grace period (15 minutes in ZEAM's escrow), a signed withdrawal of everything the seller has not settled. These two signed calls are ZEAM's addition to the draft's escrow. The relay sends them free when the fees on what the channel has settled cover their gas plus 15%. When they do not, the client asks the relay its price and signs the withdrawal and a USDC payment of that price along with the request; the relay sends the request, holds the rest and sends it after the grace period. The gas comes out of what returns, the key needs no ETH, and there is nothing to run again: a later--refundshows the channel closed. The relay needs the seller's split, which a ZEAM :: Bridge seller publishes beside its session challenge and the client keeps in the channel's record; for a seller that publishes none, give it asPASS_SESSION_SPLIT,{"split":{"recipients":[…],"allocations":[…],"totalAllocation":"…","distributionIncentive":0},"salt":"0x…"}. The client uses it only when the 0xSplits factory gives the seller's split address for it.--refund --self-sendsends the draft's ownrequestClose, and after the grace periodwithdraw, from the key at its own gas. It needs nothing from the seller or the relay.A channel that already has a close request on chain, sent from another state directory or by another tool, is not closed through the seller:
--refundanswerssession_exit_waitingwith when the withdrawal can be sent (readyAt) and, once the grace period has passed, sends the withdrawal through the relay when the relay sends it free. When the relay asks for its gas,--refundsigns nothing and says so;--refund --exitpays that gas in USDC out of what returns, and--refund --self-sendsendswithdrawat the key's own gas.
Gates and grants
A ZEAM :: Bridge gate admits listed keys by a zero-value payment: nothing moves. PASS_GRANT is sent as the x-grant
header on every request to the seller's own origin (the origin of PASS_MCP_URL), over MCP and HTTP, so a key
admitted by grant passes the gate. It is not sent to a relay, to a paid_fetch URL on another origin, or across a
redirect to another origin.
Any paid URL
paid_fetch is offered beside the seller's tools. It calls a URL and pays a 402 with the first of these the URL
offers:
x402
exact: one signed transfer.An MPP (
WWW-Authenticate: Payment) charge, methodevm.x402
batch-settlement: a payment channel, as in Paying per call. A ZEAM :: Bridge seller quotes this on its HTTP routes (POST <base>/v1/<tool>, and its own routes behind the paywall), with an MPP charge beside it only where the price covers the gas.
With a session escrow pinned, an MPP session the URL offers into it is paid after 1 and before 2, as Paying by
session says. The result carries protocol: "mpp", intent: "session", channelId, charged, the receipt,
payeeVerified and, when one was signed, deposit or topUp.
npx -y @zeampass/client --call paid_fetch \
'{"url":"https://api.example.com/v1/quote","body":{"symbol":"ETH"}}'pay: falsereturns the terms without paying.maxAmount(base units) refuses a larger quote before signing.USDC counts toward
PASS_MAX_SPEND. Another asset is paid only withmaxAmount.A zero-value gate: signed, admitted,
paid: false.An MPP charge is paid when it is method
evm, intentcharge, on the client's network, taking an EIP-3009authorization: one signed USDC transfer, no channel. The result carriesprotocol: "mpp"and thereceipt.A signed MPP charge counts toward
PASS_MAX_SPENDwhen it is sent, receipt or not: its seller can collect it until the challenge expires. With no receipt the result sayssigned: trueandpaid: false. A signed x402exacttransfer counts the same way; a URL that answers it with an error getssigned: trueandpaid: false.Other MPP methods (
tempo,stripe) are listed undermppin the terms and not paid.A
batch-settlementpayment: the first call to a seller signs a deposit, price ×PASS_DEPOSIT_MULTIPLIER, at least the floor its 402 names; later calls sign vouchers against it. The result carriesscheme,channelId,chargedand, when one was signed,deposit.A deposit counts toward
PASS_MAX_SPENDwhen it is signed, andmaxAmountrefuses a deposit above it as it refuses a price. Refused, nothing is signed andneededis the amount that would be. A call paid out of a deposit this run signed is not counted again; a call paid out of an earlier deposit is.Channel state is kept per host:
~/.x402-mcp-bridge/<host>/<address>, or<PASS_STATE_DIR>/hosts/<host>/<address>whenPASS_STATE_DIRis set. A URL on the host ofPASS_MCP_URLpays from the channel the MCP tools pay from. A record is named by its channel, which the receiver in the terms fixes: other terms are another channel, and a seller's answer updates only the channel its own terms name.To take back what such a channel has not spent:
PASS_MCP_URL=https://<host>with--refund, and withPASS_STATE_DIRset, that host's directory asPASS_STATE_DIR. The client prints the settings when it signs a deposit.A 402 after a payment:
funding_requires_open_feedeposits the floor it names; a count the seller proves with this key's own voucher resyncs the channel;payment_invaliddrops the local record and resyncs from the chain. The call is then paid again, three payments at most, every deposit among them insidemaxAmountandPASS_MAX_SPEND.A seller that takes the voucher and fails: its error comes back,
paid: false, nothing counted. An answer with noPAYMENT-RESPONSE:signed: true,paid: false, and the price counts towardPASS_MAX_SPEND.
Chain clients
import { createPublicClient } from 'viem'
import { base } from 'viem/chains'
import { prism } from '@zeampass/client/viem'
const client = createPublicClient({
chain: base,
transport: prism({ key: process.env.PASS_PRIVATE_KEY }),
})
await client.getBlockNumber()The ethers provider needs ethers 6 or later installed beside the client (npm install ethers).
import { PrismProvider } from '@zeampass/client/ethers'
const provider = new PrismProvider({ key: process.env.PASS_PRIVATE_KEY })The first request pays per call at
/rpc/base(or/rpc/eth,chain: 'eth') and funds the channel: 40 × the price, at least the seller's floor.Then it opens a line, buys
aheadMs(2000) of time, and sendsx-line. While a request runs it buys more before the line runs out, as above.maxMicroUSD(defaultPASS_MAX_SPEND) bounds everything one request signs for: a deposit or top-up, the call, the line time bought before and during it. Each counts when it is signed; a call or line time paid out of a deposit the same request signed is not counted again, and one paid out of an earlier request's deposit is. A deposit that would pass it is made smaller to fit, down to what the call and the seller's floor need. Below that nothing is signed and the request is refused with an error whosecodeisx402_bridge_spend_cap_reachedand whoseneededis the amount. During a call, purchases stop at it and the call runs on the time left.refund()holds its gas payment to it.The meter goes off after
idleMs(1000) idle; the line is let go afterdropAfterMs(10000).state(),close(),refund(). Callclose()orrefund()before exit.
Options: url, chain, network, stateDir, depositMultiplier, asset, salt, rpcUrl, grant, relayUrl,
maxMicroUSD, aheadMs, idleMs, dropAfterMs, log. The PASS_* variables are the defaults; the state directory is shared with the
client.
Configuration
PASS_PRIVATE_KEY(no default): funds the channel and signs.PASS_MCP_URL(defaulthttps://mcp.zeamprism.com/mcp): any x402 MCP endpoint.PASS_LINE(defaultauto):auto,on,off.PASS_LINE_AHEAD_MS(default2000): line time kept ahead of a call; the least bought perbuy_timewhile the channel's collateral andPASS_MAX_SPENDleave room for it.PASS_LINE_IDLE_MS(default1000): meter off after this idle.PASS_EXIT_WAIT_MS(default30000): how long an exit waits for a purchase in flight to be answered before it lets the line go.PASS_MAX_SPEND(default10000000, $10): ceiling on what this run pays, µUSD;0removes it. Every deposit and top-up counts when it is signed, x402 or session, for an MCP tool or inpaid_fetch; so does every signed transfer: anexactpayment, an MPP charge, a gas payment. A call paid out of a deposit this run signed is not counted again. What the channel was charged before this run is not counted. For an MCP tool an x402 deposit that would pass the cap is made smaller to fit, down to what the call and the seller's floor need; below that nothing is signed.PASS_DEPOSIT_MULTIPLIER(default40): deposit = price × this, at least the seller's floor; minimum 3.PASS_GRANT(no default):x-granton every request to the seller's own origin.PASS_RPC_URL(default the chain's public RPC): your node for chain reads.PASS_STATE_DIR(default~/.x402-mcp-bridge/<host>/<address>): channel state, and inseller.json, for each seller by origin, its refund route and the channel each key andPASS_SALTlast paid into there; keep it.PASS_SALT(default the scheme's): a distinct channel.PASS_ASSET(default first quoted): address or symbol.PASS_NETWORK(defaulteip155:8453): CAIP-2.PASS_SESSION(defaultauto):auto,on,off. Nothing is paid by session until an escrow is pinned.PASS_SESSION_ESCROW(no default): the MPP session escrow addresses the client may pay into.PASS_SESSION_FACTORY(no default): the payee factory of that escrow, to check a seller's payee.PASS_SESSION_SPLIT(no default): a seller's split and its salt, for--refund --exit.
Every request to a seller, a relay or a paid_fetch URL is sent with User-Agent: zeam-pass-client/<version> node,
so the other side can see it is @zeampass/client and which version. A User-Agent you put in paid_fetch's
headers is sent instead. Nothing else about you is added: no address, no host name.
USDT, DAI and WETH settle through Permit2: approve 0x000000000022D473030F116dDEE9F6B43aC78BA3 once. USDC needs no
approval.
Limits
It exits when stdin closes, and lets its line go once the purchases in flight are answered.
It stops at
PASS_MAX_SPEND: further calls returnx402_bridge_spend_cap_reached, withspentMicroUSD, what this run counted toward it, andcapMicroUSD, for an MCP tool and frompaid_fetchalike.On
--refund, when the seller asks for the refund's gas in USDC, it signs only a payment to the relay's own gas wallet, in USDC on its own chain, for the amount quoted, no more than twice what the relay prices that gas at, less than the refund and withinPASS_MAX_SPEND. Otherwise it signs nothing and says why. The relay is ZEAM's (https://api.zeampass.com/relay);PASS_RELAY_URLnames another. The gas of a session channel's close is checked the same way. For--refund --exitthe price is the relay's own, and the payment is signed only when it is less than what is left in the channel and withinPASS_MAX_SPEND; it cannot be taken before the grace period ends. Signed with the close request, it is valid from 30 s after the grace period the chain gives at that moment, for 15 minutes; the answer says from when (gasPaymentValidFrom), and says so if the request landed so late that this falls inside the grace period. Signed after the request is on chain, it is valid from the end of that request's grace period. A close's gas payment is signed only when it is valid at once and for no more than 10 minutes, is less than what the escrow shows would return, and the relay does not say the channel's fees cover the gas. When the client does not sign it, the answer keeps the seller'scode: "gas_payment_needed",leftMicroUSD,returnedMicroUSD,gasMicroUSDand its detail aswhy, and addsrefused: "gas_payment_refused"andrefusedWhy, the client's reason. Each payment is kept in the channel's record, and no other is signed for that channel while one is unexpired and unused: the same one is sent again, or--refundsays until when to wait (gas_payment_pending).On
--refund --self-sendit sends only the escrow's signed refund of this channel:refundWithSignature, alone or with its claim in the escrow'smulticall. Any other transaction a seller hands back is not sent; the answer issigned_refund_refusedand says why.initiateWithdrawneeds nothing from the seller.The ETH gas that
--self-sendpays is not counted towardPASS_MAX_SPEND. The client knows its cost in ETH before sending but holds no ETH price of its own, and a price asked of the seller or the relay would make the exit depend on them. It sends only when the key holds 1.5 × the estimate, and the answer states what was paid (gasWei).Lost state is rebuilt from the seller: the first payment on the channel after it is lost is refused with the seller's corrective 402, which carries the channel's state, and is made again from that state; nothing is charged for the refused one. Against a seller that publishes no
/.well-known/x402terms, the unpaid calls that ask the price come first. A channel that holds nothing then takes one deposit.
Verify before you run it
The versions are pinned exactly.
npm view @zeampass/client@4.1.1 version dist.integrity
npm pack @zeampass/client@4.1.1
less package/index.mjsUpgrading from @zeam-labs/x402-mcp-bridge
Up to 3.2.2 the client was published as @zeam-labs/x402-mcp-bridge. Those versions stay on npm and run as before.
Moving to @zeampass/client changes nothing you run:
the command
x402-mcp-bridgeis installed besidezeam-pass;every
X402_…setting is read when itsPASS_…name is not set. With both set and different,PASS_…wins and the client says so once on stderr;the tool name
x402_fetchis answered aspaid_fetch. Onlypaid_fetchis listed;the state directory is still
~/.x402-mcp-bridge, so a channel you funded is still found;the error code
x402_bridge_spend_cap_reachedis unchanged.
Apache-2.0. Patent pending.
This server cannot be deployed
Maintenance
Related MCP Connectors
Monetize any MCP server: x402 paywall, pay-per-call billing in USDC on Base, agent marketplace.
Pay-per-action access to APIs and MCP tools over Lightning L402 and Base USDC x402.
Paid MCP tools behind one endpoint. Agents pay per call in USDC on Base via x402.
Billing proxy for MCP servers. Adds Stripe and x402 crypto payments without writing billing code.
Related MCP Servers
- FlicenseNot gradedqualityFmaintenanceEnables micropayments for MCP tool invocations using the X402 payment protocol, allowing servers to charge per tool usage in USDC and clients to automatically handle payments.123 npm4-
- AlicenseNot gradedqualityCmaintenanceA local MCP proxy that connects to remote MCP servers and automatically handles x402 payments, signing USDC on-chain when a tool returns HTTP 402.16 npm1MIT
- 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.2352 npmMIT
- AlicenseNot gradedqualityFmaintenanceAn MCP server whose tool invocations are metered and charged over x402, plus a paying-proxy reference client that lets any standard MCP client use the paid tool without knowing x402 exists.MIT