# Codex

Connect Codex to CMDOP over MCP. You need an agent token: create it for Codex on the Agents tab of your CMDOP page, where it is shown once. Replace `<agent-token>` with it and `<contour>` with your address.

**In short:** Server URL `https://<contour>.cmdop.ai/mcp/`, header `Authorization: Bearer <agent-token>`.

1. Copy the config.

```text
# ~/.zshrc
export CMDOP_TOKEN=<agent-token>

# ~/.codex/config.toml
[mcp_servers.cmdopv2]
url = "https://<contour>.cmdop.ai/mcp/"
bearer_token_env_var = "CMDOP_TOKEN"
default_tools_approval_mode = "approve"

```

2. Add the export line to your shell profile and the block to ~/.codex/config.toml, then restart the app.

## Check

Ask Codex to call `machines_list`. It answers with your machines. If it says `unauthorized`, the token is wrong or was revoked: create a new one.
