PayStage

Built for agents that spend on your behalf — Claude Duet, OpenAI Dots, Meta Muse, Grok Bot, and whatever ships next. The
agent is the caller and the payer; the person is the operator who sets the policy. Compatibility is by protocol (MCP and
x402), not by partnership: nothing here implies we are embedded in those products, and the surfaces we are actually in are
graded row by row in the integration table.
The canary date is the day the scheduled release run last published @paystage/mcp@canary — the workflow rewrites badges/canary.json after a successful canary publish,
so a missed or failed run leaves the old date standing rather than a fresh-looking one. It links the scheduled runs
where that publish happened. Sources for every non-static badge: Badge sources.
Your agent's wallet should not sign because a server asked it to.
PayStage sits between an agent and the x402 payment it is about to make, and answers one
question before the signature exists: should this payment happen? Every tool returns
pay, review, or do_not_pay, with the rule that fired and a receipt you can keep.
It is a third party to the transaction: no keys, no funds, no listings, not the wallet, not the facilitator and not the seller. That position is the product —
a wallet that pays and judges has the same conflict of interest as a seller that verifies its own delivery — and the rest of this file is what makes the claim
checkable rather than a slogan.
The gap it fills is narrow and load-bearing. x402 makes paying trivial and leaves deciding
to the caller: a wallet enforces signatures, not intent. @paystage/x402-guard evaluates the
challenge before the wallet signs, so a wrong payee, an over-cap amount or an unknown asset
never reaches the signing step at all.
Where the money does not move
The design point is the arrow that is missing. The wallet signs only after the challenge has been
judged; a refusal returns the seller's own 402 with a verdict header attached, so there is nothing to
revoke afterwards.
sequenceDiagram
autonumber
participant A as Agent
participant S as Seller
participant G as PayStage guardFetch
participant W as Wallet
A->>S: request the paid resource
S-->>A: 402 + payment-required challenge
A->>G: the same request, wrapped
G->>G: decode challenge, evaluatePayment(challenge, policy)
alt do_not_pay, or review with onReview refuse
G-->>A: original 402 + x-paystage-verdict
Note over G,W: nothing is signed
else pay, or review with onReview pay
G->>W: x402-fetch stages the payment
W-->>S: signed payment
S-->>G: 200 + resource
G-->>A: 200 + x-paystage-verdict
end
review is reported as review either way. When onReview: "pay" lets an ambiguous payment
through, the header still says review, because the evaluator's finding and the caller's instruction
to tolerate it are different facts — a caller that cannot tell "clean" from "warned but paid" cannot
audit itself. The rule that fires travels in x-paystage-reason-codes.
What decides
%% tight ranks: this is read at a glance, not studied
%%{init: {"flowchart": {"nodeSpacing": 26, "rankSpacing": 30}}}%%
flowchart TD
C[402 challenge] --> E["evaluatePayment<br/>guards: agent budget, time window,<br/>x402Version 2, accepts present"]
E --> P{any accept judged pay?}
P -- yes --> PAY[pay, cheapest accept]
P -- no --> R{any accept judged review?}
R -- yes --> REV[review]
R -- no --> DN[do_not_pay]
REV --> O{onReview}
O -- pay --> SIGN[x402-fetch signs, request retries]
O -- refuse --> X[refused, 402 returned unsigned]
PAY --> SIGN
DN --> X
do_not_pay is a real refusal, not a warning: a payee on the known-drainer or OFAC list, an
over-cap amount, a wrong network or asset, a policy that denies the payee, or a challenge that
cannot be parsed. review is the narrow middle — a payee the policy has no opinion about, or a payment over a
step_up threshold; either way the review names the rule, and a step-up lists the principal's non-browser answers
with human approval as the fallback. Both verdicts and the branch logic are in
packages/preflight/src/evaluate.ts; the hook that uses them is
packages/x402-guard/src/index.ts.
Try it without installing anything:
# Copy-paste as-is. A real 12.5 USDC Base challenge against a 5 USDC policy:
curl -s -X POST https://api.paystage.xyz/v1/evaluate_mcp_payment \
-H 'content-type: application/json' \
-d '{"payment_required":{"x402Version":2,"resource":{"url":"https://api.dataquay.xyz/v1/ohlc"},"accepts":[{"scheme":"exact","network":"eip155:8453","amount":"12500000","asset":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","payTo":"0x6160a0d8a3a1f8b0c4e2d1f7b3a9c6e5d4f23757","maxTimeoutSeconds":300}]},"policy":{"version":1,"max_amount":{"value":"5","asset":"USDC","decimals":6},"allowed_pay_to":["0x209693Bc6afc0C5328bA36FaF03C514EF312287C"],"allowed_assets":[{"symbol":"USDC","decimals":6,"address":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913"}],"allowed_networks":["eip155:8453"],"max_timeout_seconds":600,"unknown_payee":"deny"}}'
It answers do_not_pay with amount 12.5 USDC exceeds max_amount 5 USDC — a refusal with a reason, in one paste, with nothing elided. The shorter forms below are for reference
only; an example a reader cannot paste is an example that costs them their first attempt.
The hosted endpoint serves a real verdict with no payment and no account for the first 1,000 calls
a day — an agent cannot fill in a signup form, so requiring one would exclude exactly the callers
this is built for. Beyond that it is $0.002 per call over x402, paid in USDC on Base — 1,001 is
0.002, not a plan, not a seat, and no different from the surrounding calls.
Two caveats, both published rather than implied: the free counter lives in Worker isolate memory, so the
allowance is per instance and scales with instance count instead of being a global per-IP cap
(https://api.paystage.xyz/v1/public/status states it in machine-readable form), and the price is read
from the same constant the Worker charges.
The ten tools
Nine are read-only. None of them signs, holds a key, or moves money — the agent stays the only signer,
which is the entire product.
The tenth, request_testnet_funds, is the one deliberate exception and it is worth naming rather than
hiding: it asks our Base Sepolia faucet for 0.5 test USDC so you can exercise the paid path before
spending anything. It moves testnet funds from a wallet we hold, touches nothing you own, and cannot
reach mainnet.
All ten are listed with what each answers in Tools.
语言 / Language: English · 简体中文
See it work
npm run build -w @paystage/preflight && node examples/run.mjs
Four challenges against one policy, four verdicts with reasons — no network, no keys. See examples/.
The same evaluator deciding a 402 before anything is signed, with the pay / review / do_not_pay
transcript checked into the repo: docs/demo.md.
A copyable paid seller endpoint — gate first, Bazaar schema, idempotent retries, signed receipt — is one
file: examples/seller/seller.mjs. It is a reference to copy, not a
service we host.
Inside a loop, not in front of one
The endpoints that get paid in this ecosystem are cheap, deterministic calls an agent makes in a loop — hashing at 0.001 USDC, embeddings at 0.0005, completions at 0.003. A gate is bought
when it sits inside such a loop, so the integration is one line: whatever pays your x402 call, wrap it.
import { guardFetch } from "@paystage/x402-guard";
// Before: const pay = wrapFetchWithPayment(fetch, account);
// After: wrap the same fetch, and every 402 it meets is evaluated first.
const pay = guardFetch(fetch, { walletClient: account, policy });
const res = await pay(url, init);
guardFetch returns a fetch of the same shape, so the loop does not change: it evaluates the 402 the caller was about to sign and passes the response through only when the verdict is
pay. A refusal costs one call and nothing else. The exact options are in
packages/x402-guard/README.md. The paid endpoint is
$0.002 per call, the same order as the calls around it — so the gate is one more line item, not a new procurement.
A refusal costs nothing; a loop that pays a drainer costs every iteration.
Quick start
# Option 1: run instantly
npx -y -p @paystage/mcp paystage-mcp
# Option 2: install locally, then use the package bin
npm install @paystage/mcp
npx paystage-mcp
The server waits silently for an agent app to connect. That's normal; press Ctrl+C to exit. To try the tools without an app, run npx @modelcontextprotocol/inspector npx -y -p @paystage/mcp paystage-mcp.
@paystage/mcp is the umbrella MCP server (10 tools, including evaluate_hip3_trade and evaluate_velocity). It exposes the PayStage tools over stdio and reads a local policy file. See SECURITY.md for exactly what it accesses and why.
Connect in one command
Copy the line for your client. The remote is Streamable HTTP, so nothing needs installing.
# Claude Code
claude mcp add --transport http paystage https://api.paystage.xyz/mcp
# Cursor — append to .cursor/mcp.json
{"mcpServers":{"paystage":{"url":"https://api.paystage.xyz/mcp"}}}
# Any MCP client, or just to read the tool schemas without an account
npx -y mcporter list https://api.paystage.xyz/mcp
Prefer it local? npx -y -p @paystage/mcp paystage-mcp runs the same ten tools over stdio and reads a
policy file from disk.
How this is built
PayStage is a public good. MIT, no account, no custody, and an evaluator you can read in an afternoon.
The loop that maintains it is agentic. A research agent runs on a schedule, reads what changed in the protocol and the market, and
writes proposals; a human decides which become backlog rows; build and test agents implement them, and merged work ships through CI.
Counted from this repository on 2026-11-22: 300 merged pull requests, 14 published packages, and 10 MCP tools — each of those three is derived by a script in CI rather than typed here, which is why they are stated at all.
A seatbelt has to move at the speed of the road. The x402 spec, the facilitator landscape and the sanctioned-address list all change
without asking us, so the jobs that keep this useful — re-reading a spec, re-checking a list, noticing a facilitator that started
rejecting payments — are the jobs agents are best at. The loop runs on a cycle measured in hours; it does not claim to outrun an
exploit, and a 24-hour loop would not be that claim.
Who pays, so far. The project runs on a mix of credits and free model access — Google for Startups credits, Cloudflare credits, and
NVIDIA's free tier, which is what the long-running loops execute on. All three are usage, not funding, and none implies an endorsement. The provenance and the boundaries of that statement are in docs/funding.md
in the ops repository; the amount and expiry are not disclosed because they have not been stated anywhere this project can cite.
Sustainability, stated as a condition rather than a promise. The work runs on inference budget and operator time. If paid calls
ever cover the cost, the loop continues on its own; until then it depends on both being available. If neither is, the cycle slows —
written down here because the alternative is implying perpetual motion. The measured numbers behind any cost claim live in
docs/state/ so the claim can be checked rather than believed.
On the shoulders of others. This builds on the work of the people who maintain x402 — the protocol, its facilitators, and the
client SDKs whose interfaces we implement — and on the maintainers of the directories and lists that make tools findable. Where we
implement a spec we try to cite it; where we get something wrong, the issue is open.
Why an independent adjudicator exists
x402 is not owned by a vendor. It is a Linux Foundation project whose Technical Steering Committee lists Coinbase, Cloudflare and Stripe among
its participating organisations (TSC.md, read 2026-11-22). That structure is the
point: a payment rail several companies depend on cannot be judged by whichever one happens to hold the wallet.
Every payment has two roles, and they pull in opposite directions. The payer wants the call to happen; the adjudicator has to be able to
say no. A tool that holds the keys and approves the spend cannot credibly answer whether the spend was a good idea — it is the party whose revenue,
engagement or convenience depends on the answer being yes. The same reason a seller cannot verify its own delivery applies to a wallet judging its
own payment.
So the useful shape is a checker that is a third party to the transaction: it holds no funds, it is not the seller, it is not the wallet, and it
produces a record anyone can verify without trusting us. That is what this is, all the way down — MIT, no custody, self-hostable, verdicts carrying
the rule that fired, receipts signed with a published key, and the sanctions and drainer lists published so the reasons can be inspected rather
than believed.
Governance, sourced. The x402 Foundation was announced for launch in April 2026 and became operational on 14 July 2026, when Coinbase
completed its contribution of the protocol to the Linux Foundation, with 40 member organisations at launch — premier members include Adyen,
AWS, American Express, Circle, Cloudflare, Coinbase, Fiserv, Google, Mastercard, Monad Foundation, MoonPay, Ripple, Shopify, the Solana and Stellar
development foundations, Stripe and Visa. The charter covers "payment types ranging from traditional cards to stablecoins", so the governance was
built for several rails from the outset. PayStage is not a member of that structure; it is an independent checker that benefits from the
neutrality the structure creates. Sources: Linux Foundation press release, 14 July 2026 ·
TSC.md — both read 2026-11-22.