> ## Documentation Index
> Fetch the complete documentation index at: https://docs.cometly.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Cursor

> Add the Cometly MCP server to Cursor and ask questions about your marketing data right from the chat sidebar.

## Prerequisites

* A Cometly workspace and a Space you have **Use Public API** permission in.
* Cursor 0.42 or newer (any version with MCP support).
* Your numeric **Space ID** — copy it from the **ID** row at the bottom of the dashboard sidebar, or from [**Space Settings**](https://app.cometly.com/space/settings) → **Space Details**. See [Finding your Space ID](/mcp/overview#finding-your-space-id) for step-by-step instructions.

## Add the server

Open Cursor's settings (`Cmd + ,` on macOS, `Ctrl + ,` on Windows / Linux), search for **MCP**, and click **+ Add new MCP server**. Set:

| Field | Value                                                    |
| ----- | -------------------------------------------------------- |
| Name  | `cometly`                                                |
| Type  | `HTTP`                                                   |
| URL   | `https://app.cometly.com/mcp/{your-space-id}/public-api` |

Click **Save**.

Or, if you'd rather edit the config file directly, open `~/.cursor/mcp.json` and add:

```json theme={null}
{
  "mcpServers": {
    "cometly": {
      "url": "https://app.cometly.com/mcp/42/public-api"
    }
  }
}
```

Replace `42` with your Space ID.

## Authorize

The first time Cursor tries to talk to the server, it'll open your browser to the Cometly authorization page. Log in, confirm you're authorizing the right Space, and click **Approve**. Cursor takes over from there and saves the token automatically.

## Verify

Back in Cursor, open the chat sidebar and type:

```
Using the cometly MCP server, list my conversion events from the last 7 days.
```

You should see a tool indicator pop up (`list_events`), then a response with real data from your Space. If you see `401 Unauthorized`, your token expired — just send the message again and Cursor will re-walk the OAuth flow.

## Troubleshooting

<AccordionGroup>
  <Accordion title="Cursor says 'failed to connect'">
    Confirm the URL is `https://app.cometly.com/mcp/{space_id}/public-api` (no trailing slash) and that you replaced `{space_id}` with a real numeric ID. Cursor caches a failed handshake for a minute or so — wait and try again.
  </Accordion>

  <Accordion title="403 — Token is not authorized for this space">
    The token was approved for a different Space. Open `~/.cursor/mcp.json`, delete the cometly entry, restart Cursor, and re-add the server. Cursor will walk the OAuth flow again and you can pick the right Space.
  </Accordion>

  <Accordion title="The model invents tools or parameters">
    Make sure Cursor is using the latest Claude or GPT model. Some smaller models hallucinate MCP tool names — bigger frontier models read the input schema and follow it.
  </Accordion>
</AccordionGroup>

## What you can ask

* *"Show me my top 10 ad sets by ROAS for the last 30 days."*
* *"List purchases from contacts where Customer Plan is Premium this month."*
* *"What was my CPA on Meta last week vs the week before?"*
* *"Look up contact 12345 and tell me their full journey."*

Cursor will pick the right tool ([`query_ad_metrics`](/mcp/tools/query-ad-metrics), [`list_events`](/mcp/tools/list-events), [`get_contact`](/mcp/tools/get-contact)…) automatically. You don't have to name the tool.
