Set up with your coding agent. Add the Kelviq docs MCP server (
https://docs.kelviq.com/mcp) to Claude Code, Cursor or Codex and ask it: “Add per-call billing to my MCP server with Kelviq. Use sandbox keys from .env.local and show me the plan before creating anything.”
A lot of MCP servers are free. That’s fine for a weekend project. It stops being fine when your server calls a paid API on every request, and someone’s agent hits it 40,000 times on a Tuesday because it got stuck in a loop.
If you’ve built one, you’ve probably wondered how to charge for it without writing a billing system first. The pricing part is the easy half. The hard half is that nothing in the MCP loop looks like a normal SaaS purchase.
Why MCP servers are hard to charge for
A normal SaaS sale has a human, a browser and a pricing page. An MCP call has none of those.
There’s no browser in the loop. The client is Claude Desktop, Cursor, a custom agent or a cron job. When your tool runs, nobody is looking at a page where you could show a paywall. You get a JSON request, and you send back a JSON result.
The caller is an agent. It doesn’t read your pricing page, and it can’t type in a card number (and you really don’t want it to). It can, however, read an error message and pass it along to the human. That turns out to be the main sales channel you have.
You need to know who is calling. Billing needs a customer ID on every call. Local servers (stdio) usually get a key from an environment variable in the client’s config. Remote servers can use OAuth, which the MCP spec defines as an optional authorization flow for HTTP transports. Either way, every request has to map back to one paying customer, and keys get shared, leaked and pasted into public repos.
So you’re designing for a buyer who shows up once (to pay) and a user who shows up thousands of times (to call tools), and they’re often different things: a person and their agent.
The pricing options
Here are the five models I see, with made-up numbers so the shape is clear.
| Model | Illustrative example (not a recommendation) | Fits when | Watch out for |
|---|---|---|---|
| Per call | $0.01 per tool call, billed monthly | Every tool costs you about the same | A $3 invoice still pays a fixed card fee |
| Per tool | search $0.002, generate_report $0.25 | Tools differ a lot in cost to you | Customers have to think about which tool the agent picks |
| Credits | $10 buys 1,000 credits; search = 1, generate_report = 25 | You want prepaid money and simple top-ups | Credits are a liability on your books until used |
| Subscription with included calls | $29/month includes 5,000 calls, then $0.005 each | You want predictable revenue | Pick the included amount carefully, it’s hard to lower later |
| Free tier | 100 calls/month, hard limit | You need people to try it from an agent | Free keys get farmed if signup is too easy |
My default for a new paid MCP server is a free tier plus a subscription with included calls and overage. Pure per-call pricing is the most honest model, but people are nervous about open-ended bills from an agent they don’t fully control. A monthly number with a ceiling calms that down.
Per-tool pricing is worth it when one tool is 100x more expensive to run than another. If your search tool hits a cache and your generate_report tool runs a 30-second model call, charging both the same means your heaviest users are subsidized by everyone else.
One note on small charges. Most processors charge a fixed fee per transaction. Ours is 3.5% + $0.40 per successful transaction, so on a $29 subscription that’s $1.42 (about 4.9%). On a $10 credit pack it’s $0.75 (7.5%). On a $3 per-call invoice it’s $0.51, which is 17%. That’s why I’d set a minimum top-up or bill usage monthly on top of a base fee, rather than charging tiny amounts often. (These examples ignore tax and the international and recurring surcharges.)
The setup
You need five pieces. None of them are specific to MCP, so you don’t need a special MCP billing tool either.
1. One API key per customer. Generate it when someone signs up, store a hash, and map it to a customer ID in your billing system. The key goes into the client config, the customer ID goes on every billing call. Make keys revocable, and let a customer have more than one so they can rotate without downtime.
2. Every tool call is a usage event. After a tool runs successfully, send one usage event: customer, feature, quantity. Name the metered feature after the tool. Every invoice line should link back to the raw event log, which matters the first time someone asks “why did I make 9,000 calls?”
3. Check entitlements before the tool runs. This is where plans live. A free plan gets search with a 100-call hard limit, Pro gets search and generate_report, and so on. You check access by customer and feature, and the plan decides the answer, so moving a tool between plans is a dashboard change instead of a deploy. Sensitive actions deserve a human approval step too, and that matters for MCP: a tool that sends email or spends money probably shouldn’t run just because an agent asked.
4. A hosted checkout link the agent hands to the human. When a check fails, don’t return a bare “403”. Create a checkout session for the right plan and return the URL in the tool result, with a sentence the agent can repeat. The hosted page takes the payment, so the agent never touches a card. The 2025-11-25 version of the MCP spec added URL mode elicitation, where a server asks the client to open a URL for the user, and the spec lists payment flows as one use.
5. A customer portal for usage history. Agents generate usage that humans didn’t watch happen. Give the human a place to see plans, payment methods, invoices and usage history. Create a signed portal link from your server and return it from a billing_status tool.
Here’s the core of it. This is pseudocode, not a drop-in: the method names come from the Kelviq Node SDK docs, and the MCP server wiring is simplified.
// PSEUDOCODE: check entitlement, run tool, record usage
server.tool("generate_report", async (args, ctx) => {
const customerId = await customerFromApiKey(ctx.apiKey); // your own lookup
if (!customerId) return toolError("Unknown API key.");
const featureId = "generate-report";
if (!(await kelviq.entitlements.hasAccess({ customerId, featureId }))) {
const { checkoutUrl } = await kelviq.checkout.createSession({
planIdentifier: "pro", chargePeriod: "MONTHLY", customerId,
});
return toolError(`Your plan doesn't include reports. Upgrade: ${checkoutUrl}`);
}
const report = await buildReport(args); // the actual work
await kelviq.reporting.reportUsage({
customerId, featureId, value: 1, behaviour: BEHAVIOUR_CHOICES.DELTA,
});
return report;
});The order matters. Check first, so a free user never costs you a model call. Record after, so a tool that throws halfway doesn’t bill anyone.
Two traps
Trap 1: retries double-bill. Agents retry. MCP clients retry. Your own code retries the usage call when the network blips. A DELTA usage report adds its value every time it’s sent, and the Kelviq docs warn about exactly this. If the same unit of work can be reported twice, attach your own request ID and skip duplicates before you call the meter, or keep a running total per customer and report it with SET instead. I’d rather undercount by one call than send a customer an invoice they can prove is wrong.
Trap 2: the agent loop. An agent that misreads a tool result can call it again and again until something stops it. With per-call pricing and only a soft limit, that something is the customer’s card statement. Put a hard limit on every metered feature in the free tier, and think about a daily cap on paid plans too. A customer who hits a cap and emails you is annoyed. A customer who gets a $600 surprise from a stuck loop asks for a refund and leaves.
FAQ
Can I charge for an MCP server without my own website? Mostly. You need somewhere for the human to get a key and pay, which can be a hosted checkout link plus an email with the key. A one-page site helps people trust you, though.
Should I charge per call or per tool? Per call if your tools cost you roughly the same to run. Per tool, or credits with different weights, if one tool costs 10x or more than another.
What should my MCP server return when someone is out of credits? A normal tool result with a clear sentence and a link: what happened, what plan fixes it, and the checkout URL. The agent will usually relay it word for word, so write it for the human.
How do I stop one customer from sharing a key with their whole company? Watch for one key being used from many places at once. A per-key limit on parallel calls in your own server helps here, and so does selling a team plan that’s cheaper than the abuse.
Who handles sales tax and VAT on MCP server subscriptions? If you sell through a merchant of record (Kelviq is one), it does. If you use a payment processor directly, that’s on you.
Where Kelviq fits
If you’d rather not build all five yourself, here’s how they map to Kelviq. Each tool is a metered feature, usage is billed with no metering or ingestion fees, and every invoice line links back to the raw event log. Kelviq’s entitlements cover on/off features, metered limits with hard or soft enforcement, and per-plan values, which is enough to gate a paid tool by plan. Hosted checkout handles tax and payment methods, the self-serve portal covers plans, payment methods and invoices, and Kelviq can issue a license key to each buyer automatically after checkout.
Final thoughts
Charge for the work, gate before you run it, record after it succeeds, and make sure every “no” comes with a link a human can click.
If you’re pricing an MCP server and stuck on the numbers, email me at alok@kelviq.com or message me on LinkedIn. Happy to help either way. The meter and entitlement setup is in the Kelviq docs.

