# 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.

Cursor connects to remote MCP servers over streamable HTTP. One entry in `mcp.json` points it at `https://api.52-28-238-205.sslip.io/mcp` with the agent's credential in an `Authorization` header. Cursor's agent then sees Abazi's six tools.

## Before you start [#before-you-start]

| You need | Why |
| --- | --- |
| An agent credential (`agk_test_...`) | Created in the [Console](https://app.52-28-238-205.sslip.io) under **Agents > New agent**. Shown once. Replace `YOUR_AGENT_KEY` with it. See [Get an agent credential](/docs/agents#get-an-agent-credential). |
| A signed mandate for that agent | Without one every purchase is denied with <ReasonCode code="MANDATE_MISSING" />. |
| Cursor | With agent mode. |

## Connect [#connect]

Cursor reads MCP servers from two places:

| File | Scope |
| --- | --- |
| `~/.cursor/mcp.json` | Every project on this computer |
| `.cursor/mcp.json` in a project | That project only |

Add the `abazi` server. If the file already has an `mcpServers` object, add `abazi` inside it.

```json title="~/.cursor/mcp.json"
{
  "mcpServers": {
    "abazi": {
      "url": "https://api.52-28-238-205.sslip.io/mcp",
      "headers": {
        "Authorization": "Bearer YOUR_AGENT_KEY"
      }
    }
  }
}
```

The file now holds a secret. Prefer the global file. If you use the project file, keep `.cursor/mcp.json` out of version control.

## Verify [#verify]

Open **Cursor Settings > MCP**. `abazi` shows a green status and six tools: `search_catalog`, `request_purchase`, `request_installment_purchase`, `get_purchase_status`, `get_spending_status` and `get_receipt`. If it shows an error, toggle it off and on after fixing the file.

Ask the agent for a search. Searching spends nothing.

```text title="Prompt (agent mode)"
Use the abazi search_catalog tool to find "forecast" services. Show the service ids and prices.
```

The result lists services with a `service_id`, the merchant and its trust tier, a price in base units (`50000` is 0.05 USDC), the asset and the networks.

## First purchase [#first-purchase]

```text title="Prompt (agent mode)"
Search the catalog for forecast and buy it for Tbilisi with task id trip-plan-7. Then fetch the receipt.
```

Cursor asks you to run each tool call unless you have turned on auto-run. The agent calls `request_purchase` with the `service_id`, the `task_id` and a fresh `idempotency_key`. It sends no price, address or network; Abazi takes those from the catalog and the mandate.

### ALLOW [#allow]

`status` is `paid`, with `decision: "ALLOW"`, the resource and a `receipt_id`. The agent calls `get_receipt` for the signed receipt and its public verification link. If `status` is `submitted`, it polls `get_purchase_status` after `poll_after_ms`.

### REQUIRE_APPROVAL [#require_approval]

`status` is `awaiting_approval`, with a reason such as <ReasonCode code="ABOVE_AUTO_THRESHOLD" /> or <ReasonCode code="FIRST_PURCHASE" />. The approval link goes to the owner's approvers, never to Cursor. The agent keeps the same `intent_id` and polls `get_purchase_status`. The link expires after <Limit name="approvalTtl" />.

### DENY [#deny]

The tool returns an error result with `error_code: "POLICY_DENIED"`, a `reason_code` such as <ReasonCode code="HARD_CAP_EXCEEDED" />, `retryable` and `next_action`. A denial is final for that purchase.

## Troubleshooting [#troubleshooting]

| Symptom | Cause and fix |
| --- | --- |
| Tool calls fail with `AGENT_CREDENTIAL_INVALID` | The credential is wrong, rotated or revoked (<ReasonCode code="AGENT_CREDENTIAL_INVALID" />). Replace it in `mcp.json`. The tool list still loads with a bad key; only the calls fail. |
| No tools listed | Check the JSON, that the key is `url` (not `command`), and that the URL ends in `/mcp`. Reload the server in **Cursor Settings > MCP**. |
| The purchase stays `awaiting_approval` | A person has not decided yet. Keep polling the same `intent_id`; do not start a new purchase. |
| `IDEMPOTENCY_CONFLICT` | The same `idempotency_key` was sent with a different request. Use a new key for a different purchase. |

## Next steps [#next-steps]

<Cards>
  <Card title="MCP tools" href="/docs/mcp" description="Inputs, results and errors of the six tools." />
  <Card title="Write a mandate" href="/docs/guides/write-a-mandate" description="Set the limits the agent buys under." />
  <Card title="TypeScript" href="/docs/agents/typescript" description="Call the same operations from code, with types." />
  <Card title="All harnesses" href="/docs/agents" description="Compare the other ways to connect." />
</Cards>

