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

# Windsurf

Add the MCP server to Windsurf Cascade in mcp_config.json.

Windsurf Cascade reads its MCP servers from the file `mcp_config.json`. A remote server uses the field `serverUrl`. The file can use `${env:NAME}` in `serverUrl` and in `headers`. So the file does not hold the key.

## Install

1. Make a test key in the dashboard. A test key starts with `sk_test_`.
2. Put the key in an environment variable, and start Windsurf from a shell that has it:

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

3. Open the MCP menu of Cascade and select **Open MCP config file**. Add the server:

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

4. Save the file. Press the refresh button in the MCP menu.

The path of the file depends on your version of Windsurf. The docs name `~/.codeium/windsurf/mcp_config.json` for older versions and `~/.config/devin/mcp_config.json` for newer versions. Use **Open MCP config file**: it opens the right file.

You can also add a server in **Settings**, then **Tools**, then **Windsurf Settings**, then **Add Server**.

## Check that it works

Open the MCP menu of Cascade. The server `afffast` must be on, and it must list its tools. A server that fails shows an error.

## Example prompts

- "Use the afffast tools to show the revenue by network for last month."
- "Which program had the most declined conversions this quarter?"
- "List my active links and their click counts."

## Troubleshooting

- **The server does not show.** Press refresh. Check that the JSON is valid.
- **A 401 error.** The variable `AFFFAST_API_KEY` is not set in the process that started Windsurf. The documentation does not say where Windsurf reads the variable. Quit Windsurf, and 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.
- **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.
- Do not write the key in `mcp_config.json`. Use `${env:AFFFAST_API_KEY}`.
