Skip to main content
PERSONA 2 - MCP SERVER OPERATORS

Monetize your MCP server in 10 minutes.

Let AI agents pay your MCP server per call, in USDC, with signed webhooks and audit logs. x402-compatible. Drop-in middleware.

THE PAIN

You built an MCP server. Thousands of clients are using it for free.

You shipped your MCP server because Claude Desktop, Cursor, and Cline clients needed the capability. Word spread. You are now serving thousands of paid-tool invocations per day from AI agents you have never met. Your egress bill is real. Your API key for the underlying service is real. Your maintenance time is real. The revenue is zero.

You have three options. Keep it free and burn money on infrastructure. Gate it behind manual API keys (and lose 95% of agent traffic to the friction of signup forms). Or add a payment layer that AI agents can actually complete - which is exactly what 402 Payment Required + USDC is built for.

Blockchain0x is option three. Your MCP server points at our API. When an AI client calls a paid tool, the response is 402 with a hosted payment URL. The client (or its human supervisor) pays in USDC. Your webhook fires. The next call from that client succeeds. The whole shape is called x402, and it is the protocol Coinbase published for this exact pattern.

X402 PATTERN

How 402 Payment Required becomes a programmatic checkout.

The HTTP status code 402 has existed since the spec was first written but never had a standard implementation. Coinbase's x402 protocol finally gives it one. The shape is simple: your server returns 402 with structured headers describing how to pay; the client pays and retries; the call succeeds.

YOUR MCP TOOL RETURNS THIS WHEN A CALLER HAS NOT PAID
HTTP/1.1 402 Payment Required
X-Payment-Required: true
X-Payment-Network: base
X-Payment-Asset: USDC
X-Payment-Amount: 0.02
X-Payment-Recipient: 0xYourMcpAgentAddress
X-Payment-Facilitator: blockchain0x
Link: <https://wallet.blockchain0x.com/a/docs-search/pay/pr_01J9...>; rel="payment"

The four states

  1. Unpaid call: AI client invokes a paid tool. Middleware checks for a recent payment cache hit, finds none, returns 402 with payment headers.
  2. Payment: Client follows the Link header to the hosted pay page, completes the USDC transfer on Base (either programmatically via x402-aware wallet or manually via QR code).
  3. Webhook: Blockchain0x fires payment.confirmed to your MCP server within seconds of chain confirmation. Middleware caches the (client_address, tool) pair as paid.
  4. Retry: Client retries the original MCP tool call. Middleware sees the cache hit, lets the call through to your handler, returns the actual result.

Every step is logged in your Blockchain0x audit log: 402 emissions, payments received, cache hits, and successful unlocks. Per-tool and per-client revenue analytics fall out of this naturally.

MIDDLEWARE SETUP

A working example in 8 lines.

The middleware is a Node module. Import it, wrap a tool, deploy. Below is a complete MCP server that exposes one paid tool. Everything else - 402 emission, webhook handling, payment caching, refund logic - is in the wrapper.

INDEX.TS - FULL MCP SERVER WITH ONE PAID TOOL
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
import { requirePayment } from "@blockchain0x/mcp";

const server = new McpServer({ name: "docs-search", version: "1.0.0" });

server.tool(
  "search_docs",
  "Semantic search across our docs",
  { query: { type: "string" } },
  requirePayment({ amountUsdc: "0.02", reason: "docs search" })(
    async ({ query }) => {
      const results = await runVectorSearch(query);
      return { content: results };
    },
  ),
);

Setup steps

  1. 1Create a Blockchain0x agent for your MCP server. Upgrade to Pro ($9/month) to unlock the API and webhooks. Note the agent_id and API key.
  2. 2Install the middleware: npm install @blockchain0x/mcp
  3. 3Set environment variables: BLOCKCHAIN0X_API_KEY, BLOCKCHAIN0X_AGENT_ID, BLOCKCHAIN0X_SIGNING_SECRET (for webhook signature verification).
  4. 4Wrap your paid tool handlers with requirePayment, specifying the amount in USDC and a reason string. Leave free tools un-wrapped.
  5. 5Configure the webhook endpoint in the Blockchain0x dashboard. Default path is /webhooks/blockchain0x; the middleware handles signature verification automatically.
  6. 6Deploy. The first AI client that hits your paid tool gets a 402, pays, and the next call succeeds. You see the payment in the dashboard within 10 seconds.

A working starter repository is at github.com/blockchain0x/agent-wallet-mcp-server. Two files, runs in 5 minutes, includes the webhook handler and the cache configuration.

CACHING WINDOW

The single most important setting on your middleware.

After a client pays for a tool, the middleware remembers them as paid for some window of time. Inside that window, calls go through without requiring a new payment. Set the window too short and you punish clients with payment friction on every call; set it too long and you give away expensive operations after one cheap payment.

The defaults we recommend

Tool typeWindowWhy
Cheap lookup ($0.01-$0.05)60 secondsAbsorbs natural retries and follow-up calls without giving away a session.
Mid-priced inference ($0.10-$1)30 secondsPay per call is the right shape; the brief cache handles retry on transient errors.
Expensive long-context ($1-$10)0 seconds (no cache)Each call is its own paid event; no caching.
Subscription-style tools24 hoursPay once per day for unlimited calls within the window. Higher revenue per client at lower friction.

The cache is per (client_wallet_address, tool_name) pair. Two different clients hit the same tool, each pays separately. Same client hits two different tools, two separate payments required (unless you scope the cache more broadly with a config option). Most operators stick with the per-tool default; the per-client per-tool granularity is what makes the pricing feel fair.

PRICING PATTERNS

Four pricing shapes that work for MCP servers.

Pricing is your call - you set the amount per tool in the middleware. Below are the four patterns we see most often and which tool shapes they fit.

Per-call micro-pricing

$0.01 - $0.05 per call

Search, lookup, classification, format conversion - cheap operations with high volume.

PROS

Lowest friction for clients; aligns cost with usage exactly.

CONS

Highest transaction overhead; only works at high call volume.

Per-call mid-pricing

$0.10 - $1.00 per call

LLM inference, generation, content production, anything where each call does real work.

PROS

Balanced - clear value per call, manageable transaction count.

CONS

Higher friction per call; clients sometimes prefer subscriptions at this price point.

Per-call high-pricing

$1 - $10 per call

Long-context generation, document processing, multi-step orchestration, expensive third-party API wrapping.

PROS

Margin per call is meaningful; failed payments are tolerable losses.

CONS

Clients negotiate hard at this price; expect refund requests.

Subscription unlock

$5 - $50 per 24h window (or $X per month)

Clients who make many calls in a session and would not tolerate per-call payment friction.

PROS

Higher revenue per client; less per-call overhead.

CONS

Lower discoverability; clients must commit upfront. Often combined with per-call for hybrid pricing.

Many operators mix patterns: cheap tools at per-call micro-pricing, expensive tools at per-call high-pricing, plus a 24-hour subscription unlock for heavy users. The middleware supports all three pricing shapes simultaneously on the same MCP server; each tool sets its own amount and cache window.

WHAT PLAN FITS

Pro is the right plan for almost every MCP server.

MCP server operators almost always start on Pro because the API and webhooks are required from day one (the middleware does not work on Free's read-only API). The math justifies it: at 80,000 paid calls/month at $0.02 each ($1,600 volume), Pro costs $9 + $32 = $41/month. Same volume on Free's hypothetical alternative would have cost $80 in transaction fees alone, with no API access making the integration impossible.

  • Free: useful for experimenting with the middleware and the dashboard. Not viable for production MCP servers (no API write access).
  • Pro ($9/agent/mo): the default for live MCP servers. Full middleware, webhooks, exports.
  • Business ($29/agent/mo): when you have >$2k/month in volume per agent, or when you need the audit log for compliance, or when you run MCP servers for multiple clients and want per-agent team-seat sharing.
See full pricing
FREQUENTLY ASKED

Five MCP-specific questions.

Does my MCP server need to be hosted on Blockchain0x? Or run on a specific cloud?

No. Your MCP server can run anywhere it normally would: your laptop, AWS, Fly.io, Cloudflare Workers, a Raspberry Pi. The middleware is just a Node module that wraps your tool handlers. As long as your server can make outbound HTTPS calls to api.blockchain0x.com and receive inbound webhooks at a URL you control, the integration works. We do not host your MCP server; we host the payment surface.

What happens when an AI client does not understand x402 and just gets a 402 response?

The 402 response is structured so that a non-x402-aware client sees a meaningful error: status code, JSON body with a hosted_url, and a human-readable message. Clients that surface errors to the user (most chat-based clients like Claude Desktop or Cursor) will show the user the URL to click and pay; clients that handle the request fully programmatically and expect 200 will fail more loudly, which is the correct outcome (the call was not paid). x402-aware clients pay automatically using a pre-authorized wallet; the call retries and succeeds.

How long does the caching window last? Can a client pay once and call forever?

The caching window is configurable per tool, default 60 seconds. You can set it longer (the middleware supports up to 24 hours) or disable it entirely (every call requires a fresh payment). For most MCP servers, the 60-second default is the right choice: it absorbs natural retry and follow-up patterns without letting a single payment cover an entire session. Long windows fit subscription-style pricing; per-call windows fit micro-pricing.

Can I run paid tools and free tools on the same MCP server?

Yes. Wrap only the paid tools with the requirePayment middleware; leave free tools un-wrapped. The free tools work for any client; the paid tools return 402 until paid. Many operators start by making the cheap tools free (to drive adoption) and reserving payment for the high-value ones (inference, generation, long-context work).

How do I see which clients have paid and how much they spent?

Every payment is logged in your Blockchain0x dashboard with the payer's wallet address, the tool name (passed in the payment request reason), the timestamp, and the amount. Export to CSV or JSON for usage analytics. The audit log on Business adds: every 402 emission, every successful unlock, every cache hit (a call served from a previous payment), so you can analyze per-client and per-tool revenue patterns down to the millisecond.

Turn your MCP server into revenue.

Pro at $9/agent/month. Working starter repo on GitHub. Ten minutes from install to first paid call.