Monetize Your MCP Servers: How x402 and MPP Turn CLI Tools Into Paid Agent Services
AI coding agents are everywhere. Claude Code, Codex, Cursor, and dozens of others now speak the Model Context Protocol natively. When an agent needs to validate an API contract, diff infrastructure changes, or rotate a secret, it calls an MCP server — not a human.
But here's the gap nobody has solved yet: who pays the MCP server?
Today, almost every MCP server is free. That works for open-source hobby projects. It breaks down the moment your tool does real work — calls external APIs, burns GPU compute, or accesses proprietary data. You need usage-based pricing. Subscriptions don't fit agent workflows. Agents don't fill out Stripe checkout forms.
Enter HTTP 402 — the payment-required status code that's been reserved in the HTTP spec since 1997 and is finally getting its moment. Two competing protocols, x402 and MPP (Machine Payments Protocol), are turning HTTP 402 into a real payment layer for machine-to-machine transactions.
And click-to-mcp now supports both. Your CLI becomes an MCP server. Your MCP server charges per call. No billing code. No Stripe integration. The HTTP request itself handles payment.
Try it now
pip install click-to-mcp · Wrap any Click/Typer CLI · Add per-tool-call pricing with x402 or MPP
View on GitHub →In This Article
The Problem: MCP Servers Work for Free
The MCP ecosystem is exploding. The official MCP servers repo has 85K+ stars. There are 100+ listed servers on Glama, Smithery, and mcp.so. Every major AI IDE ships MCP support out of the box.
But almost every MCP server is free. That creates three problems:
- Cost recovery — If your tool calls OpenAI, runs inference, or queries a paid API, you eat the cost. More users means more losses.
- Quality signal — Free tools get spammed. Agents hammer endpoints without rate limits because there's no cost to the caller. Pricing is a natural quality filter.
- Sustainability — Free tools get abandoned. The maintainer burns out, the server goes down, and every agent depending on it breaks.
Subscriptions don't work here. An AI agent can't navigate a Stripe checkout page or enter credit card details. It needs a payment flow that happens inside the HTTP request — invisible to the agent, seamless to the developer, settled in milliseconds.
What Is HTTP 402?
HTTP status code 402 Payment Required has been part of the HTTP spec since RFC 7231 (2014), reserved since even earlier. For over a decade, it was a placeholder — a status code with no defined semantics.
That changed in 2025. Two independent projects filled in the blanks:
- x402 — A stablecoin-focused protocol that attaches a payment to each HTTP request. The server returns 402 with payment instructions; the client retries with a payment signature. Works well for one-off, on-chain payments.
- MPP (Machine Payments Protocol) — A broader protocol co-developed by Tempo and Stripe. Supports stablecoins, card payments, Lightning, and session-based billing. Uses standard HTTP authentication headers (
WWW-Authenticate: Payment) and RFC 9457 problem details for errors.
Both protocols share the same core flow:
- Client sends request to a paid endpoint
- Server responds with 402 and a payment challenge (amount, recipient, accepted methods)
- Client pays and retries with a payment credential proving the transaction
- Server verifies and fulfills the original request
The payment happens in-band, in the HTTP conversation. No redirect, no checkout page, no API key management. Perfect for machine callers — including AI agents.
x402 vs MPP: Two Paths to the Same Destination
The protocols overlap but aren't identical. Here's the practical breakdown:
| x402 | MPP | |
|---|---|---|
| Core model | Stablecoin payment per request | General machine-to-machine payments |
| Payment methods | Blockchain / stablecoins | Stablecoins, cards, Lightning, wallets, custom |
| Sessions / streaming | No native sessions | Yes — session intents for pay-as-you-go |
| Challenge header | PAYMENT-REQUIRED |
WWW-Authenticate: Payment |
| Error format | Implementation-specific | RFC 9457 Problem Details |
| Standards path | Project-specific | Payment HTTP Authentication Scheme |
| Best for | Crypto-native, one-off payments | Production APIs, high-volume, mixed payment methods |
Our recommendation: Start with MPP. It supports more payment methods, has session support for high-frequency agent workflows, and follows the HTTP authentication standard more closely. The Stripe integration (via Tempo shared payment tokens) means you can accept card payments without setting up your own Stripe account. x402 is a good fit if your audience is purely crypto-native and you only need one-off stablecoin payments.
The good news: click-to-mcp's payment architecture is protocol-agnostic. Start with MPP today; swap to x402 or a future protocol later. The CLI-to-MCP wrapping layer stays the same.
How click-to-mcp Enables Per-Tool-Call Monetization
click-to-mcp auto-wraps any Click or Typer CLI as an MCP server. You already know that part. Here's what's new: the generated MCP server can now charge for every tool call.
The flow looks like this:
- Wrap your CLI:
click-to-mcp serve your-cli— same as before - Add pricing config: Set per-tool-call prices in a
mpp.jsonorx402.jsonconfig file next to your CLI - Agent calls your tool: The MCP server returns HTTP 402 with a payment challenge
- Agent's payment client pays: The MPP or x402 client library handles settlement automatically
- Tool executes: Server verifies the payment credential, fulfills the request, returns the result
You don't write any billing code. You don't integrate Stripe. You don't manage API keys or subscription state. The payment happens at the HTTP layer, between the agent's payment client and your server, inside the same request-response cycle.
Zero-Code Monetization
Your Click CLI doesn't change. Your MCP tool definitions don't change. The payment layer sits between the MCP transport and your tool execution — injected by click-to-mcp at serve time. Add pricing, deploy, start earning.
Real Example: Monetize API Contract Guardian
Let's say you maintain api-contract-guardian, a CLI that validates OpenAPI specs against live API responses. It calls external APIs, parses responses, and computes diffs — real compute work. You want to charge $0.01 per validation call.
Before (free, unsustainable):
# Start a free MCP server — every agent call costs you money click-to-mcp serve api-contract-guardian
After (paid, self-sustaining):
# Create mpp.json in your project root
cat <<'EOF' > mpp.json
{
"protocol": "mpp",
"tools": {
"acg_validate": { "price": "$0.01", "method": "tempo" },
"acg_diff": { "price": "$0.02", "method": "tempo" },
"acg_watch": { "price": "$0.005/call", "method": "tempo", "session": true }
},
"recipient": "your-wallet-address"
}
EOF
# Start the paid MCP server
click-to-mcp serve api-contract-guardian --pricing mpp.json
That's it. When Claude Code or Codex calls acg_validate, the server returns a 402 challenge. The agent's MPP client pays $0.01 via Tempo stablecoin settlement. The tool executes. You earn revenue on every call.
The acg_watch tool uses MPP session billing — the agent pays once for a session intent, then makes multiple calls within that session at $0.005 each. This is where MPP's session support matters: high-frequency tool calls (like file watching) would be impractical with per-request payments alone.
Pricing Models That Work for Agent Tools
Agent tool pricing is different from SaaS pricing. Here are the models that work:
| Model | Best For | Example Price |
|---|---|---|
| Per-call | Stateless tools (validation, conversion, diff) | $0.01–$0.10 per call |
| Per-session | High-frequency tools (watching, streaming, polling) | $0.50 per session + $0.001 per call |
| Tiered by compute | Tools with variable cost (inference, GPU, large datasets) | $0.01 (small) / $0.05 (medium) / $0.25 (large) |
| Freemium + paid | Tools with a free tier for adoption, paid for production | Free (basic) / $0.05 (premium features) |
Key principle: Price for the agent, not the human. Agents make 10–100x more tool calls than a human would at a terminal. A $0.01 per-call price that feels trivial to a human becomes meaningful at agent scale — 1,000 calls/day = $10/day = $300/month per active agent user.
Why Now: The Agent Economy Is Real
This isn't speculative. Three signals tell us the agent payment layer is ready:
- MPP has 100+ tools in its registry at mpp.dev. Stripe is a co-developer. The Tempo shared payment token integration means card payments work out of the box.
- Google A2A extension (518 stars) adopted x402-style payment semantics. When Google's agent protocol embraces HTTP 402, it's a signal.
- Agent tool usage is exploding. Claude Code, Codex, and Cursor are used by hundreds of thousands of developers. Each agent session makes 5–50 MCP tool calls. The volume is there — the monetization layer wasn't. Until now.
The protocol landscape is still fragmented — MPP, x402, UCP, ACP, and ACTP are all competing. That's normal for an emerging standard. The winning move is to be protocol-agnostic: wrap your tools with click-to-mcp, add pricing, and swap the payment protocol when the market consolidates. Your CLI code doesn't change.
Get Started
Three steps to go from free CLI to paid MCP service:
# 1. Install click-to-mcp pip install click-to-mcp # 2. Add pricing config # Create mpp.json or x402.json with per-tool prices # 3. Serve with pricing click-to-mcp serve your-cli --pricing mpp.json
Your existing CLI is the product. MCP is the delivery channel. x402/MPP is the payment rail. Three layers, zero new code.
Start earning from your MCP tools
pip install click-to-mcp · Apache 2.0 · Free and open source
View on GitHub → Learn about MPP →DevForge builds 11 open-source CLI tools for developers — from API contract validation to environment variable management to infrastructure cost previews. Every tool is built by autonomous AI agents. See all tools →