Protocol
Like MCP, codex app-server supports bidirectional communication using JSON-RPC 2.0 messages (with the "jsonrpc":"2.0" header omitted on the wire).
Supported transports:
stdio(--listen stdio://, default): newline-delimited JSON (JSONL).websocket(--listen ws://IP:PORT, experimental and unsupported): one JSON-RPC message per WebSocket text frame.- Unix socket (
--listen unix://or--listen unix://PATH): WebSocket connections over Codex's default app-server control socket or a custom Unix socket path, using the standard HTTP Upgrade handshake. off(--listen off): don't expose a local transport.
When you run with --listen ws://IP:PORT, the same listener also serves basic HTTP health probes:
GET /readyzreturns200 OKonce the listener accepts new connections.GET /healthzreturns200 OKwhen the request doesn't include anOriginheader.- Requests with an
Originheader are rejected with403 Forbidden.
WebSocket transport is experimental and unsupported. Local listeners such as ws://127.0.0.1:PORT are appropriate for localhost and SSH port-forwarding workflows. Non-loopback WebSocket listeners currently allow unauthenticated connections by default during rollout, so configure WebSocket auth before exposing one remotely.
Supported WebSocket auth flags:
--ws-auth capability-token --ws-token-file /absolute/path--ws-auth capability-token --ws-token-sha256 HEX--ws-auth signed-bearer-token --ws-shared-secret-file /absolute/path
For signed bearer tokens, you can also set --ws-issuer, --ws-audience, and --ws-max-clock-skew-seconds. Clients present the credential as Authorization: Bearer <token> during the WebSocket handshake, and app-server enforces auth before JSON-RPC initialize.
Prefer --ws-token-file over passing raw bearer tokens on the command line. Use --ws-token-sha256 only when the client keeps the raw high-entropy token in a separate local secret store; the hash is only a verifier, and clients still need the original token.
In WebSocket mode, app-server uses bounded queues. When request ingress is full, the server rejects new requests with JSON-RPC error code -32001 and message "Server overloaded; retry later." Clients should retry with an exponentially increasing delay and jitter.