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.
Remote or local
This package is the local server: it runs on your machine over stdio, with your API key in its
environment. There is also a remote server at https://agentbill.dev/mcp, with a sign-in
instead of a key for Claude, ChatGPT and other clients, and three more tools. Setup for each client
is at agentbill.dev/integrations/mcp. The package's HTTP
mode is for your own machine only; the hosted copy that once ran it was taken down on 2026-09-25.
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. Passtask_refwith atask_ceilingto give one job a single cross-call budget that every later call in the job consults, andidempotency_keyso a retried check cannot reserve the budget twice.record_event(agent_id, units, customer_id, metadata). Record what the work used against that customer's balance, after it 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. Must be https, or plain http to localhost, 127.0.0.1 or [::1] (since 0.3.0); anything else fails the tool call before a request is sent |
MCP_TRANSPORT |
No | stdio |
Set to http to serve streamable HTTP at /mcp instead of stdio |
AGENTBILL_MCP_HOST |
No | 127.0.0.1 |
HTTP mode only. Interface to bind |
AGENTBILL_MCP_PORT |
No | 8080 |
HTTP mode only. Port to bind |
AGENTBILL_MCP_ALLOWED_HOSTS |
No | none | HTTP mode only. Extra Host header values to accept, comma separated (mcp.example.com,10.0.0.5:*) |
AGENTBILL_MCP_ALLOWED_ORIGINS |
No | none | HTTP mode only. Extra Origin values to accept, comma separated |
HTTP mode
MCP_TRANSPORT=http AGENTBILL_API_KEY=agb_your_key_here uvx agentbill-mcp
The server listens on 127.0.0.1:8080 and checks the Host and Origin headers of every request (DNS-rebinding protection). A web page open in your browser can reach loopback addresses, and this server holds your API key, so both defaults stay on unless you change them on purpose.
To serve on another interface, set the bind address and name the host names clients will use. Requests carrying any other Host header are answered with 421:
MCP_TRANSPORT=http \
AGENTBILL_MCP_HOST=0.0.0.0 \
AGENTBILL_MCP_ALLOWED_HOSTS=mcp.example.com \
AGENTBILL_API_KEY=agb_your_key_here \
uvx agentbill-mcp
Loopback host names are always accepted. There is no setting that turns the header checks off. Anyone who can reach an exposed port can spend the key in its environment, so put it behind your own authentication.
Links
- Docs: agentbill.dev
- Python SDK:
pip install agentbill-sdk - GitHub: github.com/marketinglior-pixel/agentbill
Release files for agentbill-mcp 0.3.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| agentbill_mcp-0.3.1.tar.gz | 11.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| agentbill_mcp-0.3.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 19.2 kB
Release files / agentbill_mcp-0.3.1.tar.gz
| Download URL | agentbill_mcp-0.3.1.tar.gz |
|---|---|
| Size | 11.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b8ffa4a1ab0020c67e4c95442c7b6ebef46b2a8f97c114098c8928d18a5e408c
|
|
BLAKE2b-256 checksum How to use checksums |
1444b039c76019723be921fd27edb28b82c94009e9c36c374b2a811eb90aa07e
|
| 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.3.1-py3-none-any.whl
| Download URL | agentbill_mcp-0.3.1-py3-none-any.whl |
|---|---|
| Size | 8.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
23fc8247acba15356dc58d02407dbb453b74d7b42c5419c366b6d43fd1f4babc
|
|
BLAKE2b-256 checksum How to use checksums |
bdadcf6ddad7d17218c3e9106f9ea01efd2a60347a9282fdf80055b9c995938c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.9.6
|