Connect Claude Code or Codex to Cortex
Search and read your Cortex sessions from Claude Code or Codex through the Cortex MCP server.
Each client needs two commands and a browser sign-in. After that, it can look up your past work while you code.
Before you begin
Required
- Cortex account
An account you can sign in to Cortex with. The client sees only what that account can see in Cortex.
- AI client
Claude Code 2.1.231 or later, or a Codex CLI whose
codex mcp addsupports--oauth-client-id. - Browser
A browser on the same computer as the client. Sign-in finishes by returning to the client on that computer.
Both clients use the server address https://ai.chaoslabs.co/ai/mcp/. Enter it exactly as shown, including the trailing slash.
Connect Claude Code
- Add the Cortex server.
--scope usermakes it available in every project:
claude mcp add --transport http --scope user --client-id cortex-claude-code cortex https://ai.chaoslabs.co/ai/mcp/- Sign in:
claude mcp login cortexYour browser opens the Cortex sign-in. Sign in as usual. Cortex shows "Connecting to Cortex…" and returns you to Claude Code. There is no separate approval screen.
Connect Codex
- Add the Cortex server:
codex mcp add cortex --url https://ai.chaoslabs.co/ai/mcp/ --oauth-client-id cortex-codex- Sign in:
codex mcp login cortexComplete the Cortex sign-in in your browser. Codex continues when it finishes. If Codex opens the sign-in after step 1, complete it there and skip step 2.
Check the connection
- Run
claude mcp listand confirmcortexshows as connected. In Codex, runcodex mcp listand confirm the Auth column forcortexreadsOAuth. - Ask your client about recent work, for example: "Find my Cortex sessions about the billing export and summarize the most recent one."
These tools look up your work:
| Tool | What it returns |
|---|---|
cortex_search_sessions | Sessions that match your query, with topic, capture time, usage, estimated spend and coverage. |
cortex_get_session | Sections of one session. Summary and usage by default; activity, topics, plans, subagents, files and artifacts on request. |
cortex_search | The same results as Search in Cortex: work, connected sources, people and teams. See Search and evidence. |
Your client may list other Cortex tools. They support Cortex diagnostics and service checks, and you do not need them to look up your work.
What the client can see
- The same visibility as your account. The client sees the sessions your visibility allows in Cortex. See Roles and visibility.
- Connected sources through Search. If Search is enabled for your organization,
cortex_searchalso returns results and excerpts from the connected apps your account can see. - Lookups only. The tools above read your work. They do not change sessions or settings.
- Summaries, not transcripts. Session results do not include raw transcripts or prompt text. File previews appear only when the client asks for them.
- Estimated spend. Cost figures are estimates, not billed amounts.
Troubleshoot sign-in
| Message in the browser | What to do |
|---|---|
| "Connection expired." | Run the login command again. Each sign-in link works once and expires after 5 minutes. |
| "Connection isn't available for this account." | Your account cannot use this connection. Ask your Cortex admin. |
| "Cortex is temporarily unavailable." | Select Retry. |
| "We couldn't complete the connection." | Select Retry. If it fails again, run the login command again. |
Sign-in lasts up to 30 days, and ends sooner after 7 days without use. When the client asks you to sign in again, or Cortex tools stop responding, run the login command again.
Disconnect
Sign out and keep the server in your client:
claude mcp logout cortex
codex mcp logout cortexRemove the server from your client:
claude mcp remove cortex
codex mcp remove cortex