Skip to main content
Glama

@piprail/sdk @piprail/mcp types license x402 v2 chains GitHub stars Follow @piprailhq

Let any HTTP endpoint charge for itself, and any agent pay for itself — across every major chain, in a couple of lines.

Website · Documentation · npm


PipRail implements the open x402 "402 Payment Required" standard with no backend, no database, no account, no API key, and no fee. Payments settle straight into your wallet, verified locally against your own RPC — across every major EVM chain plus Solana, TON, Tron, NEAR, Sui, Aptos, Algorand, Stellar & the XRP Ledger. Self-custodial throughout.

How a payment moves

The middle is the difference. A traditional processor holds the money in transit, takes days to release it, and can freeze or reverse it. PipRail removes the middle entirely — the agent pays the merchant's wallet directly, the merchant verifies it locally against their own RPC, and it settles in one transaction at 0% fee, self-custodial end to end.  See it on piprail.com →

Related MCP server: @hpp-io/x402-mcp-bridge

📊 The pitch deck

▶︎  Open the full deck — PDF  ◀︎

Opens right here in your browser — no download, GitHub renders it inline. 16 slides · every stat sourced in the speaker notes.

The whole thesis in one read: why agent payments are happening now, why chain & token fragmentation is the enemy, and how a single chain: parameter turns PipRail into the universal adapter. The payment path is 0% forever — the moat and the distribution; value accrues to the layer around the free rail, never the rail itself.

#

Slide

#

Slide

1

Hero — the universal payment rail for the agent economy

9

The MCP — give your agent a budget-bound wallet

2

Why now — money is moving on-chain

10

Open · dual-rail · gasless

3

The new buyer — autonomous agents

11

MPP vs PipRail — count the middlemen

4

The standard — x402, "402 Payment Required"

12

Discovery + integrations

5

The problem — chain & token fragmentation

13

Why PipRail wins — the moat

6

The reveal — the universal adapter

14

Traction

7

How it works — 402 → pay → verify → 200

15

Business model — open core, 0% rail

8

Two sides, one SDK — accept and pay

16

The ask

Source .pptx (fully editable, brand fonts embedded) lives in .claude/skills/branding/design/deck/. The root PipRail-deck.pdf is regenerated from it — don't hand-edit the PDF.

📖 Full documentation → docs.piprail.com

The single, searchable source of truth — every function, option, chain, and example. This README is just the front door.

What's here

@piprail/sdk

The TypeScript SDK — accept & make x402 payments. The product. Optionally swaps tokens where an open, keyless route exists (no fee, no API key, never automatic).

@piprail/mcp

An MCP server giving any AI agent a budget-bound wallet (io.github.piprail/mcp).

@piprail/create

npm create @piprail — scaffolds a runnable, mainnet-by-default x402 merchant in one command. Paste a public address; no key, no backend.

integrations/

First-party agent-framework integrations — OpenClaw, Hermes, elizaOS (@piprail/elizaos-plugin), n8n (@piprail/n8n-nodes-piprail) & Mastra. Each wraps @piprail/sdk or @piprail/mcp; nothing new to build.

site/ · docs/ · examples/

piprail.com · the docs.piprail.com source · runnable demos.

Quick taste

npm install @piprail/sdk viem
import { requirePayment } from '@piprail/sdk'

app.get('/report',
  requirePayment({ chain: 'base', token: 'USDC', amount: '0.05', payTo: '0xYourWallet…' }),
  (_req, res) => res.json({ report: 'TOP SECRET' }),
)

That route now costs 0.05 USDC on Base, paid straight to your wallet. Point an agent at it and it pays itself — name any chain with a single chain: parameter. The full quickstart, every chain, the MCP server, spend controls, and the error model are in the docs.

Spread the word

PipRail is free, open-source, and has no backend to sell you — so word of mouth is how it grows. If it saved you from building a payments backend, the best way to give back is to help other developers (and their agents) find it:

License & trademark

Code: MIT — use it, fork it, ship it, commercially or otherwise.

Name & brand: PipRail™, the logo, and the @piprail npm scope are trademarks of the PipRail project — MIT covers the code, not the name. Build on it freely; just don't call a fork "PipRail" or imply it's official. See TRADEMARK.md.

Built for the agent economy · piprail.com

Available Tools

8 tools
piprail_budgetA
Read-onlyIdempotent

Read how much of your spend budget and time leash is left — per (network, asset) remaining, the cross-token GRAND TOTAL per denomination (e.g. how much USD you can still spend across every stablecoin and chain), the payment-count leash, the session time envelope, and your spend so far. Use it in Mode A (headless) to self-check BEFORE paying, so you never discover the leash by hitting a decline. Read-only; moves no funds. NOTE: the time envelope is in-memory for THIS process; the money/count totals persist only if a spend store is configured.

Inputs: no named parameters. Returns: object

piprail_discoverA
Read-only

Find x402 payment-gated resources on the OPEN indexes (a phone book of payable APIs) WITHOUT paying. Use it to answer "what can I buy?" — search by topic, then quote/plan/pay a chosen one. By default returns only resources payable on your wallet's chain (network='self'); pass 'any' for every chain. Results are cross-scheme: ALWAYS call piprail_quote_payment on a chosen resource (it re-checks the live price) before piprail_pay_request.

Inputs: sort, asset, limit, query, +5 more.

piprail_guideA
Read-onlyIdempotent

Read the PipRail agent contract — the quote → plan → pay loop, how to read a refusal (and which declines are TERMINAL), the never-re-pay rule for broadcast-but-unconfirmed payments, and Mode A (headless) vs Mode B (supervised). Read-only; call it once if unsure how to use these tools.

Inputs: no named parameters.

piprail_pay_requestA
Destructive

Fetch an x402 payment-gated URL, automatically making the required payment if needed (subject to the spend policy + approval hook). Pays whichever rail the client is configured for — PipRail's backendless on-chain rail, or, when enabled, the standard exact rail (where the buyer signs and the server settles, so no buyer gas). Returns the HTTP status, the response body, and a payment receipt if one settled. If the payment is refused by policy or the approval hook, returns { declined: true, reason } — no funds moved.

Inputs: url (required), body, method.

piprail_plan_paymentA
Read-only

Check whether you CAN pay an x402-gated URL before paying. Reads your wallet balance, native gas, and whether the recipient can receive — across every rail the URL offers on your chain — and returns { gated, payable, best, options, fundingHint }. payable:false means do NOT attempt the payment; fundingHint says exactly what to top up. Call this before piprail_pay_request so you never commit to a payment you cannot finish. Returns { gated: false } when no payment is needed.

Inputs: url (required). Returns: object

piprail_quote_paymentA
Read-only

Get the price of an x402 payment-gated URL WITHOUT paying. Returns the amount, token, chain, recipient, and whether it is within the spend policy. Returns { gated: false } when the URL needs no payment. Call this first to decide whether a resource is worth buying.

Inputs: url (required). Returns: object

piprail_registerA

List an x402 payment-gated resource YOU run on the open indexes so other agents can discover it. Default target is 402 Index — no auth, no signature, no payment; a self-registered listing is pending review (verify your domain on 402index.io for instant approval). Returns one outcome per index ({ source, ok, detail, visibility, note }); a step the chain can't satisfy comes back ok:false with the reason. Moves no funds; nothing is PipRail-hosted. NOTE: index/agent payers are overwhelmingly standard exact clients — a default onchain-proof-only gate gets listed but they cannot pay it, so add an exact rail (and set the gate's discovery option, required for x402scan) to be usefully discoverable AND payable.

Inputs: url (required), name, tags, asset, +6 more.

piprail_verify_receiptA
Read-onlyIdempotent

Re-verify a PipRail VERIFIABLE RECEIPT against the chain — confirm a payment REALLY settled (the funds provably moved to payTo for AT LEAST the stated amount) WITHOUT trusting whoever handed you the receipt. Read-only and WALLET-FREE: pass the PipRailReceipt JSON (from a prior piprail_pay_request verifiableReceipt, or any third party). Returns { ok, onChain:{payTo,asset,amount,payer}, matchesClaims, ageSeconds, error? }: ok = the chain confirms the settlement; onChain.payer is RE-DERIVED from the tx and matchesClaims:false means the receipt forged the payer; amount is a verified lower bound. Pass rpcUrl for a chain outside the common presets.

Inputs: receipt (required), rpcUrl.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A4.4/5.0

    Scored across 8 tools

    Disambiguation5/5

    Each tool targets a distinct stage of the x402 workflow: discovery, quoting, planning, paying, registration, budget checking, guidance, and receipt verification. There is no functional overlap between tools, making selection straightforward for an agent.

    Naming Consistency5/5

    All tools share the piprail_ prefix and follow a consistent verb or verb_noun pattern in snake_case (e.g., quote_payment, pay_request, verify_receipt). The naming is predictable and reinforces the tool's purpose.

    Tool Count5/5

    With 8 tools, the server is well-scoped. Each tool covers a necessary function for both buyers and sellers in the x402 payment ecosystem, with no apparent redundancy or bloat.

    Completeness4/5

    The buyer lifecycle is fully covered from discovery through payment and verification, with budget and guide support. The only minor gap is the lack of explicit update or unregister functionality for seller resource listings, but this is likely outside the core client scope.

    Maintenance

    ActivityNo data
    ResponsivenessOutdated data

    Related MCP Connectors

    Related MCP Servers