The payment layer for the agent economy.
The open, backendless rail for x402 agent payments — a TypeScript SDK, an MCP server, and built-in discovery, across 28 chains in 10 families. Let any HTTP endpoint charge for itself, let any AI agent pay for itself, and let both be found — in a couple of lines. No backend, no fee, no custody.
Get started → · Website · Live demo · MCP server · Discovery · Docs
PipRail implements the open 402 Payment Required standard for HTTP and agent payments. There is no backend, no database, no account, no dashboard, and no protocol fee. Payments settle straight into your own wallet, verified locally against your own RPC.
It's a library you npm install — not a hosted service you sign up for.
One package, the complete x402 stack — accept, pay, and discover:
| 💸 Accept | 🤖 Pay | 🧭 Discover |
|---|---|---|
Gate any route so it charges for itself — requirePayment / createPaymentGate. Paid straight to your wallet. |
Hand an agent a budget-bound wallet — PipRailClient or the MCP server. It pays 402s on its own, capped by a policy it can't exceed. |
Emit a manifest, register on the open indexes, and find payable APIs — register / discover. $0, no hosted registry. |
- 🔌 One parameter picks everything — name a
chain, add a wallet, get paid. - 🤖 Give your agent a wallet —
@piprail/mcplets Claude, Cursor & any MCP client pay x402 URLs on their own, capped by a spend policy the model can't exceed. - 🧭 Discoverable — emit a machine-readable manifest, register on the open x402 indexes (402 Index, CDP Bazaar), and let agents find and pay your endpoint. PipRail hosts no registry of its own.
- 🏷️ No facilitator, no fee — funds go wallet-to-wallet; you keep 100%.
- 🔒 Verified locally — on-chain checks run against your own RPC; nothing leaves your process.
- 🔋 Affordability-aware —
planPayment()checks balance, gas, and recipient-readiness before an agent pays. - 📦 Pure TypeScript — runs headless or in the browser;
viempeer dep, non-EVM libs lazy-loaded. - ⚖️ MIT licensed — use it, fork it, ship it.
The missing piece for the agent economy: an open, self-custodial payment rail any endpoint or agent can use in minutes — not a platform, not a toll booth. Live on mainnet across every family, listed in the MCP registry, MIT, $0.
Charge for an endpoint on the server, pay for one from the agent — the same chain parameter drives both sides.
import { requirePayment } from '@piprail/sdk'
// Server: make an endpoint charge for itself
app.get('/report',
requirePayment({ chain: 'base', token: 'USDC', amount: '0.05', payTo: '0xYourWallet…' }),
(_req, res) => res.json({ report: 'TOP SECRET' }),
)import { PipRailClient } from '@piprail/sdk'
// Agent: pay the 402 automatically
const client = new PipRailClient({ chain: 'base', wallet: { privateKey: process.env.AGENT_KEY } })
const res = await client.get('https://api.example.com/report')Or skip the code entirely — drop the MCP server into any agent and it pays, discovers, and registers x402 URLs itself, budget-bound. Add one block to your MCP client config:
See the full examples → · MCP setup guide →
One protocol, every major chain — 28 chains across 10 driver families (19 EVM mainnets plus Solana, TON, Tron, NEAR, Sui, Aptos, Algorand, Stellar, and XRPL). USDC nearly everywhere, USDT on most, native gas coins too.
Any other EVM chain works by passing a viem Chain or { id, rpcUrl } — the built-in presets are a convenience, not an allowlist.
| Package | What it is |
|---|---|
| @piprail/sdk | The core SDK — take or make x402 payments across 28 chains, in a couple of lines. |
| @piprail/mcp | An MCP server — give any AI agent a budget-bound wallet to pay, discover & register x402 URLs autonomously. Listed in the MCP registry as io.github.piprail/mcp. npx -y @piprail/mcp |
| Repository | Description |
|---|---|
| piprail/piprail | The @piprail/sdk + @piprail/mcp source, the static landing site, and runnable examples. |
PipRail is open source under the MIT license. Issues and pull requests are welcome on the main repository. The SDK's tests are the canonical contract — behaviour changes start there.
Get started · Try the live demo · Browse the code
Built on the open x402 standard · MIT licensed · No backend, no fee, ever.