Agent-native billing
Billing for MCP and agent tools
Agents and MCP tools run AI actions on behalf of users. They need to check balances, deduct credits, and trigger top-ups. Same wallets as your app — exposed through MCP tools instead of the SDK. One billing model across app and agent surfaces.
Why it matters
Agent-native tools need billing too
MCP tools and agent workflows create new surfaces where AI runs. Users might interact through a chat UI, a CLI, or an agent. Each path can trigger billable actions. If billing only lives in your main app's SDK, you're either duplicating logic or leaving agent usage unbilled.
Why the old approach breaks
Disconnected tooling, duplicate logic
Building custom billing for each agent or MCP integration means maintaining separate code paths. SDK for the app, something else for agents. Wallets, metering, and pricing rules can drift. Or you skip agent billing entirely and lose revenue. MCP tools need to fit into the same billing model — wallet checks, deductions, top-ups — without forcing developers to rebuild everything.
Example
Agent tool call flow
User asks an agent to summarize a document. The agent calls an LLM. Before returning the result, it calls meter_event with agent.summarize — 6 credits. Wallet deducts. If balance was low, the agent could have called get_wallet first and suggested a top-up. Same billing model as your app.
// Agent completes summarization
meter_event("agent.summarize", userId) // 6 credits
// Same event type, same wallet, as SDK integration
The tools
MCP tools for wallet, metering, and top-ups
The Chargly MCP server exposes billing as tools. Agents call these within their workflows. Same wallets, same pricing rules as your SDK.
get_walletCheck balance before an action
meter_eventDeduct credits after an AI call
create_checkoutTrigger top-up when balance is low
list_credit_packsShow available packs
Try it
See how a billed tool run works
Select a tool action, set the wallet balance, and see how Chargly handles the wallet check, event metering, and optional top-up flow inside an MCP-style workflow.
This is a simplified preview. Chargly handles the real wallet and billing logic in production.
See how Chargly applies this in productionAgent summarize
agent.summarize
6 credits
Allowed
14 credits
Wallet verified → meter event
The tool can run and bill immediately.
get_wallet()
meter_event("agent.summarize", { credits: 6 })Where it fits in the product
SDK, MCP, Pricing Advisor
MCP billing is one access surface into the same system. Your app uses the SDK; agents use MCP tools. Both hit the same wallets and event definitions. Pricing Advisor can inspect and apply recommendations via MCP — so agents can participate in pricing workflows without you losing control. One billing layer, multiple access paths.