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

# VS Code Copilot

> Govern VS Code Copilot with Aegis by adding a .vscode/mcp.json config to your project. Every agent tool call is intercepted, logged, and policy-checked.

Connecting VS Code Copilot to Aegis routes every MCP tool call through Aegis for policy evaluation and logging. The integration is workspace-level: you create a single JSON file inside your project's `.vscode/` folder, restart VS Code, and governance begins. No extensions, no code changes, and no modifications to your repositories are required.

## Prerequisites

Before you connect VS Code Copilot, 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

VS Code Copilot reads MCP servers from `.vscode/mcp.json` inside your project folder. This file is workspace-scoped, so it applies only to the project it lives in. You can commit it to your repository to share the Aegis connection with your team (but keep the `access_token` out of version control, see the warning below).

## Setup

<Steps>
  <Step title="Create the .vscode folder">
    If your project does not already have a `.vscode/` folder, create one in the project root.

    ```bash theme={null}
    mkdir -p .vscode
    ```
  </Step>

  <Step title="Create mcp.json">
    Inside the `.vscode/` folder, create a file named `mcp.json`.

    ```bash theme={null}
    touch .vscode/mcp.json
    ```
  </Step>

  <Step title="Paste the config">
    Open `.vscode/mcp.json`, paste the snippet below, replace the four placeholder values with your actual credentials, and save the file.

    ```json .vscode/mcp.json theme={null}
    {
      "servers": {
        "aegis_dep": {
          "type": "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`                      |

    <Note>
      VS Code Copilot uses the `servers` key (not `mcpServers`), and the server type field is `type` (not `transport`). These are the correct field names for VS Code, do not mix them with the Cursor or Claude Code format.
    </Note>
  </Step>

  <Step title="Restart VS Code">
    Quit and reopen VS Code. Copilot will read the updated MCP config on startup and open a persistent SSE connection to Aegis.
  </Step>
</Steps>

## Verify the connection

After restarting, ask Copilot to perform any tool call, for example, read a file or describe the repository structure. 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, check that the four placeholder values in the config are correct, that the room is active, and that the file is saved at `.vscode/mcp.json` (not `.vscode/mcp.json.txt` or another extension).

<Warning>
  If you commit `.vscode/mcp.json` to your repository, make sure you remove the `access_token` value first and distribute it out-of-band (for example, via an environment variable or a secrets manager). Committing a live token exposes it to everyone with repository access.
</Warning>

<Tip>
  VS Code Copilot MCP support is workspace-scoped by design. If you want Aegis active across all your projects, you need a `.vscode/mcp.json` in each one, or use the Cursor or Claude Code integrations which support user-level config.
</Tip>
