PipRail
A budget-bound x402 payment wallet for AI agents: it autonomously pays HTTP 402 payment-gated URLs across every major chain (EVM, Solana, and many non-EVM families). Self-custodial and backendless, your key, your RPC, with spend caps enforced before any on-chain send.
README
<div align="center">
<img src="site/public/og.png" alt="PipRail — the payment layer for the agent economy" width="840" />
<br/> <br/>
Let any HTTP endpoint charge for itself, and any agent pay for itself — across 28 chains, in a couple of lines.
Website · npm · Full docs →
</div>
@piprail/sdk implements the open x402 "402 Payment Required" standard with no backend, no database, no account, 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.
npm install @piprail/sdk viem
💸 Charge for an endpoint
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. The first request gets a 402 with payment instructions; once the caller pays on-chain, it goes through. One parameter picks the chain.
🤖 Let an agent pay for it
import { PipRailClient } from '@piprail/sdk'
const client = new PipRailClient({ chain: 'base', wallet: { privateKey: process.env.AGENT_KEY } })
// Hits a 402, pays it on-chain, waits for confirmation, retries with proof — automatically.
const res = await client.fetch('https://api.example.com/report')
The same app can take payments and make them. Built for autonomous agents: install, add a wallet, monetize or pay — nothing else to wire up.
🔌 …or hand any AI agent a wallet — no code
@piprail/mcp is an MCP server that gives Claude Desktop, Cursor, Claude Code, Windsurf, VS Code, or Cline a budget-bound wallet. Add one block to your client config and the agent pays, discovers, and registers x402 URLs on its own — capped by a spend policy it cannot exceed:
{ "mcpServers": { "piprail": {
"command": "npx", "args": ["-y", "@piprail/mcp"],
"env": { "PIPRAIL_PRIVATE_KEY": "0x…", "PIPRAIL_CHAIN": "base", "PIPRAIL_MAX_AMOUNT": "0.10" } } } }
Five tools appear — piprail_discover, piprail_quote_payment, piprail_plan_payment, piprail_pay_request, piprail_register. Runs locally with your key; no backend, no custody. → MCP guide
🧭 Be discoverable — get found, find others
A 402 endpoint is payable, but nobody can find it. PipRail closes that gap with $0, no backend — built on the open x402 indexes (402 Index, CDP Bazaar), nothing PipRail-hosted:
await client.register('https://api.example.com/report', { name: 'Market Report', priceUsd: 0.05 })
const hits = await client.discover({ query: 'market data' }) // find payable APIs to use
Emit a machine-readable manifest (buildOpenApi / buildWellKnownX402 / buildX402DnsTxt), register on the open indexes (no auth, any chain), and discover resources to pay. → DISCOVERY.md
🌐 Supported chains
28 chains across 10 families — name one with a single chain: parameter. Non-EVM families lazy-load on first use, so a pure-EVM install never downloads their libraries.
| Family | Built-in chains | Tokens |
|---|---|---|
| EVM (19) | Ethereum · Base · Arbitrum · Optimism · Polygon · BNB · Avalanche · Mantle · Sonic · Linea · Scroll · Celo · zkSync · Unichain · World Chain · Sei · Injective · HyperEVM · Monad | USDC + USDT* |
| Solana | Solana | USDC · USDT |
| TON | The Open Network | USD₮ |
| Tron | Tron | USD₮ |
| NEAR | NEAR | USDC · USDT |
| Sui | Sui | USDC |
| Aptos | Aptos | USDC · USDT |
| Algorand | Algorand | USDC |
| Stellar | Stellar | USDC · EURC |
| XRP Ledger | XRPL | USDC · RLUSD |
<sub>*USDC on every EVM chain; USDT on all of them except Base, World Chain, Sei, HyperEVM, and Monad (their "USDT" is USDT0/LayerZero, not Tether-native — omitted). Any other EVM chain works via a viem Chain or { id, rpcUrl } — no allowlist. Every token address was verified on-chain before shipping.</sub>
✨ Why PipRail
Anything should be able to charge for itself — an API, a dataset, a model, an agent — and anyone should be able to get paid for it in seconds, without asking a platform for permission. The agent economy will run on millions of tiny, machine-to-machine payments, and that rail should be open, free, and self-custodial — not a toll booth owned by a middleman.
So we built it that way: no backend, no fees, no gatekeeper — an MIT library that turns any endpoint into a paid one and any agent into a paying customer, on every major chain. The goal is simple and audacious: make open, self-custodial payments the default rail for the agent economy.
⚙️ How it works
Agent Your server
│ GET /report │
│ ───────────────────────────────────────►│ requirePayment
│ ◄──────────── 402 + payment-required ────│ (issues a challenge)
│ pay on-chain (one transfer to payTo) │
│ ───────────────────► [the chain] │
│ GET /report + payment-signature │
│ ───────────────────────────────────────►│ verifies the tx against
│ ◄──────────── 200 + your content ────────│ its own RPC, then next()
Verification is local and confirms the transaction succeeded, is recent, and actually moved the required amount of the right token to payTo. The x402 v2 spec (§7) explicitly endorses merchant-local verification — no facilitator required — so this is a spec-compliant shape, not a workaround. Self-custody throughout: the payer signs and broadcasts their own transfer straight to your wallet; PipRail never holds funds and never takes a cut.
📦 What's in here
piprail/
├── sdk/ # @piprail/sdk — the core SDK (the product) → published to npm
├── mcp/ # @piprail/mcp — the MCP server wrapping the SDK → published to npm
├── site/ # piprail.com — the landing site (Astro 5 + Tailwind v4, deploys to Netlify)
├── examples/ # runnable merchant + agent demos + a live Anvil end-to-end
└── .github/ # CI: build/test checks · npm publish on sdk-v* / mcp-v* tags
Two packages are published to npm: @piprail/sdk (the
core library) and @piprail/mcp (the MCP server, also
listed in the MCP registry as io.github.piprail/mcp).
site/ is the source of piprail.com; examples/ holds runnable demos — both
live here in the repo but aren't published.
→ Full API & guides: sdk/README.md · MCP: mcp/README.md · discovery: sdk/DISCOVERY.md
No contracts/, no server, no database. PipRail is a tool you install, not a platform you sign up for.
🛠️ Quick start
npm install # install workspace deps
npm run build:sdk # build the SDK (build it before the MCP — the MCP imports its dist)
npm run test:sdk # run the SDK test suite
npm run build:mcp # build the MCP server
npm run test:mcp # run the MCP test suite
npm run typecheck # typecheck the SDK + MCP
npm run dev # run the landing site → http://localhost:4321
Live, end-to-end proofs (real published packages, no mocks) live in examples/:
node run-all.mjs in examples/sdk-sandbox (the gate, client, policy, a real
on-chain round-trip on a local Anvil fork, and live discovery) or examples/mcp-sandbox
(the MCP server attacked as a greedy AI). A runnable examples/discovery calls
emit / register / discover against the real open indexes.
Releasing a new version? See RELEASING.md — the publish is tag-driven CI, and a build-time guard keeps the site's docs in sync with the packages.
📄 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.
Contributions welcome — see CONTRIBUTING.md (a simple DCO sign-off, no CLA).
<div align="center"> <br/> <img src="site/public/logo.png" alt="PipRail" width="64" />
<sub>Built for the agent economy · <a href="https://piprail.com">piprail.com</a></sub> </div>
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。