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

# Connect Claude Code

> Give the command-line agent a memory of your project

Claude Code is Anthropic's command-line agent. Connecting it to Cortex means it can search your knowledge and file new findings as it works, so what one coding session learns is there for the next.

## What you need

* A Cortex account.
* Claude Code installed and working in a project.

<Steps>
  <Step title="Get the connection config">
    In Cortex, open any brain's **Connect** page and choose the **Claude Code** tab. It shows a small block of JSON with your workspace's URL already filled in:

    ```json theme={null}
    {
      "mcpServers": {
        "cortex": {
          "type": "http",
          "url": "https://api.oncortex.ai/t/your-workspace-id/mcp"
        }
      }
    }
    ```

    Copy it.
  </Step>

  <Step title="Add it to your project">
    Paste the block into a `.mcp.json` file in the root of your project (merge it in if the file already exists). Claude Code reads this file and offers the connection the next time it starts in that project.

    Prefer a one-liner? From the project directory you can instead run `claude mcp add --transport http cortex https://api.oncortex.ai/t/your-workspace-id/mcp`, which writes the same entry for you.
  </Step>

  <Step title="Approve the connection">
    The first time Claude Code uses the connection, it opens your browser to approve. The Cortex approval screen names the workspace and shows that the agent will act as you. Confirm, and Claude Code is connected to every brain you can access.
  </Step>

  <Step title="Use it">
    Ask Claude Code to draw on your brains:

    * *"Search Cortex for how we handle authentication."*
    * *"File a summary of what we changed today in the project brain."*
    * *"What decisions have we recorded about this project?"*
  </Step>
</Steps>

## A memory that keeps itself

The most useful pattern is to have Claude Code record its own work as it goes, so your brain fills up without you copying anything by hand. See [capturing agent conversations](/capture/agent-conversations) for how to set that up with a project hook.

## Managing the connection

The connection shows up under **Connected Agents** on the Connect page, and can be revoked there at any time. One connection covers all your brains in the workspace; only a second workspace would need a second entry in `.mcp.json`.
