
Agentpay
- Updated March 21, 2026
- alefnt/AgentPay
AgentPay is a MCP server that lets coding agents execute CKB Fiber zero-gas micropayments with Hold Invoice escrow via MCP tools.
About
AgentPay is a Model Context Protocol server that exposes an AI-agent payment protocol on the CKB Fiber Network, emphasizing zero-gas micropayments and Hold Invoice escrow so funds can be held until work is verified. Developers shipping agent marketplaces, metered APIs, or pay-per-task automation can register the NPM package @agentpay-dev/mcp-server in Claude Code or Cursor instead of maintaining bespoke wallet scripts. Configuration requires a Fiber Network RPC endpoint via the mandatory FIBER_RPC_URL variable, which places this firmly in intermediate territory alongside any keys or wallets your deployment demands. Version 0.1.1 is early-stage protocol software, so you should treat flows as experimental until you have audited your own threat model. The canonical shelf is Build integrations because monetized agent behavior is wired in parallel with the code that invokes tools, not as a one-off launch checklist item.
- NPM package @agentpay-dev/mcp-server (v0.1.1) with stdio transport
- CKB Fiber Network RPC with required FIBER_RPC_URL environment variable
- Zero-gas micropayments tuned for AI agent commerce
- Hold Invoice escrow pattern for safer agent-to-agent settlement
Agentpay by the numbers
- Data as of Jul 7, 2026 (Skillselion catalog sync)
claude mcp add --env FIBER_RPC_URL=YOUR_FIBER_RPC_URL agentpay -- npx -y @agentpay-dev/mcp-serverAdd your badge
Show developers this MCP server is listed on Skillselion. Paste this into your README.
| Package | @agentpay-dev/mcp-server |
|---|---|
| Transport | STDIO |
| Auth | Required |
| Last updated | March 21, 2026 |
| Repository | alefnt/AgentPay ↗ |
What it does
Let autonomous agents send zero-gas micropayments on CKB Fiber with Hold Invoice escrow through MCP instead of custom wallet code.
Who is it for?
Best when you're building paid agent services, API metering, or escrowed task markets on CKB Fiber.
Skip if: Skip if you only need Stripe or fiat checkout without blockchain agent wallets.
What you get
After you configure FIBER_RPC_URL and add the MCP server, agents can initiate micropayments and escrow holds through standardized tool calls.
- MCP tools for zero-gas micropayment flows on Fiber
- Hold Invoice escrow invocations callable by your agent
By the numbers
- NPM package @agentpay-dev/mcp-server version 0.1.1
- Requires FIBER_RPC_URL environment variable for Fiber Network RPC
README.md
AgentPay - BTC-Native AI Agent Payment Protocol
Give every AI Agent a wallet. Let Agents pay each other - instantly, with zero fees.
AgentPay is a BTC-native payment protocol designed for AI Agent economies. Built on CKB Fiber Network (Lightning-compatible L2), it enables:
- Zero-gas micropayments - Pay per API call, no minimum amount
- Hold Invoice escrow - Lock funds until service delivery is confirmed
- BTC interoperability - Cross-chain payments via Lightning Network
- MCP integration - Let Claude/GPT agents make payments natively
Quick Start
Install
npm install @agentpay-dev/sdk @agentpay-dev/core
Create a Payment Agent
import { AgentWallet } from '@agentpay-dev/sdk';
const wallet = new AgentWallet({ fiberRpcUrl: process.env.FIBER_RPC_URL });
// Pay another agent for a service
const result = await wallet.payAndCall(
'https://translator-agent.example.com',
'translate',
{ text: 'Hello World', target: 'zh' }
);
Scaffold a New Project
npx create-agentpay my-agent
cd my-agent && npm install
Architecture
+-----------------------------------------------------+
| Applications |
| AI Agents | DePIN Devices | API Marketplaces |
+-----------------------------------------------------+
| AgentPay SDK |
| AgentWallet | ServiceProvider | HubClient |
+-----------------------------------------------------+
| AgentPay Core |
| Settlement | Metering | DID | Assets |
+-----------------------------------------------------+
| CKB Fiber Network (L2) |
| Payment Channels | Hold Invoice | HTLC Routing |
+-----------------------------------------------------+
| CKB L1 + BTC Lightning Network |
| xUDT Assets | RGB++ | Cross-chain (Cch) |
+-----------------------------------------------------+
Packages
| Package | npm | Description |
|---|---|---|
@agentpay-dev/core |
Protocol core: Fiber RPC, settlement, assets, DePIN metering | |
@agentpay-dev/sdk |
Developer SDK: AgentWallet, ServiceProvider, HubClient | |
@agentpay-dev/mcp-server |
MCP Server: 8 payment tools for Claude/GPT | |
@agentpay-dev/x402-facilitator |
HTTP 402 payment middleware with Fiber settlement | |
@agentpay-dev/ap2 |
Google AP2 protocol bridge to Fiber | |
create-agentpay |
CLI scaffolding tool |
Key Features
Hold Invoice - Trustless Escrow
The killer feature. Agent A locks payment, Agent B delivers, funds release only on confirmation:
import { ServiceProvider } from '@agentpay-dev/sdk';
const provider = new ServiceProvider({
fiberRpcUrl: process.env.FIBER_RPC_URL,
services: {
translate: {
price: 100_000_000n, // 1 CKB per request
handler: async (params) => {
const result = await doTranslation(params.text, params.target);
return { translation: result };
}
}
}
});
// Hold flow: Lock -> Deliver -> Release (atomic)
// If service fails, funds auto-refund via HTLC timeout
MCP Server - AI-Native Payments
Registered on the official MCP Registry as io.github.alefnt/agentpay.
Add to Claude Desktop config:
{
"mcpServers": {
"agentpay": {
"command": "npx",
"args": ["@agentpay-dev/mcp-server"],
"env": { "FIBER_RPC_URL": "http://localhost:8227" }
}
}
}
8 MCP Tools:
| Tool | Description |
|---|---|
get_balance |
Check wallet balance (CKB + xUDT) |
send_payment |
Send a payment via Fiber invoice |
create_invoice |
Generate a Fiber invoice to receive payment |
pay_for_service |
Pay-and-call another agent's API |
create_hold_invoice |
Create escrow payment (lock funds) |
settle_hold |
Release held funds after service delivery |
cancel_hold |
Cancel and refund held payment |
list_channels |
View active payment channels |
x402 HTTP Compatibility
Any HTTP API becomes a paid API with one middleware:
import { createX402Middleware } from '@agentpay-dev/x402-facilitator';
const paywall = createX402Middleware({ price: '100000000' });
http.createServer((req, res) => {
paywall(req, res, () => {
res.end(JSON.stringify({ data: 'premium content' }));
});
});
// Client: HTTP 402 -> pay Fiber invoice -> retry -> get content
BTC Cross-Chain
Pay with BTC, settle on CKB via Lightning-Fiber bridge:
import { CchClient } from '@agentpay-dev/core';
const cch = new CchClient({ cchRpcUrl: process.env.CCH_RPC_URL });
await cch.sendBtcToCkb({
btcPayReq: 'lnbc100n1p...',
fiberChannelId: '0x...',
});
Ecosystem Integration
AgentPay enhances existing payment solutions:
| Platform | How AgentPay Helps |
|---|---|
| x402 (Coinbase) | Zero-gas Fiber settlement backend for HTTP 402 protocol |
| AP2 (Google) | Settlement layer for agent authorization framework |
| Stripe | Complements with agent-to-agent micropayments (sub-cent) |
| Lightning Network | Cross-chain via Cch bridge, expanding BTC payment reach |
Project Structure
AgentPay/
packages/
core/ # Protocol core (Fiber RPC, settlement, DePIN)
sdk/ # Developer SDK (Wallet, Provider, Hub)
mcp-server/ # MCP Server for AI agents
x402-facilitator/ # HTTP 402 middleware
ap2/ # Google AP2 bridge
create-agentpay/ # CLI scaffolding
services/
hub/ # Hosted wallet service
registry/ # Agent discovery service
examples/
translate-agent/ # Translation service example
code-review-agent/ # Code review agent example
btc-to-ckb/ # Cross-chain payment example
docs/
product.md # Product overview
architecture.md # Technical architecture
Documentation
- Product Overview - What AgentPay solves and how
- Architecture - Technical design and protocol layers
- Competitive Analysis - Comparison with x402, AP2, Stripe
Tech Stack
- Runtime: Node.js 20+ / TypeScript 5.5+
- L2 Network: CKB Fiber Network (Lightning-compatible)
- L1 Blockchain: Nervos CKB
- Asset Standard: xUDT (extensible User Defined Token)
- Identity: .bit decentralized identity
- Cross-chain: Cch (CKB - BTC Lightning bridge)
- AI Integration: Model Context Protocol (MCP)
- Build: pnpm workspace monorepo
Development
git clone https://github.com/alefnt/AgentPay.git
cd AgentPay
pnpm install
pnpm build
pnpm test
Roadmap
- Core protocol (Fiber RPC, settlement, assets)
- SDK (AgentWallet, ServiceProvider, HubClient)
- MCP Server with 8 payment tools
- x402 HTTP 402 facilitator
- AP2 protocol bridge
- DePIN metering module
- BTC cross-chain (Cch + LND)
- RGB++ bridge integration
- npm packages published
- MCP Registry registration
- Fiber mainnet deployment
- Stablecoin (RUSD) support on CKB
- Public demo site
- Production Hub service
License
MIT - see LICENSE for details.
Built for the Agent Economy - where AI agents autonomously discover, negotiate, and pay for services.
Recommended MCP Servers
How it compares
On-chain agent payment MCP, not a traditional e-commerce skill or hosted billing dashboard.
FAQ
Who is AgentPay for?
Developers and agent authors who need CKB Fiber micropayments and Hold Invoice escrow callable from MCP-enabled coding agents.
When should I use AgentPay?
Use it while integrating pay-per-use or escrowed settlements into an agent product on the CKB Fiber Network.
How do I add AgentPay to my agent?
Install @agentpay-dev/mcp-server, set FIBER_RPC_URL to your Fiber Network RPC URL, and register the stdio MCP entry in your client config.