Skip to content

Remote Codex repeatedly warns about MCP authentication

Source: Troubleshooting reference

Symptom. Startup warnings reappear during ongoing work or after a client reconnect. Remote logs report failed to read OAuth tokens from keyring or refusing file fallback, even though .credentials.json exists.

Root cause. Automatic OAuth storage selection can resolve a desktop keyring that the headless app-server cannot read reliably. Runtime MCP refresh and new agent initialization surface the connection failures again. Separately, GitHub’s GH_TOKEN shell-function export is absent when an app starts the Codex binary directly. Neither condition is fixed by a longer startup timeout.

Confirm and fix. Inspect the active CODEX_HOME, server startup errors, and credential presence without printing secrets. Update dotfiles and run bash ~/dotfiles/install/codex.sh sync-config on each remote host. Linux sync selects file OAuth storage and GitHub uses its connection-time credential helper. Restart affected clients when idle. Authenticate a missing server with codex mcp login <server> using the SSH callback tunnel, then verify a read-only operation. Keep existing credential files private; do not copy rotating OAuth credentials between hosts or delete them as a reset.

An untrusted-project warning naming the legacy ~/.codex is a separate config layer warning after moving CODEX_HOME. Inspect the effective config and actual project root. Do not trust an entire home directory just to silence it. The warning does not mean that the active host-local global config was disabled.