> The index of all pages is at https://docs.afffast.com/llms.txt.

# Cursor

Add the MCP server to Cursor with a button or with mcp.json.

Cursor reads MCP servers from `mcp.json`. The file can use `${env:NAME}` in the `url` and in the `headers`. So the file does not hold the key.

## Install with the button

1. Put the key in an environment variable, and start Cursor from a shell that has it. On macOS, you can also set the variable for the desktop with `launchctl setenv AFFFAST_API_KEY "sk_test_..."` and restart Cursor.

   ```bash
   export AFFFAST_API_KEY="sk_test_..."
   ```

2. Open this link: [Add to Cursor](cursor://anysphere.cursor-deeplink/mcp/install?name=afffast&config=eyJ1cmwiOiJodHRwczovL2FwaS5hZmZmYXN0LmNvbS9tY3AiLCJoZWFkZXJzIjp7IkF1dGhvcml6YXRpb24iOiJCZWFyZXIgJHtlbnY6QUZGRkFTVF9BUElfS0VZfSJ9fQ==).
3. Cursor shows the server. Check the URL and select **Install**.

The link has the name of the server and a Base64 copy of this configuration:

```json
{
  "url": "https://api.afffast.com/mcp",
  "headers": { "Authorization": "Bearer ${env:AFFFAST_API_KEY}" }
}
```

## Install with a file

Add the server to `.cursor/mcp.json` in your project, or to `~/.cursor/mcp.json` for all projects:

```json
{
  "mcpServers": {
    "afffast": {
      "url": "https://api.afffast.com/mcp",
      "headers": { "Authorization": "Bearer ${env:AFFFAST_API_KEY}" }
    }
  }
}
```

## Check that it works

1. Open the Output panel (`Cmd+Shift+U` on macOS). Select **MCP Logs**.
2. Look for the connection of `afffast`. The log shows an error if the connection fails.
3. In a chat, look at the available tools. The tools of the server must be there. Cursor asks you to approve a tool call.

## Example prompts

- "Use the afffast tools to list my networks and their connection status."
- "Show the revenue by program for the last 30 days."
- "Make a test conversion for the newest test click, then show it in the list of conversions."

## Troubleshooting

- **The server shows an error or a 401.** The variable `AFFFAST_API_KEY` is not set in the process that started Cursor. Quit Cursor. Start it from a shell where the variable is set.
- **The tools are missing.** The key decides the tools. A read-only key has no write tools.
- **The link does not open Cursor.** Install Cursor first. Or use the file method.
- **A 429 error.** Wait for the time in `Retry-After`.

## Security

- Never paste a key into a chat. Use the environment variable.
- Start with a test key. A test key reads and writes test data only.
- Use a read-only key if the tool must only read.
- A key in `.cursor/mcp.json` goes into your repository. Use `${env:AFFFAST_API_KEY}` only.
