Skip to main content

agentbill-mcp

AgentBill MCP server. Add spend controls and usage billing to any AI agent in 3 lines.

What it does

Exposes two tools to any MCP-compatible agent host (Claude Code, Cursor, Windsurf, etc.):

  • preflight(agent_id, customer_id, estimated_units, ceiling, task_ref, task_ceiling, idempotency_key). Check budget before starting work, blocks if exhausted. Pass task_ref with a task_ceiling to give one job a single cross-call budget that every later call in the job consults, and idempotency_key so a retried check cannot reserve the budget twice.
  • record_event(agent_id, units, customer_id, metadata) — bill a customer after work completes. Idempotent.

Install

uvx agentbill-mcp

No install needed. uvx runs it directly.

Configure

Claude Code

Add to ~/.claude/settings.json:

{
  "mcpServers": {
    "agentbill": {
      "command": "uvx",
      "args": ["agentbill-mcp"],
      "env": {
        "AGENTBILL_API_KEY": "agb_your_key_here"
      }
    }
  }
}

Cursor / Windsurf / other MCP clients

Add to your MCP config:

{
  "agentbill": {
    "command": "uvx",
    "args": ["agentbill-mcp"],
    "env": {
      "AGENTBILL_API_KEY": "agb_your_key_here"
    }
  }
}

Get your API key at agentbill.dev/register.

Usage

Once configured, any agent using this MCP server can:

# Before running a task:
preflight(agent_id="research_agent", customer_id="user_123", estimated_units=5)

# After completing the task:
record_event(agent_id="research_agent", units=5, customer_id="user_123")

The server blocks the run if the customer has no remaining budget. No code changes needed in your agent.

Environment variables

Variable Required Default Description
AGENTBILL_API_KEY Yes Your AgentBill API key
AGENTBILL_BASE_URL No https://agentbill.fly.dev Override for self-hosted

Links

Release files for agentbill-mcp 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for agentbill-mcp 0.2.0
File Size Uploaded
agentbill_mcp-0.2.0.tar.gz 5.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for agentbill-mcp 0.2.0
File Interpreter ABI Platform
agentbill_mcp-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 10.7 kB

Release files / agentbill_mcp-0.2.0.tar.gz

Download URL agentbill_mcp-0.2.0.tar.gz
Size 5.4 kB
Tags Source
SHA-256 checksum
How to use checksums
61f1b91892bc643c320bfc5c1c688324e6d8ff137622915bec5cadc9e47a33af
BLAKE2b-256 checksum
How to use checksums
47041f799c02c3cc6c7108cebd863ef1c35206c485e400a83ab54cff94401fe0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.13

Release files / agentbill_mcp-0.2.0-py3-none-any.whl

Download URL agentbill_mcp-0.2.0-py3-none-any.whl
Size 5.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
80eda728064f7c3b10f77cc96a2f0b206c95aaf9f0bf48c46dd8304fbfa605c0
BLAKE2b-256 checksum
How to use checksums
d04cd2d04c382a0af2094496bdf12f54fba5ccaac827dce5db55228baa93da06
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.13

Release history Release notifications | RSS feed

0.2.2

2 release files

0.2.1

2 release files

This release

0.2.0 This release

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page