pay-mcp

v0.19.0
tech.vauban/pay-mcp Checked 3 days ago Published 1 month ago

x402 pay tools for MCP clients, plus a `buy` command: read the offer, consent, pay.

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

jcs_hash

JCS (RFC 8785) canonicalize a JSON object then compute its SHA-256 hash. Returns base64-encoded canonical bytes and the hex digest.

ParameterTypeDescription
json_object *objectThe JSON object to canonicalize and hash.

make_payment

Make a payment on Starknet Sepolia testnet. Call it with no arguments to get a real, sponsored settlement: we fund the testnet payment, so you need no wallet, no account and no STRK. Returns the transaction hash of YOUR payment plus a Voyager link, and you can read it back from any Sepolia RPC you trust. Pass amount_wei (a decimal string in STRK-wei) to choose the amount, within the published cap. The payee is fixed by the sponsor, so this is a funded demo and not a faucet. If you would rather pay from your own account, set PAY_MCP_SEPOLIA_ACCOUNT_ADDRESS + PAY_MCP_SEPOLIA_PRIVATE_KEY and this…

ParameterTypeDescription
amount_weistringAmount in STRK-wei, as a decimal STRING. A string because wei amounts exceed Number.MAX_SAFE_INTEGER and a JSON number would silently lose precision. Omit for the sponsored default.
cap_per_period_weistringOptional per-period cap, STRK-wei as a string.
cap_per_tx_weistringOptional per-transaction cap, STRK-wei as a string.
recipientstringInformational only in sponsored mode: the payee is fixed by the sponsor so that this is a demo and not a faucet.
scopestringOptional label carried into the authorization object.

verify_receipt

Check a receipt. Three modes, chosen by the arguments given: 1. Hash mode: receipt + expected_hash. Canonicalizes the receipt (JCS, RFC 8785), hashes it with SHA-256 and says whether the digest equals expected_hash. Nothing else about the receipt is checked. 2. Note-receipt mode: receipt alone, whose variant is 'payment-committed-note-v1'. Recomputes note_receipt_hash from the ten cells in note_cells and checks that the fields repeating a cell agree with it. It says only that the receipt is consistent with itself: not that a proof was verified, not that the pool note exists on chain, and nothi…

ParameterTypeDescription
expected_hashstringExpected SHA-256 hex digest, optionally prefixed with 'sha256:' (hash mode).
receiptobjectThe receipt object to check (hash mode, or note-receipt mode when given alone).
tx_hashstringStarknet tx hash to read (chain mode), on the network the node at STARKNET_RPC_URL serves. E.g. 0x<hex>.

request_delegation_grant

Create a DelegationGrant authorization object. Builds the grant with canon_version 'x402-jcs-v1.0.0', JCS-hashes it and returns the grant hash.

ParameterTypeDescription
delegatee *stringDelegatee identifier (address or DID).
delegator *stringDelegator identifier (address or DID).
expires_at *stringISO 8601 expiration timestamp.
scope *stringDelegation scope string.
cap_per_periodintegerOptional per-period cap in centimes.
cap_per_txintegerOptional per-transaction cap in centimes.

check_merchant

Check a merchant's proven service history (an x402 STARK-receipt history document, e.g. https://demo.pay.vauban.tech/x402/v1/history). Fetches history_url, validates the document, and verifies a sample of entries: L1 = structure + per-entry invariants + JCS canonicalization; L2 = each sampled settlement transaction is read from Starknet Sepolia and must be SUCCEEDED (a visible entry must carry a value transfer or a recognized receipt event). Four verdicts, NEVER conflated: - PROVEN_SAMPLE: document valid, sampled entries verify at the announced level. - REFUTED: an element contradicts itself o…

ParameterTypeDescription
history_url *stringThe merchant's history endpoint (http(s) URL).
sample_sizeintegerEntries to verify, 1..20 (default 5).

pay_for_resource

Fetch a resource gated behind x402 and complete the payment flow to obtain it -- the x402 CLIENT walk, which none of the other tools here perform. GET url: if it answers 200 directly, the resource was free (outcome no_payment_required -- not a failure, x402 gates specific endpoints, not the whole internet). If it answers 402, parses the PAYMENT-REQUIRED manifest, downloads a STARK proof from proof_url (defaulted to the published demo proof only when url's host is demo.pay.vauban.tech; REQUIRED for any other host -- never guessed), gunzips it in memory, and POSTs it back to url. PROOF SOURCE: t…

ParameterTypeDescription
url *stringThe resource URL to fetch (http(s)).
networkstringOptional CAIP-2 network to pay on when the 402 offers several (e.g. eip155:84532 for Base Sepolia, starknet:SN_SEPOLIA). Without it, Starknet is the reference: the Starknet offer is taken when a Stark…
proof_urlstringWhere to download a pre-generated, gzipped STARK proof to submit. Defaults to the published demo proof when url's host is demo.pay.vauban.tech. REQUIRED for any other host.

pay_shielded

Pay an x402 resource on the SHIELDED rail (scheme vauban-shielded-strk20). Starknet Sepolia only: an offer on any other network is refused as unpayable (network_not_supported). It reads the offer, builds the X-VAUBAN-SHIELDED-SETTLEMENT header (vzk20-v2: pool coordinates plus a COMMITMENT), sends the STARK proof named by proof_path as the POST body, and returns the receipt from PAYMENT-RESPONSE. THE PROOF: proof_path names a proof file you already hold, READ FROM YOUR DISK AND SENT to url as given. It is read only inside the directory named by PAY_MCP_SHIELDED_PROOF_DIR (no default: unset, not…

ParameterTypeDescription
proof_path *stringA STARK proof file you hold, inside the directory named by PAY_MCP_SHIELDED_PROOF_DIR (relative to it, or absolute inside it). Its bytes are sent to url. .gz is gunzipped.
settlement *objectThe pool transaction that settled the value leg. Every field is a CLAIM: the facilitator decides.
url *stringThe gated resource (http(s)). GET it, read the 402, POST the proof back to it.
amount_commitmentstringThe commitment as felt252 hex, when you computed it yourself.
payer_pseudonymstringOptional. The payer pseudonym your proof publishes (its subject), felt252 hex. Needed, with the vault variable, for the purchase salt; it is not sent as such.
witnessobjectOptional, and it NEVER leaves this process: used only to check the commitment, the ceiling, and that neither number is in the receipt served back.