Skip to content

Connect Claude Code

Connect Claude Code to Codex and ask it to read the outline of Salt and Signal. You need a signed-in Codex, and Claude Code installed on the machine where you work. For other clients and the full list of options, see Connect an agent.

Address: https://<your-codex>/account, in the Agent access section. The MCP server is at https://<your-codex>/mcp. On the quick start, that is http://localhost:8080/mcp.

The Account page with the Agent access section, showing Name, the Can boxes, Expires after and Create token.The Account page with the Agent access section, showing Name, the Can boxes, Expires after and Create token.

The agent signs in with a personal access token. Codex shows the token once.

  1. Open your account and find Agent access.
  2. In Name, enter Claude Code on my laptop. The name shows in the token list.
  3. Read your books stays ticked, and you cannot clear it. Reading the outline needs nothing else. Tick Edit outlines, prose and the Knowledge base only when you want the agent to change the book.
  4. Leave Expires after at 90 days, or choose another.
  5. Select Create token.
The Agent access form with the name Claude Code on my laptop, only Read ticked and 90 days chosen.The Agent access form with the name Claude Code on my laptop, only Read ticked and 90 days chosen.

Codex then shows the token, which starts with cdx_pat_, with Copy and Done buttons. Below them is a ready claude mcp add command with your address and token filled in. The Copy button copies only the token, so select the whole command and copy it by hand, then select Done. Codex keeps only a hash, so nobody can show the token again. If you lose it, revoke it and create another.

The box that shows the new token once, with the Copy button, the Done button and the claude mcp add command.The box that shows the new token once, with the Copy button, the Done button and the claude mcp add command.

Paste the command into a terminal in the folder where you run Claude Code. It looks like this, with your own address and token.

Terminal window
claude mcp add --transport http codex https://<your-codex>/mcp \
--header "Authorization: Bearer cdx_pat_<your token>"

The command stores the server for the current project only, which is Claude Code’s default scope. Add --scope user to use Codex from every project. Do not use --scope project with a real token, because it writes the token into .mcp.json, which you may commit.

Claude Code saves the configuration without checking the token. To check it, run:

Terminal window
claude mcp list

The codex server shows ✔ Connected. Inside a Claude Code session, /mcp shows the same status.

Start Claude Code and ask:

Show me the outline of Salt and Signal.

The agent calls get_outline with the book’s title, or calls list_books first to find the book. get_outline returns the acts, chapters and scenes in book order, with display numbers, titles, labels, status and word counts. In the running example, it answers with the three acts The Light, The Keepers and The Last Watch, and the chapters and scenes under them.

Compare the answer with the book. The Library is the list list_books reads, and the Plan is the outline get_outline reads.

The Library with the series card Working Coasts, which shows 2 books and the cover of Salt and Signal.The Library with the series card Working Coasts, which shows 2 books and the cover of Salt and Signal.
The Plan of Salt and Signal with the acts The Light and The Keepers and their chapters.The Plan of Salt and Signal with the acts The Light and The Keepers and their chapters.

The token acts as you, with only the access you give it. It reaches your books and the books shared with you, at your role on each one, and its ticked boxes limit what it can do there. The tool reference lists every tool, and Example prompts has more to ask.

If the token is unknown, revoked, expired or missing, or its user is disabled, Codex answers HTTP 401 with this message:

Send a Codex personal access token: Authorization: Bearer cdx_pat_…. Create one under Account → Agent access.

Claude Code does not offer to sign in, because you set the Authorization header yourself. claude mcp list shows ✘ Failed to connect, and /mcp shows the HTTP status, such as 401, in the failure detail. Check these in order.

  1. The token is the one Codex showed, with all of its characters, and the header reads Authorization: Bearer cdx_pat_....
  2. The token is still in the list under Agent access and has not expired. If not, create a new one.
  3. The address ends in /mcp and points at your Codex.

To replace the token, run claude mcp remove codex, then add the server again with the new one. A tool call that fails with forbidden is a different problem. The token lacks a scope, or your role on the book is too low. Tokens and scopes covers both.