PayGate MCP — Monetization Gateway for AI Agents

io.github.geoacpfilho由 GitHub 账号 geoacpfilho 发布v0.3.1更新于 Oct 24, 2026

Monetize any MCP server: x402 paywall, pay-per-call billing in USDC on Base, agent marketplace.

已验证Streamable HTTP可网页运行金融开发者工具商业与电商

概览

AI 生成的概览

远程 MCP 网关,让助手发现付费工具、注册并定价自己的 MCP 服务器,并查看 Base 上 USDC 按次付费的收益

可以做什么
免费浏览市场上的付费工具与 API,含每次调用价格和调用端点。注册要出售的 MCP 服务器,自动导入其工具并返回代理 URL 和私密 api_key。调整或下架工具价格,查看当前上架信息、收款地址和佣金比例。按工具报告付费调用次数、总收入、佣金和净收入。在域名指定路径发布令牌以验证服务器所有权。
适用场景
当助手缺少某项能力且用户愿意按次以 USDC 付费时使用;或当用户想出售、调价、查看自己 MCP 服务器的收入而不想编写支付代码时使用。
运行要求
远程 streamable HTTP 端点,无需本地安装。买家需要持有 Base 上 USDC 的钱包(无需 ETH 付 gas),并签署 EIP-3009 转账授权。卖家在定价、上架和收益工具中需要 register_server 返回的 api_key,并需一个域名托管验证令牌。
安装前请注意
调用付费工具会在 Base 主网上花费真实 USDC 并链上结算,工具执行前先验证付款。注册返回的 api_key 是控制定价和上架信息的机密。注册会暴露代理 URL 和收款钱包地址,验证需在用户域名上发布令牌。README 的参考客户端要求 PRIVATE_KEY 环境变量,等于授予该钱包的花费权限。

安装

在 SourceWeft 中

  1. 打开 控制台中的 PayGate MCP — Monetization Gateway for AI Agents,将其添加到工作区。
  2. 为需要使用其工具的对话启用该服务。

Web executable,通过 Streamable HTTP。 远程服务在工作区中配置后即可从网页运行时运行。

交给智能体安装

把这段提示词粘贴到 Claude Code、Codex、Cursor 等智能体,或 SourceWeft 对话中。智能体会读取该服务器的安装指南,先向你展示发布者、端点和登录方式,经你同意后再把它添加到你的客户端。密钥不会写进任何命令。

阅读 https://sourceweft.com/mcp/io.github.geoacpfilho%2Fpaygate-monetize-monetization-x402/install.md,并按其中说明把这个 MCP 服务器接入我的客户端。修改任何配置之前,先告诉我它的发布者、端点和登录方式,等我确认。不要把 API 密钥写进命令或我会提交的文件;问我密钥应从哪里获取。

查看智能体所依据的安装指南

其他 MCP 客户端

把它添加到你客户端的 mcpServers 配置中。

{
  "mcpServers": {
    "paygate-monetization-gateway-for-ai-agen": {
      "type": "http",
      "url": "https://paygate-mcp.rendercriativo.workers.dev/mcp"
    }
  }
}

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 Baseagent ◀── 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:

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

jsonc
{  "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:

bash
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 sellers

The whole seller lifecycle is exposed as MCP tools, so an agent can run it end to end — tell your assistant to monetize your server and it can do everything below on its own:

ToolWhat it does
register_serverLists your server. Its tools are imported automatically; you get a proxy URL and a secret api_key.
verify_ownershipServe the token from registration at /.well-known/paygate-verify on your domain and call this to earn a verified badge. Buyers can filter for verified sellers.
set_tool_priceReprice a tool or take it off the market.
get_earnings / get_my_listingRevenue report and current listing.

Buyers pay your wallet directly on-chain. PayGate never holds your funds — there is no payout to wait for, no balance to withdraw, and no commission on direct payments. Your server is never modified: PayGate forwards initialize, tools/list, resources/list and prompts/list for free and charges only on tools/call.

The same operations exist as REST (POST /api/register, PUT /api/me/tools, GET /api/me/earnings) if you prefer curl:

bash
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"}'

Health and diagnostics

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

json
{  "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.

VariablePurpose
X402_NETWORKCAIP-2 network. eip155:8453 (Base mainnet, default) or eip155:84532 (Sepolia).
X402_FACILITATOR_URLFacilitator base URL, no /verify suffix. Defaults per network.
PAYGATE_WALLET_ADDRESSWallet that receives payments.
CONTACT_EMAILOptional; omitted from the UCP manifest when empty.
CDP_API_KEY_ID / CDP_API_KEY_SECRETCoinbase CDP credentials. Required for mainnet — it is the only facilitator that settles on Base.
UPSTREAM_AUTH_TOKENToken forwarded to the developer's MCP server.
STRIPE_SECRET_KEYOptional, 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│   ├── paygate-tools.ts     marketplace tools: register, verify, price, earnings│   ├── llms-txt.ts          /llms.txt for AI systems arriving over the web│   ├── 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

bash
npm installnpx wrangler dev      # localnpx wrangler deploy   # production

Built on Cloudflare Workers, Hono, and D1.

License

MIT

来源:README.md,提交 67333b0

工具

6

list_registered_servers

Find a paid tool that does something you cannot do yourself. Use when the user needs a capability you lack and is willing to pay per use, or asks what paid tools, APIs or data sources are available. Returns every tool on the market with its price per call in USD and the endpoint to call it. Browsing is free and needs no key.

输入参数searchmax_price_usdverified_only

register_server

Start charging for an MCP server the user owns. Use when they want to monetize, sell, charge for, get paid for, put a price on, or make money from a server, API or tool. Buyers pay their wallet DIRECTLY on-chain — PayGate never holds the money, so there is no payout to wait for, no balance to withdraw and no commission taken. Their server is never modified and needs no payment code. Tools are imported automatically, so it must be publicly reachable over HTTPS and answer tools/list. Returns a proxy URL and a secret api_key shown only once; save it, every other seller tool needs it.

输入参数name必填emailwallet_addressdefault_price_usdstripe_account_idtarget_server_url必填

set_tool_price

Reprice or unlist something the user already sells. Use when they want to raise, lower or change a price, make a tool free, pause selling it, or take it off the market. Requires the api_key from register_server.

输入参数api_keyis_activeprice_usdtool_name必填

get_earnings

Report how much the user has earned selling their tools. Use when they ask about sales, revenue, income, how much they made, how many calls were paid, or which tool sells best. Returns paid calls, gross revenue, commission and net revenue, broken down per tool. Requires the api_key from register_server.

输入参数api_key

get_my_listing

Review what the user currently has for sale. Use when they ask what they are selling, what their prices are, where their money goes, or want to check their listing before changing it. Returns the proxy URL, payout destination, commission rate and every listed tool with its price. Requires the api_key from register_server.

输入参数api_key

verify_ownership

Prove the user owns the server they listed, earning a trusted badge in the marketplace. Use after they have published their verification token at /.well-known/paygate-verify on the server's domain. PayGate fetches that URL and confirms the token matches. Verified sellers can be filtered for by buyers, so this directly increases how often their tools get chosen. Requires the api_key from register_server.

输入参数api_key

版本历史

1
  1. v0.3.1最新Sep 16, 2026

评分

已满足适用检查项的 100%

该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。

  • 近 30 天内可连通必需25 分
  • 已声明认证方式必需10 分
  • 已列出工具必需15 分
  • 描述必需15 分
  • 图标10 分
  • 文档15 分
  • 许可证10 分