# Codex CLI

First written 2 June 2026, revised 6 October 2026.

Add ~alter to OpenAI Codex CLI's MCP configuration, then query identity from the terminal. Anonymous tools work with no account; connect via OAuth to reach the authenticated tools.

## Connection

| Endpoint | `https://mcp.truealter.com/api/v1/mcp` |
| Transport | Streamable HTTP (JSON-RPC 2.0 over POST) |
| Auth header | Authorization: Bearer <capability_token> (omit for anonymous tools; the token is issued when you sign in, see Authentication) |
| Config | ~/.codex/config.toml |

## Setup

### 1Add the server

Codex reads MCP servers from config.toml. Point it at the endpoint and pass the OAuth-bearer capability token in the auth header. The capability token is issued when you approve the OAuth sign-in; `alter login` signs you in and keeps one for you.

```
[mcp_servers.alter]
url = "https://mcp.truealter.com/api/v1/mcp"
http_headers = { "Authorization" = "Bearer <capability_token>" }

```
### 2Keep the token out of the file (recommended)

bearer_token_env_var reads the token from a named environment variable at runtime and adds the Authorization: Bearer header for you, so the capability token never lives in config.toml and you never type the word "Bearer" yourself.

```
[mcp_servers.alter]
url = "https://mcp.truealter.com/api/v1/mcp"
bearer_token_env_var = "ALTER_CAPABILITY_TOKEN"

```
## Verify

Start Codex and list its tools. ~alter's tools appear alongside the rest once the server connects.

## Notes

- -Omit the header keys entirely to use only the anonymous tools.

- -Keep the server name tilde-free. The name here is alter (no wave); the client turns it into the tool prefix, and a tilde is not a legal character there, so the tools would show but never run. Use letters, numbers, hyphens or underscores only.

- -The MCP config itself needs no extra account tier, but the Codex CLI requires a ChatGPT sign-in or an OpenAI API key to run at all.

- -Codex connects to the Streamable HTTP endpoint directly by url; no stdio bridge is needed.

[MCP server reference](https://truealter.com/docs/mcp)[Tools reference](https://truealter.com/docs/mcp/tools)[Connect via OAuth](https://truealter.com/docs/authentication)[Codex MCP docs ↗](https://developers.openai.com/codex/mcp)

https://truealter.com/docs/clients/codex
