Answer: Start a WebSocket listener with `codex app-server --listen ws://127.0.0.1:4500`, then connect the terminal UI with `codex --remote ws://127.0.0.1:4500`. For non-local connections, configure WebSocket authentication and put the connection behind TLS, passing the bearer token via an environment variable name with `--remote-auth-token-env`. Status: Confirmed Entry: tool/codex/integrations/connect-cli-to-remote-app-server Revision: 2 Digest: sha256:93a028202db65b4b (changes whenever the content changes) Timeline: Created: 2026-11-13T03:47:25Z Last changed: 2026-11-20T13:35:00Z (remote auth token env option: — → --remote-auth-token-env CODEX_REMOTE_TOKEN) Last verified: 2026-11-20T13:35:00Z Next check: 2026-11-21T13:35:00Z Check interval: Daily Expected change: No fixed schedule Data: Field | Value | Source | As of start listener command | codex app-server --listen ws://127.0.0.1:4500 | [1] | 2026-11-20 connect command | codex --remote ws://127.0.0.1:4500 | [1] | 2026-11-20 remote auth token env option | --remote-auth-token-env CODEX_REMOTE_TOKEN | [1] | 2026-11-20 Sources: [1] OpenAI. "Codex App Server". https://learn.chatgpt.com/docs/app-server.md Role: primary. Accessed: 2026-11-20T13:35:00Z Quote: "codex app-server --listen ws://127.0.0.1:4500" (Supports: start listener command) Quote: "codex --remote ws://127.0.0.1:4500" (Supports: connect command) Quote: "--remote-auth-token-env CODEX_REMOTE_TOKEN" (Supports: remote auth token env option) Snapshot SHA-256: 23c30b4f68ce6dc33c604b5d738266527b69882aa7c3743cd204212cfc49566b (captured 2026-11-19T13:25:37Z) Verification: Method: Automated extraction from [1] with deepseek-flash (JSON output, thinking disabled). Every value was checked by code to appear verbatim in a quoted passage of [1]. On this check the text of [1] was unchanged since 2026-11-19T13:25:37Z, so the values verified then were kept. Cross-check: not-available at 2026-11-20T13:35:00Z. No independent second source is configured for this entry Last successful check: 2026-11-20T13:35:00Z Last attempt: 2026-11-20T13:35:00Z Notes and limitations: Extracted automatically from a single official source (section "Connect the CLI terminal UI"). Related: https://latestn.com/tool/codex/integrations/connect-codex-mcp-config-toml How do I connect Codex to an MCP server using config.toml? https://latestn.com/tool/codex/integrations/connect-codex-to-mcp-tools How do I connect Codex to external MCP tools? https://latestn.com/tool/codex/integrations/customize-codex-review-rules How do I customize what Codex reviews using AGENTS.md rules? https://latestn.com/tool/codex/integrations/codex-environment-repo-selection How does Codex choose which environment and repo to use for a Linear issue? https://latestn.com/tool/codex/integrations/configure-codex-exec How do I configure `codex exec` options in the Codex GitHub Action? https://latestn.com/tool/codex/integrations/configure-mcp-tool-hook How do I configure an MCP tool hook in Codex? https://latestn.com/tool/ All entries in AI tools Change log: Time | Event | Change | Source 2026-11-20T13:35:00Z | changed | remote auth token env option: — → --remote-auth-token-env CODEX_REMOTE_TOKEN | [1] 2026-11-20T13:35:00Z | changed | connect command: — → codex --remote ws://127.0.0.1:4500 | [1] 2026-11-20T13:35:00Z | changed | start listener command: — → codex app-server --listen ws://127.0.0.1:4500 | [1] 2026-11-20T13:35:00Z | changed | Accepted endpoint schemes: ws:// → — | [1] 2026-11-20T13:35:00Z | changed | Token environment variable: CODEX_REMOTE_TOKEN → — | [1] 2026-11-20T13:35:00Z | changed | Remote connection command with auth: codex --remote wss://remote-host:4500 \ --remote-auth-token-env CODEX_REMOTE_TOKEN → — | [1] 2026-11-20T13:35:00Z | changed | Connect terminal UI command: codex --remote ws://127.0.0.1:4500 → — | [1] 2026-11-20T13:35:00Z | changed | Start listener command: codex app-server --listen ws://127.0.0.1:4500 → — | [1] 2026-11-13T03:47:25Z | added | Entry created | — Changes for this entry as a feed: https://latestn.com/tool/codex/integrations/connect-cli-to-remote-app-server/latest Challenge this entry: Open challenges: 2 (oldest received 2026-11-17T18:40:43Z) How: If a value here is wrong or out of date, send what is wrong and a link to evidence. Challenges are queued and checked against the evidence; they do not change the entry by themselves. If the entry changes as a result, the change log says so. Form: https://latestn.com/dispute/tool/codex/integrations/connect-cli-to-remote-app-server POST: https://latestn.com/dispute/tool/codex/integrations/connect-cli-to-remote-app-server with claim, evidence_url, and optionally field and contact (form-encoded or JSON) GET: https://latestn.com/dispute/tool/codex/integrations/connect-cli-to-remote-app-server?claim={what is wrong}&evidence_url={link} How to cite: LatestN. (2026). How do I connect the Codex CLI terminal UI to a remote Codex app-server? Revision 2, last verified 2026-11-20T13:35:00Z. https://latestn.com/tool/codex/integrations/connect-cli-to-remote-app-server (accessed 2026-11-21T09:54:20Z). @misc{LatestN_tool_codex_integrations_connect_cli_to_remote_app_server_r2, title = {How do I connect the Codex CLI terminal UI to a remote Codex app-server?}, author = {{LatestN}}, year = {2026}, howpublished = {\url{https://latestn.com/tool/codex/integrations/connect-cli-to-remote-app-server}}, note = {Revision 2; digest sha256:93a028202db65b4b; last verified 2026-11-20T13:35:00Z; accessed 2026-11-21T09:54:20Z} } Reuse: License: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/) Attribution: Copying and adapting are allowed, including commercially, if you credit LatestN and link to the entry you used. Each entry ends with a ready-made citation. URL: https://latestn.com/tool/codex/integrations/connect-cli-to-remote-app-server