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

# Connect Cursor

> Add Prefer's MCP server to Cursor with an MCP key kept in an environment variable.

**1. Create an MCP key**

In Prefer, open **Integrations → MCP** in the left navigation and create a key on the **Keys** tab. See [MCP keys](https://tryprefer.com/docs/ai-assistants/mcp-keys.md).

**2. Put the key in an environment variable**

Add the key to your shell profile, for example `~/.zshrc`, so it stays out of your config files:

```bash theme={null}
export PREFER_MCP_KEY="<MCP key>"
```

Then restart Cursor so it picks up the variable.

**3. Add Prefer to mcp.json**

Edit `~/.cursor/mcp.json` to use Prefer in every project, or `.cursor/mcp.json` in a project for that project only:

```json theme={null}
{
  "mcpServers": {
    "prefer": {
      "url": "https://mcp.tryprefer.com/mcp",
      "headers": {
        "Authorization": "Bearer ${env:PREFER_MCP_KEY}"
      }
    }
  }
}
```

Cursor replaces `${env:PREFER_MCP_KEY}` with the value from your environment.

**4. Ask**

In Cursor's agent, ask in plain words, for example "Which Prefer actions should we fix first?". Cursor asks before it uses an MCP tool.

> [!TIP]
>
> If Prefer does not connect, open the Output panel (Cmd+Shift+U on macOS), choose **MCP Logs**, and check for an authentication error. A revoked or mistyped key is refused; create a new key in Prefer and update the variable.

Turn the server on or off from **Customize** in Cursor's sidebar. Cursor's own guide: [MCP in Cursor](https://cursor.com/docs/mcp).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.