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

# Claude Code

> Add Aegis governance to Claude Code by dropping an MCP config snippet into ~/.claude/mcp.json or .claude/mcp.json. Every tool call is logged and policy-checked.

Connecting Claude Code to Aegis lets you govern every tool call the agent makes, pushing code, creating branches, opening pull requests, without changing your agent setup or your repositories. Aegis connects via the Model Context Protocol (MCP) over SSE. Once the config is in place and Claude Code is restarted, governance starts automatically.

## Prerequisites

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

Claude Code reads its MCP configuration from one of two locations depending on how broadly you want Aegis to apply:

| Scope         | Path                 | When to use                                             |
| ------------- | -------------------- | ------------------------------------------------------- |
| User-level    | `~/.claude/mcp.json` | Apply Aegis to all Claude Code sessions on this machine |
| Project-level | `.claude/mcp.json`   | Apply Aegis to a single repository                      |

## Setup

<Steps>
  <Step title="Open or create your MCP config file">
    For user-level scope, open `~/.claude/mcp.json`. For project-level scope, create a `.claude/` folder in your project root and open `.claude/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 ~/.claude/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 Claude Code">
    Quit and reopen Claude Code. It will read the updated config on startup and open a persistent SSE connection to Aegis.
  </Step>
</Steps>

## Verify the connection

After restarting, ask Claude Code to perform any tool call, for example, list the files in a repository. 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 have both a user-level and a project-level config, the project-level file takes precedence for that project.
</Tip>

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