PayGate MCP — Monetization Gateway for AI Agents

io.github.geoacpfilhoPublished by GitHub account geoacpfilhov0.3.1Updated Oct 24, 2026

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

VerifiedStreamable HTTPWeb executableFinanceDeveloper ToolsBusiness & Commerce

Overview

AI-generated overview

A remote MCP gateway that lets an assistant discover paid tools, register and price its own MCP servers, and check earnings from USDC pay-per-call sales on Base

What you can do
Discover paid tools and APIs on the marketplace, with price per call and endpoint to call them, free of charge. Register an MCP server for sale, which imports its tools and returns a proxy URL and a secret api_key. Change or remove tool prices, and review the current listing with payout destination and commission rate. Report paid calls, gross revenue, commission and net revenue per tool. Verify ownership of a listed server by publishing a token at a well-known path on its domain.
When to use it
Use it when an assistant needs a capability it lacks and the user is willing to pay per call in USDC, or when the user wants to sell, reprice or track revenue from their own MCP server without writing payment code.
Requirements
Remote streamable HTTP endpoint; nothing to install locally. Buyers need a wallet holding USDC on Base (no ETH needed for gas) and must sign an EIP-3009 transfer authorization. Sellers need the api_key returned by register_server for pricing, listing and earnings tools, and a domain to host the verification token.
Before you install
Calls to monetized tools cost real USDC on Base mainnet and are settled on-chain; payment is verified before the tool runs. The api_key from registration is a secret that controls pricing and listing data. Registering exposes a proxy URL and payout wallet address, and verification requires publishing a token on the user's domain. The README's reference client asks for a PRIVATE_KEY environment variable, which grants spending authority over that wallet.

Installation

In SourceWeft

  1. Open PayGate MCP — Monetization Gateway for AI Agents in the dashboard and add it to a workspace.
  2. Enable the server for the chats that should use its tools.

Web executable via Streamable HTTP. Remote servers run from the web runtime once configured in a workspace.

Use with an agent

Paste this prompt into Claude Code, Codex, Cursor or another agent — or into SourceWeft chat. The agent reads this server's install guide, shows you its publisher, endpoint and sign-in, and adds it to your client once you agree. Keys never go into a command.

Read https://sourceweft.com/mcp/io.github.geoacpfilho%2Fpaygate-monetize-monetization-x402/install.md and connect the MCP server it describes to my client. Before changing any config, show me its publisher, endpoint and sign-in method and wait for my OK. Never put an API key in a command or in a file I would commit; ask me where it should come from.

Read the install guide the agent follows

Other MCP clients

Add this to your client's mcpServers config.

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

Source: README.md at commit 67333b0

Tools

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.

Parameterssearchmax_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.

Parametersnamerequiredemailwallet_addressdefault_price_usdstripe_account_idtarget_server_urlrequired

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.

Parametersapi_keyis_activeprice_usdtool_namerequired

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.

Parametersapi_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.

Parametersapi_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.

Parametersapi_key

Version history

1
  1. v0.3.1LatestSep 16, 2026

Score

100% 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 daysRequired25 pts
  • Auth declaredRequired10 pts
  • Tools listedRequired15 pts
  • DescriptionRequired15 pts
  • Logo10 pts
  • Documentation15 pts
  • License10 pts