Agentpay

io.github.alefntPublished by GitHub account alefntv0.1.1Updated Oct 27, 2026

AI Agent payment protocol on CKB Fiber Network. Zero-gas micropayments with Hold Invoice escrow.

The publisher's own server: AgentPay — Pay-per-call AI Microservices

VerifiedSTDIODesktop onlyFinanceAI & ML

Overview

AI-generated overview

AgentPay MCP server lets an AI assistant hold a CKB Fiber wallet and make zero-gas micropayments, including escrowed hold invoices, to other agents.

What you can do
  • Check wallet balances in CKB and xUDT tokens
  • Send payments via Fiber invoices and create invoices to receive payment
  • Pay and call another agent's API in one step
  • Create hold invoices that lock funds, then settle or cancel them as escrow
  • List active payment channels
When to use it
Use it when an assistant needs to pay for API calls or services from other agents, or to run escrow-style agent-to-agent payments on the CKB Fiber network. Not useful unless you already operate a Fiber node and wallet.
Requirements
Runs locally over stdio via npx from the npm package. Requires Node.js 20+ and a reachable Fiber Network RPC endpoint supplied in the FIBER_RPC_URL environment variable. A funded Fiber wallet and payment channels are needed for actual payments.
Before you install
The server can move real funds: sending payments, locking escrow and releasing or cancelling holds all spend money, and mistakes may be irreversible. It needs access to your Fiber node RPC, so point FIBER_RPC_URL only at a node you control. Review each payment action before approving.

Installation

In SourceWeft

  1. Open Agentpay in the dashboard and add it to a workspace.
  2. Enable the server for the chats that should use its tools.

Desktop only via STDIO. STDIO servers start a local process, so they need the SourceWeft desktop host.

Other MCP clients

Follow the launch instructions in the repository.

README

AgentPay - BTC-Native AI Agent Payment Protocol

[npm] [npm] [npm] [MCP Registry] [License: MIT]

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

bash
npm install @agentpay-dev/sdk @agentpay-dev/core

Create a Payment Agent

typescript
import { AgentWallet } from '@agentpay-dev/sdk';
const wallet = new AgentWallet({ fiberRpcUrl: process.env.FIBER_RPC_URL });
// Pay another agent for a serviceconst result = await wallet.payAndCall(  'https://translator-agent.example.com',  'translate',  { text: 'Hello World', target: 'zh' });

Scaffold a New Project

bash
npx create-agentpay my-agentcd 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

PackagenpmDescription
@agentpay-dev/core[npm]Protocol core: Fiber RPC, settlement, assets, DePIN metering
@agentpay-dev/sdk[npm]Developer SDK: AgentWallet, ServiceProvider, HubClient
@agentpay-dev/mcp-server[npm]MCP Server: 8 payment tools for Claude/GPT
@agentpay-dev/x402-facilitator[npm]HTTP 402 payment middleware with Fiber settlement
@agentpay-dev/ap2[npm]Google AP2 protocol bridge to Fiber
create-agentpay[npm]CLI scaffolding tool

Key Features

Hold Invoice - Trustless Escrow

The killer feature. Agent A locks payment, Agent B delivers, funds release only on confirmation:

typescript
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:

json
{  "mcpServers": {    "agentpay": {      "command": "npx",      "args": ["@agentpay-dev/mcp-server"],      "env": { "FIBER_RPC_URL": "http://localhost:8227" }    }  }}

8 MCP Tools:

ToolDescription
get_balanceCheck wallet balance (CKB + xUDT)
send_paymentSend a payment via Fiber invoice
create_invoiceGenerate a Fiber invoice to receive payment
pay_for_servicePay-and-call another agent's API
create_hold_invoiceCreate escrow payment (lock funds)
settle_holdRelease held funds after service delivery
cancel_holdCancel and refund held payment
list_channelsView active payment channels

x402 HTTP Compatibility

Any HTTP API becomes a paid API with one middleware:

typescript
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:

typescript
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:

PlatformHow AgentPay Helps
x402 (Coinbase)Zero-gas Fiber settlement backend for HTTP 402 protocol
AP2 (Google)Settlement layer for agent authorization framework
StripeComplements with agent-to-agent micropayments (sub-cent)
Lightning NetworkCross-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

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

bash
git clone https://github.com/alefnt/AgentPay.gitcd AgentPaypnpm installpnpm buildpnpm 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.

Source: README.md at commit 0eec0cb

Tools

0
SourceWeft has not started this package in its sandbox yet, so its tools are not known.

Version history

1
  1. v0.1.1LatestSep 16, 2026

Score

50% of the applicable checks met

How complete this listing is, computed from the registry entry, the endpoint and public sources. Not a rating of the server and not a statement that it is safe or working today: reachability is a dated check, and no installs or reviews go into the score.

  • Reached in the last 30 days25 pts

    Keep the endpoint answering the MCP handshake; SourceWeft probes it every 30 days.

  • Auth declared10 pts

    Declare the credential headers in the registry entry, or keep the endpoint answering the probe so its auth can be classified.

  • Tools listed15 pts

    Answer tools/list without a credential, or ship a package that starts in a sandbox without one.

  • DescriptionRequired15 pts
  • Logo10 pts
  • Documentation15 pts
  • License10 pts

Other Agentpay integrations