Skip to content
Back to blog

How to Monetize Your MCP Server (x402 and Polar)

Two practical approaches to charging for MCP tool usage: x402 for per-call micropayments and Polar for subscription-based access — using xmcp integrations.

If your MCP server wraps a paid API, costs compute per call, or provides specialized capability, you probably want to charge for it. Two available xmcp monetization approaches are: x402 for per-call micropayments and Polar for subscription-based access with license keys.

Two monetization models

x402Polar
Billing modelPer tool call (micropayments)Subscription or one-time purchase
Payment methodCrypto (via Coinbase x402)Card, Stripe
User accounts requiredNoYes (Polar account)
Best forPay-as-you-go usage, agentsSaaS-style access, recurring revenue
Integration@xmcp-dev/x402 plugin@xmcp-dev/polar plugin

x402: per-call micropayments

x402 is a protocol built by Coinbase on the long-reserved HTTP 402 status code. A client sends a signed crypto payment with each request; the server verifies it before executing the tool. No accounts, no subscriptions — just pay and use.

This model fits tools with unbounded usage patterns: an agent that calls a search tool hundreds of times in a session, a data enrichment tool where usage varies wildly per user, or any capability where a flat monthly fee doesn't match consumption.

Install the plugin:

Shell

Register the HTTP provider in middleware:

src/middleware.ts

Mark the tools that require payment:

src/tools/paid-greet.ts

This provider does not automatically charge every tool. Test with a compatible payment client and a test-network wallet. Follow the x402 guide and runnable example for the complete flow.

Polar: subscription access

Polar is a developer-first monetization platform that handles subscriptions and license keys. The xmcp provider exposes license validation methods that your application must call before allowing protected operations.

This model fits when you want predictable revenue — a monthly plan for teams, a one-time purchase for individuals, or tiered access based on subscription level.

Install the plugin:

Shell

Create a provider for the product you configured in Polar:

src/lib/polar.ts

Creating the provider does not enforce access by itself. Validate the request's license key and stop execution when validation fails. The Polar guide and runnable example show the validation and usage flow. Test concurrent callers and invalid keys before enabling live access.

Which model to choose

Use x402 when:

  • Usage varies heavily per user or per session
  • You want zero-friction access (no accounts, no sign-up)
  • Your target users are autonomous agents that can handle crypto payments

Use Polar when:

  • You want predictable, subscription-based revenue
  • Your users are developers or teams buying access for a period
  • You want usage analytics and customer management in a dashboard

Choose and test one access model first. Combining payment systems requires explicit routing and authorization design; installing two packages does not create that policy.

Next steps

One framework to rule them all