Here's the problem nobody's talking about: AI agents can browse your website, read your docs, and call your API — but they can't pay for anything.
Not yet. Well — not until now.
The whole economic model for agent-accessible services assumes that at some point, an agent will need to exchange value to get something it wants. Premium data, API credits, gated content, per-query fees. The infrastructure for agents to spend money is mostly there — wallets, signing keys, on-chain transactions. But the infrastructure for websites to accept money from agents? That part didn't exist.
What We Built
webmcp-payments is a payment acceptance layer for websites that serve agents. It's live on npm right now. If you're already using webmcp-sdk — or even if you're not — you can drop in a PaymentGate middleware and start gating tool calls behind x402 payments in about 15 minutes.
Here's the basic setup:
import { PaymentGate } from 'webmcp-payments';
const gate = new PaymentGate({
merchantWallet: '0x...',
chain: 'base',
acceptedTokens: ['USDC'],
});
// Wrap any tool with payment enforcement
server.tool('premium-report',
gate.require({ amount: '0.50', token: 'USDC' }),
async (input) => {
return await generateFullReport(input.symbol);
}
);
The agent hits your tool, gets a 402 response with payment requirements, pays via its wallet, and retries with proof. The whole flow happens in a second or two — no UX friction because there's no user involved. That's the point.
Why x402
The HTTP 402 status code has been "Payment Required" since RFC 2616 in 1999. For 27 years it was basically a joke — reserved for future use, never standardized. Then Coinbase published the x402 spec and gave it teeth.
x402 works like this:
- Client (the agent) makes a request
- Server returns
402with payment details — amount, network, address - Client pays on-chain, includes a signed proof on retry
- Server verifies the proof, serves the content
No subscription management. No API keys. No billing dashboards to build. The payment is the access control.
For agents, this is exactly right. An agent doesn't have a credit card or a billing email. It has a wallet and signing keys. x402 is the first payment protocol that actually fits how agents work.
Where @mcp-b/global Fits In
We built webmcp-payments on top of the @mcp-b/global ecosystem — not replacing or competing with what the mcp-b team has built. They solved the hard problem of standardizing how agents interact with web content. We're extending that foundation to handle value exchange.
Think of it this way: @mcp-b/global is the agent's hands on your website. webmcp-payments is the wallet in its pocket.
Chrome 146 + WebMCP
Google and Microsoft shipped the WebMCP spec as a W3C standard in Chrome 146 (February 2026). Any browser agent running in Chrome now has a native protocol for interacting with web tools.
webmcp-sdk implements WebMCP for server-side Node.js environments, giving you the same interface whether you're serving browser-based agents or headless agent runtimes. The navigator.modelContext API in Chrome, the registerTool() calls in your Express server — same protocol, same tool definitions.
And now, same payment layer.
Full Integration Example
Here's a more complete setup — an Express app with tools, one paywalled:
import express from 'express';
import { PaymentGate } from 'webmcp-payments';
const app = express();
const gate = new PaymentGate({
merchantWallet: '0x...',
chain: 'base',
acceptedTokens: ['USDC'],
});
// Free tool — no gate
app.get('/api/summary', async (req, res) => {
const result = await fetchAndSummarize(req.query.url);
res.json(result);
});
// Paid tool — $0.05 per call via x402
app.get('/api/full-analysis',
gate.require({ amount: '0.05', token: 'USDC' }),
async (req, res) => {
const result = await runFullAnalysis(req.query.url);
res.json(result);
}
);
app.listen(3000);
The middleware handles the 402 response, the header parsing on retry, and the on-chain proof verification. You don't write any of that — you just define your price and wallet address.
What This Means for Your Site
If you run a site with useful data — financial feeds, research tools, API proxies, content generation endpoints — you've probably already thought about how to monetize agent traffic. Right now your options are:
- Hope agents scrape politely (they don't, always)
- Build API keys + billing infrastructure (months of work)
- Block agent traffic entirely (bad long-term bet)
webmcp-payments is option four: expose your tools via WebMCP, gate the valuable ones behind x402, and let agents pay per call without any billing infrastructure on your end. Payments settle on Base in seconds. No subscription management. No chargebacks.
We're the first package to do this. Nobody else has shipped agent payment acceptance for websites as a drop-in library.
Getting Started
npm install webmcp-payments webmcp-sdk
94 tests passing. TypeScript strict. Base chain + USDC.
Follow @AgentEconoemy for updates. If you build something with it, tag us.
We're a small team building the payment rails for the agent web. This is version one.
Top comments (0)