Skip to content
CortexDocs

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 add supports --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

  1. Add the Cortex server. --scope user makes it available in every project:
bash
claude mcp add --transport http --scope user --client-id cortex-claude-code cortex https://ai.chaoslabs.co/ai/mcp/
  1. Sign in:
bash
claude mcp login cortex

Your 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

  1. Add the Cortex server:
bash
codex mcp add cortex --url https://ai.chaoslabs.co/ai/mcp/ --oauth-client-id cortex-codex
  1. Sign in:
bash
codex mcp login cortex

Complete 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

  1. Run claude mcp list and confirm cortex shows as connected. In Codex, run codex mcp list and confirm the Auth column for cortex reads OAuth.
  2. 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:

ToolWhat it returns
cortex_search_sessionsSessions that match your query, with topic, capture time, usage, estimated spend and coverage.
cortex_get_sessionSections of one session. Summary and usage by default; activity, topics, plans, subagents, files and artifacts on request.
cortex_searchThe 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_search also 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 browserWhat 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:

bash
claude mcp logout cortex
codex mcp logout cortex

Remove the server from your client:

bash
claude mcp remove cortex
codex mcp remove cortex