a402-pay-mcp

v0.17.1
io.github.agent402-dev/a402-pay-mcp Checked 17 hours ago Published 1 hour ago

Pay x402 APIs (USDC, PREQ) and run Agent402 Bond deals from your own wallet.

These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.

x402_fetch

Fetch a URL and, if it answers HTTP 402 (x402), pay from the configured wallet only when every rule passes before signing: allowed domain (X402_ALLOWED_DOMAINS), trusted recipient (X402_TRUSTED_PAY_TO), allowed asset (USDC by default; PREQ only if listed; A402 (v1) is deprecated), per-payment and daily limits, and human confirmation above the configured amount. Pays on Solana; USDC on Base only when X402_ALLOWED_NETWORKS includes base (off by default), with the same rules and limits shared across networks. Signs at most once per call. Pass quoteId from x402_quote to refuse if the requirements…

ParameterTypeDescription
url *stringFull https URL of the paid API endpoint. Its host must be in X402_ALLOWED_DOMAINS.
bodystringRequest body for POST, as text (at most 100,000 characters).
headersobjectExtra request headers, for example content-type. Payment headers are added by the tool.
methodstringHTTP method (default GET).
quoteIdstringquoteId returned by x402_quote. If set, the payment is refused unless amount, asset and recipient still match that quote.

x402_quote

Show the x402 payment requirements of a URL and whether each option passes the payment rules. Never signs or pays. Returns JSON with each payment option, the rule checks and a quoteId that x402_fetch can use to pin the amount, asset and recipient, the network of each option and which chain would be used (choice), and a discovery summary (shape of the seller discovery metadata: lengths, presence and formats, useful to sellers checking their own 402); result "refused" (an error) means no option passes. Call this before x402_fetch.

ParameterTypeDescription
url *stringFull https URL of the paid API endpoint. Its host must be in X402_ALLOWED_DOMAINS.
bodystringRequest body for POST, as text (at most 100,000 characters).
headersobjectExtra request headers, for example content-type. Payment headers are added by the tool.
methodstringHTTP method (default GET).

wallet_status

Read only. Payment wallet address, network, allowed networks (networks: Solana, and Base only if enabled), USDC and PREQ balances, payments signed today, and the configured limits and allowlists (including Agent402 Bond rules), with warnings when a limit is near, and any standing token allowance (an SPL delegate) on the token accounts of this wallet, which can move tokens outside these limits. Takes no input; never signs or pays. Call it first to see whether payments are configured and why a payment might be refused. For past payments use payment_history; for totals over a date range use spend…

payment_history

Recent payment records from the local JSONL log (time, URL, asset, amount, recipient, result, settlement transaction id). Keys and signed payment payloads are never stored. Read only. Returns the newest records first as JSON, or with format "csv" as CSV text (oldest first). For totals by asset, recipient or day use spending_report; to check a seller receipt use verify_receipt.

ParameterTypeDescription
formatstring"json" (default) or "csv".
limitintegerHow many of the most recent records to return (1-500, default 20).

spending_report

Read only. Spending summary from the local payment log for a date range (UTC days, default this month to today, at most 366 days): totals per asset, by recipient, by host and by day, result counts, how many paid responses carried a verified seller receipt, and what is left of today's limits. Signed payments count as spent whatever their result, as the daily limits count them. For individual records use payment_history.

ParameterTypeDescription
fromstringFirst UTC day, YYYY-MM-DD (default: the first day of this month).
tostringLast UTC day, YYYY-MM-DD, inclusive (default: today). At most 366 days after from.

verify_receipt

Read only. Check a seller's signed x402 receipt (the X-Agent402-Receipt header value) for anyone holding one: the signature always; and, when given, the signer (expectedSigner, or the key the seller publishes at sellerUrl GET /), the request (method, url, requestBody), the response body (responseBody or responseBodySha256), and the settlement transaction on chain (when an RPC is configured). Says what was not checked. Never signs or pays.

ParameterTypeDescription
receipt *stringThe X-Agent402-Receipt header value, as received.
expectedSignerstringSeller receipt signing key (base58) you expect.
methodstringHTTP method of the paid request, to check it is the one the receipt covers.
requestBodystringBody of the paid request, to check its hash.
responseBodystringBody of the paid response, to check its hash.
responseBodySha256stringSHA-256 (hex) of the paid response body, instead of responseBody.
sellerUrlstringhttps URL of the seller; its published receipt key is read from GET / on that origin.
urlstringURL of the paid request, to check it is the one the receipt covers.

bond_deal_status

Legacy Bond v1 (new deals use the bond_v2_* tools). Read-only. Show an Agent402 Bond v1 deal (program 9hiCZZ6ddFG9oJBR1Su43Pj4JRFHeHC5cGiCgXtTuAaK): parties, amounts with units, deadlines on the Solana clock, what each side can still do, and the settlement that applies now or the earliest time it opens. Never signs. Predicted from the program rules; the program on chain decides.

ParameterTypeDescription
deal *stringBond v1 deal account address (base58).

bond_open

Legacy Bond v1 (new deals use the bond_v2_* tools). Agent402 Bond, buyer side. Sign an `open` transaction that the seller built and signed as fee payer (base64, legacy). Before signing, the instruction is rebuilt for this wallet from its own terms and must match byte for byte (one instruction, seller and this wallet as the only signers, USDC or an enabled PREQ deal). Rules: seller in X402_BOND_SELLERS, price at most X402_BOND_MAX_USD (PREQ: X402_BOND_MAX_PREQ_ATOMIC), seller bond at least X402_BOND_MIN_SELLER_BOND_BPS (default 5%), delivery within X402_BOND_MAX_DAYS (default 30), the deposit w…

ParameterTypeDescription
transaction *stringThe seller-signed open transaction, base64 (legacy format).

bond_confirm_and_pay

Legacy Bond v1 (new deals use the bond_v2_* tools). Agent402 Bond, buyer side. Confirm receipt and pay the balance (price minus deposit) directly to the seller. Only for deals where this wallet is the buyer, before the buyer deadline, within the daily cap of the deal asset, with human confirmation (by default always). Confirming releases the seller bond and the deposit to the seller; the program does not judge quality. Bond v1 only (for v2 deals use bond_v2_accept). Call it after bond_job_result and only for work you checked. Returns result "confirmed_and_paid" with the transaction; any other…

ParameterTypeDescription
deal *stringDeal account address (base58), as returned by bond_job_start / bond_v2_start or shown by bond_deal_status.

bond_settle

Legacy Bond v1 (new deals use the bond_v2_* tools). Agent402 Bond v1. Settle a deal whose outcome is fixed by signatures and time, then send both claims in the same transaction (buyer share, then seller share). Use it after a deadline has passed (see bond_deal_status for when settlement opens); after bond_confirm_and_pay no settle is needed. Only for deals where this wallet is the buyer or the seller; this wallet pays only the network fee. Returns result "settled" with the transaction; anything else (for example not yet settleable) is an error. For v2 deals use bond_v2_settle.

ParameterTypeDescription
deal *stringDeal account address (base58), as returned by bond_job_start / bond_v2_start or shown by bond_deal_status.

bond_find_sellers

Agent402 Bond Job Protocol v1 and v2, buyer side. Find sellers: reads the seller directory (a plain list of job URLs; being listed is not an endorsement), then each seller's live terms (GET {url}/quote), and says for each one its protocol (v1 or v2, and which tools to use), whether this wallet's rules would refuse it and which settings a human would need to change. Sellers that also sell the same work per request over x402 show it as perRequest (advertised URL and price, checked against the x402 rules; use x402_quote for the actual terms). Read only: never signs, pays or changes settings. Desc…

ParameterTypeDescription
assetstringOnly sellers whose deals use this asset.
querystringWords to match in the seller description or URL.

bond_job_quote

Legacy Bond v1 (new deals use the bond_v2_* tools). Agent402 Bond Job Protocol v1. Read a seller's job quote (GET {url}/quote) and check it against this wallet's bond rules: seller in X402_BOND_SELLERS, price at most X402_BOND_MAX_USD, seller bond at least the minimum share, delivery time, the deal asset (USDC, or PREQ if enabled) and its daily cap. The URL host must be in X402_ALLOWED_DOMAINS. Never signs. Returns result "ok" with the terms, or "refused" (an error) with the reasons. For v2 sellers use bond_v2_quote (bond_find_sellers says which protocol a seller uses).

ParameterTypeDescription
url *stringSeller job base URL from bond_find_sellers (the tool appends /quote, /open or /deliver). Its host must be in X402_ALLOWED_DOMAINS.

bond_job_start

Legacy Bond v1 (new deals use the bond_v2_* tools). Agent402 Bond Job Protocol v1, buyer side. Send the job input (POST {url}/open), receive the seller-signed open transaction, check that the quote, the reported terms and the transaction terms all agree, then run bond_open (rebuild and compare, bond rules, human confirmation). Locks your deposit. Returns the deal address. Call bond_job_quote first; for v2 sellers use bond_v2_start.

ParameterTypeDescription
input *stringThe job input exactly as the seller's quote describes it (text, at most 16,384 characters). Its hash is recorded with the deal.
url *stringSeller job base URL from bond_find_sellers (the tool appends /quote, /open or /deliver). Its host must be in X402_ALLOWED_DOMAINS.

bond_job_result

Legacy Bond v1 (new deals use the bond_v2_* tools). Agent402 Bond Job Protocol v1, buyer side. Fetch the delivered work for a deal where this wallet is the buyer (POST {url}/deliver with a signed request; the signed bytes start with 0xff so they can never be a transaction). Does not confirm or pay: check the work, then call bond_confirm_and_pay only if it is acceptable.

ParameterTypeDescription
deal *stringDeal account address (base58), as returned by bond_job_start / bond_v2_start or shown by bond_deal_status.
url *stringSeller job base URL from bond_find_sellers (the tool appends /quote, /open or /deliver). Its host must be in X402_ALLOWED_DOMAINS.

bond_v2_quote

Agent402 Bond v2 (Job Protocol v2). Read a seller's job quote (GET {url}/quote) and check it against this wallet's bond rules, including the dispute option: a non-refundable share of your deposit is refused unless X402_BOND_V2_ALLOW_SHARE=1, and a named arbiter must be in X402_BOND_V2_ARBITERS. Never signs. Returns result "ok" with the terms (review window, outcome if not accepted, arbiter), or "refused" (an error) with the reasons. Call it before bond_v2_start; for v1 sellers use bond_job_quote.

ParameterTypeDescription
url *stringSeller job base URL from bond_find_sellers (the tool appends /quote, /open or /deliver). Its host must be in X402_ALLOWED_DOMAINS.

bond_v2_start

Agent402 Bond v2, buyer side. Send the job input (POST {url}/open), then before signing: recompute the job hash from your own input, rebuild the open instruction (terms, job hash, both payout accounts, your token account) and compare it byte for byte, check the bond rules, and ask a human. Locks your deposit. Returns the deal address (use it with bond_v2_result, bond_v2_accept and bond_v2_settle). For v1 sellers use bond_job_start.

ParameterTypeDescription
input *stringThe job input exactly as the seller's quote describes it (text, at most 16,384 characters). Its hash is recorded with the deal.
url *stringSeller job base URL from bond_find_sellers (the tool appends /quote, /open or /deliver). Its host must be in X402_ALLOWED_DOMAINS.

bond_v2_result

Agent402 Bond v2, buyer side. Fetch the delivered work (signed request; the signed bytes start with 0xff so they can never be a transaction) and verify it: the output hash recomputed from the received result must match the one the seller stored on chain, and the seller must have signed it. Never pays and changes nothing on chain. Returns result "verified" with the work; "working", "not_delivered" or "not_marked" mean try again later; a hash or signature mismatch is refused. Call it after the seller has delivered; then call bond_v2_accept only for work you checked. For v1 deals use bond_job_res…

ParameterTypeDescription
deal *stringBond v2 deal account address (base58), as returned by bond_v2_start.
url *stringSeller job base URL from bond_find_sellers (the tool appends /quote, /open or /deliver). Its host must be in X402_ALLOWED_DOMAINS.

bond_v2_accept

Agent402 Bond v2, buyer side. Fetch and verify the delivery again, then accept and pay the balance to the seller in one instruction (before the accept deadline, within the daily cap, with human confirmation). Refuses if the result does not match what the seller committed to on chain. The program does not judge quality: accept only work you checked. Returns result "accepted" with the transaction; "refused" means nothing was signed and "failed" means the transaction did not land (see payment_history). Then call bond_v2_settle to claim and close.

ParameterTypeDescription
deal *stringBond v2 deal account address (base58), as returned by bond_v2_start.
url *stringSeller job base URL from bond_find_sellers (the tool appends /quote, /open or /deliver). Its host must be in X402_ALLOWED_DOMAINS.

bond_v2_job_status

Agent402 Bond v2 read as an 8183-style job (compatible mapping on Bond v2, not the ERC-8183 standard itself). Read-only, never signs. Returns status Funded, Submitted, Completed, Rejected or Expired, this wallet's role (client, provider, evaluator or observer), the Bond v2 outcome, whether time has fixed it (settleable), and submitBy / completeBy / settleAfter on the Solana clock (unix seconds).

ParameterTypeDescription
deal *stringBond v2 deal account address (base58), as returned by bond_v2_start.

bond_v2_reject

Agent402 Bond v2, buyer side (the buyer is the evaluator). Record that you will not accept this job, with a reason code. Signs nothing and moves nothing: Bond v2 has no single-party refund, so after the review window anyone settles with bond_v2_settle (you get your deposit back, less any agreed seller share; the seller keeps its bond). If the seller never submitted, the deadline decides instead and you also get the seller bond. Reason codes: deadline_missed, not_delivered, receipt_mismatch, schema_mismatch (machine-checkable), data_incorrect, quality_below_brief, scope_dispute, originality, of…

ParameterTypeDescription
deal *stringBond v2 deal account address (base58), as returned by bond_v2_start.
notestringOptional short note kept with the record (at most 280 characters).
reasonstringWhy you reject (default other).

bond_v2_settle

Agent402 Bond v2. Once time has decided the outcome (or after accept or another decision), settle if needed and claim what each side is owed to their recorded payout accounts; the last claim closes the deal and returns the rent. No funds leave this wallet except the network fee. Returns result "done" or "nothing_to_do"; anything else (for example the outcome is not decided yet) is an error. For v1 deals use bond_settle.

ParameterTypeDescription
deal *stringBond v2 deal account address (base58), as returned by bond_v2_start.