PayGate MCP

PayGate MCP

Monetization gateway for MCP servers, enabling pay-per-call AI agent access with x402 payment challenges and USDC settlement on Base. Developers can register existing MCP servers, set tool prices, and receive payments without handling payment code.

Category
访问服务器

README

PayGate MCP

Monetization gateway for Model Context Protocol servers. Put any MCP server behind a pay-per-call toll that AI agents can settle autonomously — no signup, no API keys, no human in the loop.

Live endpoint: https://paygate-mcp.rendercriativo.workers.dev/mcp

x402 network license

What it does

An agent calls a tool. If the tool is monetized, PayGate answers with an x402 v2 payment challenge instead of the result. The agent signs a USDC transfer authorization, retries, and gets its answer. Settlement happens on Base; the developer never touches payment code.

agent ──tools/call──▶ PayGate ──▶ 402 challenge (price, asset, payTo)
agent ──signed payload──▶ PayGate ──verify──▶ facilitator
                          PayGate ──▶ developer's MCP server ──▶ result
                          PayGate ──settle──▶ facilitator ──▶ USDC on Base
agent ◀── result + settlement receipt

Payment is verified before the tool runs and settled after it returns. If the tool fails or returns an error, nothing is charged.

For agents

Discovery is free. Ask PayGate what is for sale:

curl -X POST https://paygate-mcp.rendercriativo.workers.dev/mcp \
  -H 'Content-Type: application/json' \
  -d '{"jsonrpc":"2.0","id":1,"method":"tools/call",
       "params":{"name":"list_registered_servers","arguments":{}}}'

Calling a monetized tool without payment returns a spec-compliant challenge — a tool result with isError: true whose structuredContent holds the PaymentRequired object:

{
  "x402Version": 2,
  "error": "Payment required: calculate_fator_r custa $0.02 USDC.",
  "resource": { "url": "mcp://tool/calculate_fator_r", "mimeType": "application/json" },
  "accepts": [{
    "scheme": "exact",
    "network": "eip155:8453",
    "amount": "20000",                                     // 6-decimal USDC units
    "asset": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
    "payTo": "0x82e3...999e",
    "maxTimeoutSeconds": 120,
    "extra": { "name": "USD Coin", "version": "2" }        // EIP-712 domain
  }]
}

Sign an EIP-3009 TransferWithAuthorization using exactly the domain in extra, then retry the call with the payment attached under params._meta["x402/payment"]. The settlement receipt comes back in _meta["x402/payment-response"].

The USDC EIP-712 domain name is "USD Coin" on Base mainnet and "USDC" on Base Sepolia. Using the wrong one makes every signature fail verification.

A working reference client is in scripts/pay-test.mjs:

PRIVATE_KEY=0x... node scripts/pay-test.mjs

The paying wallet needs USDC on Base — but no ETH: gas is covered by the facilitator.

Both x402 transports are supported. HTTP clients can use the base64 PAYMENT-REQUIRED / PAYMENT-SIGNATURE / PAYMENT-RESPONSE headers instead of the MCP _meta binding.

For developers who want to get paid

Register your existing MCP server and PayGate proxies it, charging per call:

curl -X POST https://paygate-mcp.rendercriativo.workers.dev/api/register \
  -H 'Content-Type: application/json' \
  -d '{"name":"Your Service",
       "target_server_url":"https://your-mcp-server.example.com/mcp",
       "wallet_address":"0xYourWallet"}'

You get back an API key and a proxy URL at /mcp/<devId>. Set per-tool prices via PUT /api/me/tools, check earnings at GET /api/me/earnings. Your server stays unchanged — PayGate forwards initialize, tools/list, resources/list and prompts/list for free, and charges only on tools/call.

Health and diagnostics

GET /health/x402 reports whether the payment rail is actually able to charge:

{
  "network": "eip155:8453",
  "facilitator": { "url": "...", "reachable": true, "authenticated": true },
  "ready_to_charge": true,
  "diagnosis": "Pronto para cobrar."
}

Configuration

Runtime values live in wrangler.jsonc (vars) and Cloudflare secrets.

Variable Purpose
X402_NETWORK CAIP-2 network. eip155:8453 (Base mainnet, default) or eip155:84532 (Sepolia).
X402_FACILITATOR_URL Facilitator base URL, no /verify suffix. Defaults per network.
PAYGATE_WALLET_ADDRESS Wallet that receives payments.
CONTACT_EMAIL Optional; omitted from the UCP manifest when empty.
CDP_API_KEY_ID / CDP_API_KEY_SECRET Coinbase CDP credentials. Required for mainnet — it is the only facilitator that settles on Base.
UPSTREAM_AUTH_TOKEN Token forwarded to the developer's MCP server.
STRIPE_SECRET_KEY Optional, for the Stripe path on tools priced ≥ $0.50.

Base Sepolia needs no credentials: the public facilitator at https://x402.org/facilitator settles testnet USDC for free — the cheapest way to try the whole flow.

Layout

src/
├── index.ts                 routes, health, discovery documents
├── x402/
│   ├── config.ts            network registry (CAIP-2, USDC assets, EIP-712 domains)
│   ├── protocol.ts          v2 structures, MCP + HTTP transport bindings
│   └── facilitator.ts       /verify and /settle, CDP JWT auth (EdDSA and ES256)
├── api/
│   ├── proxy.ts             the paid path: challenge → verify → execute → settle
│   ├── mcp-server.ts        PayGate's own MCP server (catalogue)
│   ├── register.ts          developer onboarding
│   ├── dev-management.ts    profile, pricing, earnings
│   └── discovery.ts         server card and UCP manifest
└── db/schema.ts             developers, tools, transactions, payment proofs

Development

npm install
npx wrangler dev      # local
npx wrangler deploy   # production

Built on Cloudflare Workers, Hono, and D1.

License

MIT

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选