MCP for agents
How an agent connects to Abazi over MCP, the six tools it can call, and how it handles results and errors.
request_purchase. None of the six tools signs, moves funds or changes rules; the agent's credential only identifies it.Connect
Abazi's MCP server speaks streamable HTTP at https://api.52-28-238-205.sslip.io/mcp, stateless, with JSON responses. The agent sends its credential in an Authorization: Bearer agk_test_... header on every request. Clients that only start local processes connect over stdio through the mcp-remote bridge. The same credential works for the REST API. An owner creates it in the Console; it is shown once and stored only as a hash.
Setup for each client, with copy-paste configuration and a first purchase, is in Agents and harnesses:
| Client | Connect |
|---|---|
| Claude Code | claude mcp add --transport http abazi https://api.52-28-238-205.sslip.io/mcp --header "Authorization: Bearer $ABAZI_AGENT_KEY" |
| Claude Desktop | npx -y mcp-remote https://api.52-28-238-205.sslip.io/mcp --header "Authorization:Bearer ${ABAZI_AGENT_KEY}" in claude_desktop_config.json |
| Cursor | "url": "https://api.52-28-238-205.sslip.io/mcp" and an Authorization header in mcp.json |
| Any MCP client | Streamable HTTP to https://api.52-28-238-205.sslip.io/mcp with a Bearer header |
| JSON-RPC | Plain JSON-RPC 2.0 POSTs to https://api.52-28-238-205.sslip.io/mcp, no MCP client |
| Local model on Tether QVAC | A model on your machine chooses the tools; the agent program holds the credential |
Without an MCP client
The endpoint also answers plain JSON-RPC 2.0 POST requests, with no session and no MCP library: tools/list and tools/call with the same Bearer header. A script or a non-MCP agent framework calls the same six tools this way. See JSON-RPC.
The tools
Each tool has its own page with its input, its result, the reason codes an agent meets most and the matching REST operation.
| Tool | What it does | Inputs (required in bold) |
|---|---|---|
| search_catalog | Find paid services you can buy, with price, networks and merchant trust tier. Use before request_purchase when you don't know the service_id. Does not spend money. | query, category, max_price_base_units, limit |
| request_purchase | Buy one paid resource by service_id or url. The gateway checks your spending rules, pays, and returns the resource. Use a new idempotency_key per purchase; reuse it to retry the same purchase. Never retry a denial. | service_id, url, task_id, idempotency_key, input, purpose, wait_seconds |
| request_installment_purchase | Start an installment plan (for example 4 x 0.30 USDC) from a merchant's published plan. Always needs owner approval of the total. Use only for plans, not single purchases. | plan_id, task_id, idempotency_key |
| get_purchase_status | Check a purchase you started: payment status and delivery status are separate. Use after awaiting_approval or submitted, waiting poll_after_ms between calls. | intent_id |
| get_spending_status | Your own budget: available, reserved and spent, plus your per-purchase limits and when your rules expire. Use when a purchase was denied for budget. | — |
| get_receipt | Get a signed receipt and its public verification link. Use to prove a purchase happened. | receipt_id |
Transports: stdio; streamable-http at https://api.52-28-238-205.sslip.io/mcp with Authorization: Bearer YOUR_AGENT_KEY (an agent credential).
What request_purchase returns
status | Meaning | What the agent does next |
|---|---|---|
paid | The payment confirmed. The result carries the resource, the amount, the network and a receipt_id. | Use the resource. Keep the receipt id. |
submitted | The payment was sent and is waiting for confirmation on its network. | Call get_purchase_status, waiting poll_after_ms between calls. |
awaiting_approval | The purchase crossed a threshold and waits for a person. | Poll get_purchase_status. The approval link expires after 10 minutes. |
free | The resource needed no payment. | Use the resource. |
Payment and delivery are tracked separately: get_purchase_status returns a payment_status and a fulfillment_status, because paid does not always mean delivered.
Rules for agents
- Use a new
idempotency_keyper purchase. Reusing a key with the same request returns the first result instead of buying twice, so a retry after a timeout is safe. Reusing it with a different request is refused withIDEMPOTENCY_CONFLICT. - Name what to buy by
service_idfromsearch_catalog, or byurlfor a merchant not in the catalog. Never by price or address: Abazi prices the purchase itself. purpose(up to 500 characters) is shown to the approver and screened by Shield. It is not copied into the public receipt.- Never retry a denial. Follow its
next_action.
Errors
Business failures come back as an error result whose text is JSON:
{ "error_code": "POLICY_DENIED", "reason_code": "BUDGET_EXCEEDED", "message": "...", "retryable": false, "next_action": "Call get_spending_status.", "intent_id": "pi_..." }A wrong, rotated or revoked credential returns AGENT_CREDENTIAL_INVALID on every tool call. Malformed arguments use the protocol's own errors. Every reason_code, with its next_action, is in the reason code reference.
Example
{
"service_id": "svc_...",
"task_id": "weekly-report-42",
"idempotency_key": "weekly-report-42-forecast",
"purpose": "Weather forecast for the logistics summary"
}{
"status": "paid",
"intent_id": "pi_...",
"decision": "ALLOW",
"reason_code": "WITHIN_POLICY",
"receipt_id": "rcpt_...",
"amount_base_units": "50000",
"asset": "USDC",
"network": "solana:...",
"rail": "x402",
"resource": { "content_type": "application/json", "body": "..." }
}