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

# Cursor

> Install and use the Perfai MCP server in Cursor — globally or scoped to a single project.

Cursor supports MCP servers via a JSON config file. You can register Perfai globally (available in every workspace) or per-project (checked into your repo).

<Warning>
  The package binary is `perfai-mcp-server`. Always launch it with `npx --yes --package=@perfai/mcp@latest perfai-mcp-server` — `npx @perfai/mcp` alone fails with *"could not determine executable to run."*
</Warning>

<Note>
  Authentication uses your Perfai username and password via the `PERFAI_USERNAME` / `PERFAI_PASSWORD` environment variables. Because these sit in plaintext in the config, prefer **global** config and don't commit credentials to a shared repo.
</Note>

***

## Global installation

<Tabs>
  <Tab title="macOS / Linux">
    File: `~/.cursor/mcp.json`

    ```json theme={null}
    {
      "mcpServers": {
        "perfai-mcp": {
          "command": "npx",
          "args": ["--yes", "--package=@perfai/mcp@latest", "perfai-mcp-server"],
          "env": {
            "PERFAI_USERNAME": "you@example.com",
            "PERFAI_PASSWORD": "your-password"
          }
        }
      }
    }
    ```

    Create the file if it doesn't exist:

    ```bash theme={null}
    mkdir -p ~/.cursor
    touch ~/.cursor/mcp.json
    ```
  </Tab>

  <Tab title="Windows">
    File: `%USERPROFILE%\.cursor\mcp.json`

    ```json theme={null}
    {
      "mcpServers": {
        "perfai-mcp": {
          "command": "npx",
          "args": ["--yes", "--package=@perfai/mcp@latest", "perfai-mcp-server"],
          "env": {
            "PERFAI_USERNAME": "you@example.com",
            "PERFAI_PASSWORD": "your-password"
          }
        }
      }
    }
    ```

    Create the file if it doesn't exist (run in PowerShell):

    ```powershell theme={null}
    New-Item -Path "$env:USERPROFILE\.cursor\mcp.json" -Force
    ```
  </Tab>
</Tabs>

***

## Project-scoped installation

Add the config to `.cursor/mcp.json` at the root of your project. This makes the server available only when that project is open.

```json theme={null}
{
  "mcpServers": {
    "perfai-mcp": {
      "command": "npx",
      "args": ["--yes", "--package=@perfai/mcp@latest", "perfai-mcp-server"],
      "env": {
        "PERFAI_USERNAME": "you@example.com",
        "PERFAI_PASSWORD": "your-password"
      }
    }
  }
}
```

<Warning>
  Do **not** commit `.cursor/mcp.json` if it contains your `PERFAI_PASSWORD`. Add it to `.gitignore`, or keep credentials in your global `~/.cursor/mcp.json` instead.
</Warning>

***

## Enable the server in Cursor

After saving the config file:

1. Open **Cursor Settings** → **MCP** (or search "MCP" in the command palette).
2. Confirm **perfai-mcp** appears in the server list with a green status indicator.
3. If it shows as disconnected, click **Restart** next to the server entry.

***

## Login

<Note>
  The prompts below run **inside Cursor's Agent chat**, not your terminal. The only terminal/file steps are creating the config file.
</Note>

In Cursor's Agent mode, type:

```
Login to Perfai
```

The server reads `PERFAI_USERNAME` / `PERFAI_PASSWORD` from the config, signs you in, and saves the session locally. Confirm with:

```
What's my Perfai auth status?
```

***

## Select an organization and app

```
List my Perfai organizations
```

```
Select organization 1
```

```
List my Perfai apps
```

```
Select the app called "payment-api"
```

***

## List issues

Findings are grouped into **security**, **design**, and **quality** categories.

```
Summarize all issues for the selected app
```

```
Show critical and high security issues
```

```
Show all design issues
```

```
Show quality issues
```

***

## Generate fixes

**By ID** (sequence number, issue ID, or description):

```
Generate a fix for security issue 14
```

**By category:**

```
Generate fixes for all design issues
```

**For all / by severity** — ask Cursor to iterate:

```
List all critical security issues, then generate a fix for each one
```
