Any MCP client
Connect any MCP host or your own agent to Abazi's streamable HTTP endpoint with a Bearer header, check it with curl, and make a first purchase from the MCP Python SDK.
Abazi's MCP server is a standard MCP server named gateway. It speaks streamable HTTP at https://api.52-28-238-205.sslip.io/mcp, stateless, with JSON responses. Any client that can send a header on each request connects directly. A client that only starts local processes connects through the mcp-remote bridge.
Before you start
| You need | Why |
|---|---|
An agent credential (agk_test_...) | Created in the Console under Agents > New agent. Shown once. Replace YOUR_AGENT_KEY with it. See Get an agent credential. |
| A signed mandate for that agent | Without one every purchase is denied with MANDATE_MISSING. |
Connection settings
| Setting | Value |
|---|---|
| Transport | Streamable HTTP |
| URL | https://api.52-28-238-205.sslip.io/mcp |
| Header | Authorization: Bearer agk_test_... on every request |
| Session | Stateless: no session id to keep between requests |
| Tools | Six: search_catalog, request_purchase, request_installment_purchase, get_purchase_status, get_spending_status, get_receipt |
For a client that only speaks stdio, start the bridge as its server command:
npx -y mcp-remote https://api.52-28-238-205.sslip.io/mcp --header "Authorization:Bearer ${ABAZI_AGENT_KEY}"Verify with curl
List the tools. Send an Accept header that allows JSON and an event stream, as MCP clients do; the server answers with plain JSON.
curl -s https://api.52-28-238-205.sslip.io/mcp \
-H 'Authorization: Bearer YOUR_AGENT_KEY' \
-H 'Content-Type: application/json' \
-H 'Accept: application/json, text/event-stream' \
-d '{"jsonrpc":"2.0","id":1,"method":"tools/list"}'{
"jsonrpc": "2.0",
"id": 1,
"result": {
"tools": [
{ "name": "search_catalog", "description": "Find paid services you can buy, ...", "inputSchema": { "type": "object", "properties": { "query": { "type": "string" } } } },
{ "name": "request_purchase", "description": "Buy one paid resource by service_id or url. ...", "inputSchema": { "...": "..." } }
]
}
}Then call a tool. Each tool returns its result as JSON in a text content block. To build on these raw requests without an MCP client, see JSON-RPC.
curl -s https://api.52-28-238-205.sslip.io/mcp \
-H 'Authorization: Bearer YOUR_AGENT_KEY' \
-H 'Content-Type: application/json' \
-H 'Accept: application/json, text/event-stream' \
-d '{"jsonrpc":"2.0","id":2,"method":"tools/call","params":{"name":"search_catalog","arguments":{"query":"forecast"}}}'{
"jsonrpc": "2.0",
"id": 2,
"result": {
"content": [{ "type": "text", "text": "{\"services\": [{\"service_id\": \"svc_...\", \"name\": \"Weather forecast\", \"price_base_units\": \"50000\", \"asset\": \"USDC\", ...}]}" }],
"isError": false
}
}First purchase from your own agent
This agent uses the MCP Python SDK (pip install mcp). It searches, buys the first result, polls while the payment settles or waits for approval, and fetches the receipt.
import asyncio, json, os, uuid
from mcp import ClientSession
from mcp.client.streamable_http import streamablehttp_client
MCP_URL = "https://api.52-28-238-205.sslip.io/mcp"
HEADERS = {"Authorization": f"Bearer {os.environ['ABAZI_AGENT_KEY']}"}
async def call(s, tool, args=None):
r = await s.call_tool(tool, args or {})
data = json.loads("".join(c.text for c in r.content if c.type == "text"))
return not r.isError, data
async def main():
async with streamablehttp_client(MCP_URL, headers=HEADERS) as (read, write, _):
async with ClientSession(read, write) as s:
await s.initialize()
_, found = await call(s, "search_catalog", {"query": "forecast"})
service_id = found["services"][0]["service_id"]
ok, res = await call(s, "request_purchase", {
"service_id": service_id,
"task_id": "trip-plan-7",
"idempotency_key": str(uuid.uuid4()),
"input": {"city": "Tbilisi"},
})
if not ok: # DENY or another error: stop and report
print(res["reason_code"], res["next_action"])
return
while res["status"] in ("submitted", "awaiting_approval"):
await asyncio.sleep(res.get("poll_after_ms", 2000) / 1000)
ok, res = await call(s, "get_purchase_status", {"intent_id": res["intent_id"]})
print(res["status"], res.get("reason_code"))
if res.get("receipt_id"):
_, receipt = await call(s, "get_receipt", {"receipt_id": res["receipt_id"]})
print(receipt.get("verify_url"))
asyncio.run(main())What comes back
| Result | Meaning |
|---|---|
status: "paid" | ALLOW. The result has the resource, the amount, the rail and a receipt_id. |
status: "submitted" | ALLOW, still settling. Poll get_purchase_status after poll_after_ms (2 seconds). |
status: "awaiting_approval" | REQUIRE_APPROVAL, for example ABOVE_AUTO_THRESHOLD. Approvers get the link; poll every poll_after_ms (5 seconds) until it is paid or denied. The link expires after 10 minutes. |
status: "denied" after approval | The approver said no (APPROVAL_REJECTED) or the link expired (APPROVAL_EXPIRED). |
isError: true, error_code: "POLICY_DENIED" | DENY. Read reason_code, retryable and next_action, for example BUDGET_EXCEEDED. Never retry a denial with a new key. |
Every error result has the same fields: error_code, reason_code, message, retryable, next_action, and intent_id when a purchase exists.
Troubleshooting
| Symptom | Cause and fix |
|---|---|
Tool results carry AGENT_CREDENTIAL_INVALID | The credential is wrong, rotated or revoked (AGENT_CREDENTIAL_INVALID). tools/list still answers with a bad key; tool calls do not. Stop and ask for a new credential. |
| HTTP 406 Not Acceptable | The Accept header is missing application/json. Send application/json, text/event-stream as shown. |
| A tool is not listed | Check the URL ends in /mcp. All six tools are always listed; a client that filters tools may hide some. |
The purchase stays awaiting_approval | A person has not decided yet. Keep polling the same intent_id. |
IDEMPOTENCY_CONFLICT | The same idempotency_key was sent with a different request. Reuse a key only to retry the same purchase. |
Next steps
Cursor
Add Abazi's MCP server to Cursor with one mcp.json entry, check the six tools in Cursor's settings, and let the agent search the catalog and buy under the owner's mandate.
JSON-RPC
Call Abazi's six agent tools with plain JSON-RPC 2.0 POST requests, without an MCP client or a session, from any language with an HTTP client.