Codex CLI

Codex CLI configures MCP servers in TOML rather than JSON, which changes the quoting rules.

Add it

Edit ~/.codex/config.toml:

[mcp_servers.vulnetix]
url = "https://mcp.vulnetix.com/mcp"

[mcp_servers.vulnetix.http_headers]
Authorization = "ApiKey <orgId>:<hex>"

Then confirm Codex parsed it:

codex mcp get vulnetix
vulnetix
  enabled: true
  transport: streamable_http
  url: https://mcp.vulnetix.com/mcp
  http_headers: Authorization=*****
Warning

codex mcp add cannot express this credential. The subcommand takes --bearer-token-env-var and nothing else for auth, which always emits Authorization: Bearer <token>. A Vulnetix API key is ApiKey <orgId>:<hex>, a different scheme, so it has to go through http_headers in the file. Verified against Codex CLI 0.146.0, where codex mcp add --header exits with unexpected argument '--header' found.

Use codex mcp add only if you hold an Authentik API token or a vdb_token session JWT, both of which are genuine Bearer credentials.

Note The table name is mcp_servers with an underscore. This is TOML, not the mcpServers of the JSON clients. Headers go in their own sub-table, and every value must be double-quoted. The inline form http_headers = { Authorization = "..." } works too.

Confirm it works

codex

Then:

Look up CVE-2021-44228 and summarise the remediation deadline.

Worth knowing

Command name drift. The codex mcp subcommand has changed shape across releases, and its auth flags have never covered the ApiKey scheme. Edit config.toml directly: the file format has been stabler than the CLI surface.

Sandbox and approvals. Codex’s sandbox governs shell and filesystem access, not MCP calls, but its approval policy can still prompt before a tool runs.

Environment variables. If you use ${VAR} in config.toml, confirm your Codex version expands them; several do not, in which case use a literal value in this user-scoped file (which is outside any repository).

Troubleshooting

Server not found. Check mcp_servers (underscore) and that the header table is [mcp_servers.vulnetix.http_headers]. codex mcp get vulnetix prints the parsed entry, so if it shows http_headers: - the table name is wrong.

TOML parse error. Every string needs double quotes, including the header value with its embedded colon.

401 in results. Both halves of the key.