> ## 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.

# Zed

> Install and use the Perfai MCP server in the Zed editor via context_servers in settings.json.

Zed supports MCP servers through its `context_servers` setting. Configuration is global — Zed does not currently support per-project MCP config files.

<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>

***

## Installation

In Zed, `PERFAI_USERNAME` / `PERFAI_PASSWORD` go in an `env` object **inside** the `command` block.

<Tabs>
  <Tab title="macOS">
    File: `~/.config/zed/settings.json`

    Add (or merge) the following into your existing settings:

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

  <Tab title="Linux">
    File: `~/.config/zed/settings.json`

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

  <Tab title="Windows">
    File: `%APPDATA%\Zed\settings.json`

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

<Note>
  Zed's `context_servers` format uses a nested `command` object with `path`, `args`, and `env` — this differs from the flat `command` / `args` format used by Cursor and Claude Code.
</Note>

<Warning>
  `settings.json` holds your credentials in plaintext — keep it private.
</Warning>

***

## Open settings in Zed

You can open `settings.json` directly from Zed:

1. Press `Cmd+,` (macOS) or `Ctrl+,` (Linux/Windows).
2. Click **Open settings.json** in the top-right corner of the settings panel.
3. Add the `context_servers` block and save.

Zed picks up the change immediately — no restart required.

***

## Verify the server is connected

1. Open the **AI panel** in Zed (click the AI icon or press `Cmd+?`).
2. Look for **perfai-mcp** in the context server list.
3. A green dot means it's running. If it shows red, check that Node.js 18+ is installed and `npx` is on your PATH.

***

## Login

<Note>
  The prompts below run **inside Zed's AI assistant panel**, not your terminal. The only terminal/file steps are editing `settings.json`.
</Note>

In Zed's AI assistant, 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 "api-gateway"
```

***

## 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 5
```

**By category:**

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

**For all / by severity** — ask the assistant to iterate:

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