# cortex-mcp

Connect your AI assistant to **Cortex** — your org's projects, recent activity, gaps, and directives, scoped to exactly what you're permitted to see.

## Setup

1. Get your personal token from the Cortex console → **Connect your AI**.
2. Add this to your Claude Code config (`~/.claude.json`, under `mcpServers`):

```json
{
  "mcpServers": {
    "cortex": {
      "command": "npx",
      "args": ["-y", "@theronap/cortex-mcp"],
      "env": { "CORTEX_TOKEN": "your-personal-token" }
    }
  }
}
```

3. Restart Claude Code. Your AI now sees your org context automatically, the managed startup skill
   will prefer query-centered `session_context` on substantive session opens, and each session start
   will log the exact baseline Cortex context to `~/.cortex/context-snapshots/`.

No clone, no path, no build step — `npx` fetches and runs it.

## Tools

- **my_context** — your projects, recent activity, gaps, and directives.
- **session_context** — opening-query-centered context seeded from the most relevant node and its neighborhood.
- **search_org** — search your visible activity and projects by keyword.
- **project_status** — status of a specific project by key.

## Startup snapshots

Every Claude session start runs `snapshot-context`, which fetches the exact `my_context` payload and writes:
- `~/.cortex/context-snapshots/latest.md`
- `~/.cortex/context-snapshots/<timestamp>.md`
- `~/.cortex/context-snapshots/index.jsonl`

## Environment

| Var | Required | Default |
|-----|----------|---------|
| `CORTEX_TOKEN` | yes | — |
| `CORTEX_URL` | no | `https://cortex-console.vercel.app` |
