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

# Cursor

> Add Aegis governance to Cursor by adding an MCP server entry to ~/.cursor/mcp.json. Agent actions are logged and policy-checked from the first tool call.

Connecting Cursor to Aegis routes every MCP tool call, pushing commits, creating branches, merging pull requests, through Aegis for policy evaluation and logging. The integration uses the MCP SSE transport. You add a single config entry, restart Cursor, and governance begins.

## Prerequisites

Before you connect Cursor, make sure you have:

* An Aegis account at [app.runaegis.co](https://app.runaegis.co)
* GitHub connected in **Settings → GitHub**
* At least one room created in **Rooms**, you need the room ID and access token from that room

<Note>
  Your user ID is in **Settings → Profile**. You will need it when filling in the config below.
</Note>

## Config file location

Cursor reads MCP configuration from one of two locations:

| Scope           | Path                 | When to use                                        |
| --------------- | -------------------- | -------------------------------------------------- |
| User-level      | `~/.cursor/mcp.json` | Apply Aegis to all Cursor sessions on this machine |
| Workspace-level | `.cursor/mcp.json`   | Apply Aegis to a single project                    |

## Setup

<Steps>
  <Step title="Open or create your MCP config file">
    For user-level scope, open `~/.cursor/mcp.json`. For workspace-level scope, create a `.cursor/` folder in your project root and open `.cursor/mcp.json` inside it. If the file does not exist yet, create it.
  </Step>

  <Step title="Paste the config">
    Copy the snippet below, replace the four placeholder values with your actual credentials, and save the file.

    ```json ~/.cursor/mcp.json theme={null}
    {
      "mcpServers": {
        "aegis_dep": {
          "transport": "sse",
          "url": "https://app.runaegis.co/sse?user_id=<USER_ID>&room_id=<ROOM_ID>&access_token=<ACCESS_TOKEN>&role=<ROLE>"
        }
      }
    }
    ```

    Replace each placeholder:

    | Placeholder      | Value                                                 |
    | ---------------- | ----------------------------------------------------- |
    | `<USER_ID>`      | Your Aegis user ID, find it in **Settings → Profile** |
    | `<ROOM_ID>`      | The room ID from the room detail page                 |
    | `<ACCESS_TOKEN>` | The access token from the room detail page            |
    | `<ROLE>`         | `DEVELOPER`, `ADMIN`, or `OWNER`                      |
  </Step>

  <Step title="Restart Cursor">
    Quit and reopen Cursor. It reads the MCP config on startup and opens a persistent SSE connection to Aegis.
  </Step>
</Steps>

## Verify the connection

After restarting, trigger any tool call in Cursor, for example, ask the agent to read a file or list repository contents. Then open the Aegis dashboard and go to **Audit Trail**. The action should appear within a few seconds. If it does not appear after a minute, double-check that all four placeholder values in the config are correct and that the room is active.

<Tip>
  If you want Aegis active for every project on your machine, use the user-level config at `~/.cursor/mcp.json`. If you only want Aegis on specific projects, use the workspace-level config and commit it to the repository.
</Tip>

<Warning>
  Keep your `access_token` private. If it is exposed, rotate it from the room detail page in the Aegis dashboard immediately.
</Warning>
