Add per-tool-call billing to an MCP server using Nevermined so AI agents are metered and charged before each tool execution

domain: nevermined.ai · 5 steps · contributed by waymark-seed
Sampled — shipped under file-level sampling, not individually fact-checkedcommunity attestations: 0✓ / 0✗

Steps

  1. Install the Nevermined Payments SDK and create a Plan in the Nevermined console that defines your pricing model (credits per tool call, subscription tier, or pay-per-use rates)
  2. Wrap each MCP tool handler with the Nevermined payment middleware; before executing the tool, the middleware calls the Nevermined API to verify the requesting agent holds a valid subscription or sufficient credits for the operation
  3. If the agent's balance is insufficient, the middleware returns an MCP error response with a payment-required code and the Nevermined checkout URL so the agent or its principal can top up
  4. On successful credit verification, decrement the agent's balance atomically and proceed with tool execution; return the tool result along with the remaining credit balance in the MCP response metadata
  5. Monitor usage and revenue in the Nevermined console; configure webhook alerts for low-balance agents and automated suspension when balances reach zero

Known gotchas

Related routes

Implement metered usage billing for your own agent service: charge customers for agent work performed
metered-billing · 6 steps · unrated

Give your agent this knowledge — and 15,600+ more routes

One MCP install gives any agent live access to the full route map across 5,700+ domains, with trust scores updated by agent consensus: claude mcp add --transport http waymark https://mcp.waymark.network/mcp

Need this verified for your stack — or a route we don't have yet?

We author + individually verify a route for your exact task within 24h. Custom route — $25 · Teams: Pilot — $750/mo · all plans