MCP-Pay
{"type": "text"}
MCP-Pay
一个基于 Algorand 的 HTTP x402 变现层,让 AI 智能体能够以低于一美分、按次调用的方式为 MCP 工具付费。
问题
使用模型上下文协议(MCP)的自主 AI 智能体无法访问付费工具:信用卡、API 密钥和订阅都是面向人类的工作流程。工具创建者无法按次调用收费,而传统区块链对于机器对机器的微支付来说太慢或太贵。
Related MCP server: Agent Commerce Gateway
解决方案
MCP-Pay 可将任何 MCP 工具转换为 Algorand 上即时变现的 x402 端点。
智能体在
GET /mcp/v1/tools发现工具(免费,包含 JSON 模式和价格)。智能体在未付款的情况下调用
POST /mcp/v1/tools/:name/execute。服务器返回
402 Payment Required及付款元数据(USDC 价格、接收方地址、网络)。智能体的本地中间件自动签署 Algorand USDC 转账(ASA 31566704)并重试。
GoPlausible 协调器 在链上验证并结算(<3.3 秒最终性),工具执行,结果在一次往返中返回。
无需账户。无需密钥。无需人工。
独特卖点
典型的付费 API | MCP-Pay |
一个硬编码的端点 | 工具注册表:任何工具都能成为带模式定义的有偿服务 |
为人类编写的文档 | 智能体原生发现:智能体以编程方式列出、比较和选择工具 |
订阅 / 预付费积分 | 真正的按次付费,每次请求均在链上结算 |
EVM 的 Gas 费扼杀了微支付 | Algorand:约 0.001 ALGO 费用,3.3 秒最终性 |
包含的付费工具
工具 | 功能 | 价格 |
| 提取任何公共网页的阅读器模式内容,用于 LLM 上下文 | $0.002 |
| 来自无需密钥的公共数据源的实时加密货币现货价格 | $0.001 |
| 对 Solidity 源码进行静态启发式安全扫描 | $0.005 |
架构
┌────────────────────────┐
│ AI AGENT (client/) │ 1. GET /mcp/v1/tools (discovery)
│ auto-paying MCP agent │ 2. POST .../execute → 402 challenge
└───────────┬────────────┘ 3. sign USDC txn locally
│ 4. retry + X-PAYMENT header
▼
┌────────────────────────┐
│ MCP-PAY SERVER (Hono) │ x402 paymentMiddleware protects each tool route
│ registry + tools/* │ executes tool only after verified settlement
└───────────┬────────────┘
▼
┌────────────────────────┐
│ GOPLAUSIBLE FACILITATOR│ /verify + /settle on Algorand TestNet
│ https://facilitator. │ USDC (ASA 31566704) transfer
│ goplausible.xyz │
└────────────────────────┘技术栈
TypeScript、Hono
@x402-avm/extensions(Bazaar 发现)GoPlausible 协调器、Algorand TestNet USDC
本地运行
1. 前提条件
Node.js 18+、pnpm(
npm i -g pnpm)两个已注资的 Algorand TestNet 账户:
服务器钱包(接收方):仅需地址
智能体钱包(付款方):助记词,保存在本地——切勿提交
通过 Lora 水龙头 注资,在 Lora 中将两个账户都选择加入 USDC,然后从 Circle 水龙头 获取 TestNet USDC(选择 Algorand Testnet)。
2. 配置
pnpm install
cp .env.example .env填写 .env:
AVM_ADDRESS=<server wallet address> # receiver
AVM_MNEMONIC="<agent 25-word mnemonic>" # payer, LOCAL ONLY
SERVER_URL=http://localhost:40213. 启动服务器 + 运行智能体
pnpm server # terminal 1
pnpm agent # terminal 2: discovery → 402 → auto-pay → result链上验证
每次成功调用都会在 TestNet 上结算一笔真实交易:
示例结算交易(来自演示运行):
TODO: paste Lora transaction link after first live runAPI
端点 | 付款 | 描述 |
| 免费 | 存活检查 |
| 免费 | 带模式和价格的工具目录 |
| x402 | 执行工具,按次付费 |
路线图
支出策略防护:由中间件执行的每个智能体预算
创建者仪表盘:在几分钟内注册您自己的 MCP 工具并定价
在 GoPlausible 上架 Bazaar,以便任何第三方智能体都能发现 MCP-Pay 工具
This server cannot be deployed
Maintenance
Related MCP Connectors
Pay-per-call MCP tools run by autonomous AI agents, each call paid with x402 in USDC.
Pay-per-use tool marketplace for AI agents. Search, price-check, and call APIs via MCP.
x402 pay-per-call APIs over MCP, settled in USDC on Base for autonomous agents and developers.
Metered MCP tools: free discovery over MCP; per-call execution settled in USDC via x402 v2.
Related MCP Servers
AlicenseNot gradedqualityBmaintenanceEnables AI agents to pay for MCP tool calls using either Bitcoin/Lightning (L402) or USDC (x402) rails, with unified settlement and a 21% discount for Bitcoin payments.32 npmMIT- AlicenseNot gradedqualityBmaintenanceEnables AI agents to discover, call, and pay for existing HTTP APIs over MCP with x402 paywalls, non-custodial settlement, and no code changes to the backend.436 npm62Apache 2.0
- AlicenseNot gradedqualityCmaintenanceExposes a live catalogue of specialist tools as MCP endpoints and returns x402 payment challenges for each call, letting agents pay per use in USDC from their own wallet without subscriptions or API keys.MIT
- AlicenseNot gradedqualityCmaintenanceEnables AI clients to discover, trust-check, and pay for Algorand x402 services in USDC, with policy-guarded spending, relay fallback, and an audit ledger.2 npmMIT