Monetization
Charge for your MCP tools using license keys or crypto micropayments. Understand human vs agent monetization models, and integrate with Polar or x402.
Overview
MCP servers can monetize tools through payment verification. xmcp supports two approaches: license key validation where tools check credentials before returning results, and crypto payments where the transport layer blocks execution until payment is verified.
Quickstart
xmcp provides monetization plugins that handle payment verification and access control for your tools.
When do you need monetization?
Not every MCP server needs monetization. The decision depends on how your tools are deployed and what value they provide.
Monetize your tools when they provide significant value that justifies payment. This includes tools that access proprietary data, perform expensive computations, call paid external APIs, or provide unique capabilities users are willing to pay for.
Monetization may not be necessary for simple utilities, internal tools, or when your business model relies on other revenue streams like consulting or support contracts.
Human vs agent monetization
The two monetization approaches serve fundamentally different use cases based on who initiates payment.
Human-based monetization with Polar requires a person to purchase a license key and configure it in their MCP client. The human decides to pay upfront through a checkout flow, subscription, or credit purchase. The agent then uses that credential for subsequent requests. This model works well for SaaS-style billing where users manage their own subscriptions.
Agent-based monetization with x402 enables agents to pay autonomously. When an agent encounters a paid tool, it can sign a crypto payment from its wallet without human intervention. The agent receives payment requirements, authorizes the transaction, and continues. This enables true agent-to-agent commerce where AI agents can purchase services from other AI agents.
License key validation
With Polar, the client includes a license key in the request headers. The server validates this key against Polar's API, checking that the license is active and within usage limits.
The validation checks multiple conditions: license status, usage limits, expiration dates, and meter credits. If validation fails, the response includes a checkout URL where users can purchase or renew their license.
Usage metering
Polar supports usage-based billing through meter credits. When you pass an event to validateLicenseKey, the plugin tracks consumption against the user's credit balance:
If the user has exhausted their meter credits, validation fails with a message and a checkout URL to purchase more. For more details, check the Polar integration guide.
Crypto payment flow
With x402, the payment flow follows the HTTP 402 Payment Required standard:
- Client calls a paid tool without payment
- Server responds with payment requirements (price, wallet, network)
- Client signs a payment authorization from their wallet
- Client retries the request with the signed payment in headers
- Server verifies the payment signature with a facilitator
- Tool executes and client receives the response
- Payment settles on-chain
The paid() wrapper marks a tool as requiring payment. Tools without this wrapper remain free. You can set prices per-tool or use the middleware defaults.
Payment requirements
When a client calls a paid tool without valid payment, the server returns the payment requirements:
The client uses this information to construct a signed payment authorization. The amount is in atomic units (6 decimals for USDC), so 50000 equals $0.05.
Payment context
Inside a paid tool, you can access payment information:
Pricing considerations
For subscriptions, consider what comparable services charge and what value users derive over a billing period. Polar supports multiple tiers, usage limits, and meter-based consumption tracking.
For pay-per-use, consider the cost of executing the tool (API calls, compute, etc.) and add a margin. Prices between $0.001 and $0.10 per call are common for micropayments, depending on the tool's complexity and value.
References
- Polar Integration - Full setup guide for license keys
- x402 Integration - Full setup guide for crypto payments
- x402 Protocol - HTTP 402 payment standard
- Polar Documentation - License key management