Claude Code is great for running autonomous agents. The problem: one bad prompt can kick off a loop that runs for 20 minutes and costs $40 before you notice. I built agentbill-mcp to fix this. It adds preflight budget checks to any Claude agent as an MCP tool. Add it to your settings.json: { “mcpServers”: { “agentbill”: { “command”: “uvx”, “args”: [“agentbill-mcp”], “env”: { “AGENTBILL_API_KEY”: “your_key” } } } } Then your agent calls preflight() before any expensive operation. If the customer is over budget, the run is blocked before a single token is consumed. Two tools available:
- preflight(agent_id, customer_id, estimated_units) - check before run
- record_event(customer_id, event_type, units) - log after completion Works for both personal spend limits and multi-tenant products (different budget per customer_id). Free tier: 1,000 preflight calls/month. API key at agentbill.fly.dev/register. Happy to answer questions about the architecture. submitted by /u/EveningMindless3357
Originally posted by u/EveningMindless3357 on r/ClaudeCode
You must log in or # to comment.
