Guide: MCP integration
Driptab exposes a native HTTP MCP server running on the same Cloudflare Worker as
the REST API. AI agents can connect to it at https://api.driptab.app/v1/mcp and
interact with billing data using standard MCP tools.
How it works
The MCP server uses the Streamable HTTP transport (JSON-RPC 2.0 over HTTPS). No local process or npm package is required — the server runs on Cloudflare's edge, available globally at low latency.
Authentication is identical to the REST API: a driptab API token as a Bearer header, plus the project ID.
Create a token
For read-only agents (querying billing state):
dtab token create --name "MCP Agent" --scopes read
For agents that also record payments or update subscriptions:
dtab token create --name "Automation Agent" --scopes read,write
The token is shown once. Store it securely.
Connect Claude Desktop
Add this to your Claude Desktop claude_desktop_config.json:
{
"mcpServers": {
"driptab": {
"url": "https://api.driptab.app/v1/mcp",
"headers": {
"Authorization": "Bearer dtab_...",
"X-Project-Id": "<project_uuid>"
}
}
}
}
Find your project UUID:
dtab ls
Available tools
| Tool | Description |
|---|---|
list_customers |
List customers. Pass all: true for up to 1000. |
get_customer |
Get customer by UUID or short_id. |
list_subscriptions |
List subscriptions. Optional: customer_id, all. |
get_subscription |
Get subscription by id or short_id. |
list_invoices |
List invoices. Optional: customer_id, status, all. |
get_invoice |
Get invoice with full fee breakdown. |
list_payments |
List payments. Optional: customer_id, all. |
list_plans |
List all plans with labels and interval. |
get_plan |
Get plan with charges. Accepts UUID, short_id, or code. |
record_payment |
Record a payment. Requires invoice_id, amount_cents. |
Raw JSON-RPC usage
Discovery:
curl https://api.driptab.app/v1/mcp \
-H "Authorization: Bearer dtab_..." \
-H "X-Project-Id: <project_uuid>"
List tools:
curl -X POST https://api.driptab.app/v1/mcp \
-H "Authorization: Bearer dtab_..." \
-H "X-Project-Id: <project_uuid>" \
-H "Content-Type: application/json" \
-d '{"jsonrpc":"2.0","method":"tools/list","params":{},"id":1}'
Call a tool:
curl -X POST https://api.driptab.app/v1/mcp \
-H "Authorization: Bearer dtab_..." \
-H "X-Project-Id: <project_uuid>" \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"name": "list_invoices",
"arguments": { "status": "outstanding", "all": true }
},
"id": 2
}'
Response shape:
{
"jsonrpc": "2.0",
"result": {
"content": [{ "type": "text", "text": "[{\"id\":\"...\",\"status\":\"outstanding\"}]" }]
},
"id": 2
}
Example agent prompts
Once connected to Claude Desktop, you can ask:
- "Show me all outstanding invoices"
- "What subscriptions does customer acme_001 have?"
- "List all plans with their labels"
- "Record a $99 bank transfer payment on invoice INV-0042"
- "Get the fee breakdown for invoice INV-0055"
Crux agent integration
If you use Crux for multi-agent workflows,
a dedicated driptab-operator agent and three skills are available:
# Agent: handles all driptab billing operations
@driptab-operator
# Skills loaded automatically by the agent:
# - driptab-cli — dtab command reference
# - driptab-api — REST API + MCP reference
# - driptab-billing-ops — step-by-step billing workflows
See AI agents guide for setup and usage.
Token management
dtab token list # list all tokens
dtab token revoke <token_id> # revoke immediately
Revoked tokens are rejected immediately (KV cache TTL: 60 seconds).
Errors
| Code | Meaning |
|---|---|
-32001 |
Unauthorized — missing or invalid Bearer token |
-32002 |
Missing project — add X-Project-Id header |
-32601 |
Method not found |
-32603 |
Internal error (check message field) |