Skip to main content

agentbill-mcp

One spend ceiling for one agent job, exposed as MCP tools. Bound to a task_ref you pass, not to a calendar month.

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; answers approved=False with a reason when a ceiling or balance is spent. 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 answers approved=False when the customer has no remaining balance, and the agent host decides what happens next. No code changes needed in your agent.

Environment variables

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

Release files for agentbill-mcp 0.2.2

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.2
File Size Uploaded
agentbill_mcp-0.2.2.tar.gz 5.7 kB Details

Built distribution (wheel)

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

Total release size: 11.2 kB

Release files / agentbill_mcp-0.2.2.tar.gz

Download URL agentbill_mcp-0.2.2.tar.gz
Size 5.7 kB
Tags Source
SHA-256 checksum
How to use checksums
dc6ada073814f918b058041789adb9e5a8ea0937f211a7a4567fcb32de042a13
BLAKE2b-256 checksum
How to use checksums
4e9a969b91ff516475f77c1d1c12900370cae9a3024a769bb24b517aceeedb30
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.6

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

Download URL agentbill_mcp-0.2.2-py3-none-any.whl
Size 5.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
38d9f0149b097a13dedc239aedf48eabbd88722c0df75820a5b8ccd8bd119aab
BLAKE2b-256 checksum
How to use checksums
63c6d4e16a617bf102aa704c115c61f9bfcf380cf74e367b531519dc63acc126
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.6

Release history Release notifications | RSS feed

This release

0.2.2 This release

2 release files

0.2.1

2 release files

0.2.0

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