Skip to content

ChatGPT Codex app: CodeNavi Setup

How to connect Codex in the ChatGPT desktop app for Windows and macOS to CodeNavi. (The Codex desktop app became the ChatGPT desktop app; Codex is a view in it, next to Chat and Work.) The app and the Codex CLI share one config file and one plugin, so if you wire one, the other works too. This page covers the app-only steps: setting the token where a desktop app can read it, the app's settings screen, and the ChatGPT dialog that cannot reach CodeNavi.

Not installed yet? On Windows, install CodeNavi with Docker Desktop first, see Windows. The app then reaches the server at http://localhost:8765 with no extra network setup.

1. Add the server to config.toml

The app reads %USERPROFILE%\.codex\config.toml on Windows, ~/.codex/config.toml on macOS. Add this block. If you created the file in the app's settings, add only the lines that are missing:

[mcp_servers.codenavi]
url = "http://localhost:8765/mcp"
bearer_token_env_var = "CODENAVI_AUTH_TOKEN"
startup_timeout_sec = 30
tool_timeout_sec = 120

bearer_token_env_var takes the name of an environment variable, not the token. If you paste the token there, Codex fails at startup with "Environment variable <token> for MCP server 'codenavi' is not set."

Use the unscoped /mcp path. A scoped /mcp/<name> works only for a name that list_codebases returns.

The full block, with the read-only tools already approved so Codex does not ask on every search, is plugins/codex/mcp/config.toml.snippet in your install package. Tool approvals explains which tools it approves and why.

2. Set the token for your user

A desktop app never reads ~/.bashrc, so set the variable once for your user account. The token is the one the installer printed, also stored as CODENAVI_AUTH_TOKEN in the install folder's .env.

macOS: add it to ~/.zprofile. The app gives Codex your login shell's environment when it starts, so a Dock or Spotlight start picks it up too (tested on the ChatGPT desktop app, December 2026):

echo 'export CODENAVI_AUTH_TOKEN=$(grep "^CODENAVI_AUTH_TOKEN=" ~/codenavi/.env | cut -d= -f2-)' >> ~/.zprofile

Then quit the app with ⌘Q (closing the window keeps it running) and start it again.

Windows, in PowerShell:

setx CODENAVI_AUTH_TOKEN <token>

setx reaches only programs started after it. Quit the Codex app from the tray icon, then start it again. Closing the window leaves the app running with the old environment.

If Codex still says the variable is not set (openai/codex#41378), replace the bearer_token_env_var line with:

http_headers = { Authorization = "Bearer <token>" }

This keeps the token in plain text in config.toml, so use it only as the fallback.

3. Check it in the app

Open Settings → MCP servers: codenavi is listed. In a new thread, ask "Use CodeNavi to find where authentication is handled". The answer cites files from your index.

  • Not listed, but codex mcp list shows it? Update Codex, quit the app from the tray, and start it again. That fixed it in our Windows test.
  • The app's Add server form offers only No auth or OAuth. CodeNavi uses a static token, not OAuth. Choose No auth, save, then add bearer_token_env_var = "CODENAVI_AUTH_TOKEN" to the new [mcp_servers.codenavi] block by hand.
  • Tools missing, no error? The token variable is empty in the app's environment. Repeat step 2 and restart the app from the tray.

4. Add the plugin (optional, no CLI needed)

The codenavi Codex plugin adds the $codenavi:<name> skills (status, search, review, compliance, …) and a session-start hook.

From the app, no terminal. Open Settings → Plugins → Add marketplace, enter http://localhost:8765/plugins/codex.git (or your server's address), then install codenavi. A marketplace added from the .git URL follows your server, the same way Claude Code does. It needs Git for Windows; without Git, use the PowerShell route below.

From PowerShell. You do not need a separate Codex CLI: the app ships one, it is just not on your PATH. On Windows, in PowerShell:

$codex = Join-Path (Get-AppxPackage OpenAI.Codex).InstallLocation 'app\resources\codex.exe'
curl.exe -o codex.zip http://localhost:8765/plugins/codex.zip
Expand-Archive codex.zip -DestinationPath . -Force
& $codex plugin marketplace add "$PWD\codenavi-plugin-codex"
& $codex plugin add codenavi@codenavi

The .zip route needs no git. marketplace add http://localhost:8765/plugins/codex.git works only when Git for Windows is installed, and fails with "program not found" otherwise. The unpacked folder also holds mcp\config.toml.snippet, the full step 1 block.

Restart the app from the tray. In an app thread, $codenavi:status then reports the server and the index.

Then trust the plugin's two hooks, the session-start notice and the grep hook: open Settings → Hooks, where CodeNavi lists two hooks, and turn Trust on for both. Codex runs a hook only after you trust it. /hooks is a Codex CLI command: typed in an app thread, it goes to the model as a chat message. The hooks screen shows each hook as Unnamed hook, because Codex has no name field for hooks. It identifies them by event and by source, Plugin - codenavi@codenavi. On Windows this needs plugin 0.3.13 or later, which runs both through Windows PowerShell. The session-start notice needs nothing else. The grep hook needs Python 3.9 or later (from the Microsoft Store or python.org) and otherwise does nothing. The version is the folder name under %USERPROFILE%\.codex\plugins\cache\codenavi\codenavi\. An older plugin has only .sh hooks, which Windows cannot run: Windows asks "How do you want to open this file?" at session start, and the agent gets the script's path instead of its message. So with an older plugin, leave the hooks untrusted, or untrust both in Settings → Hooks. A plugin update that changes a hook marks it modified since last trusted: trust it again. The skills and all CodeNavi tools work without the hooks. Already have the Codex CLI? Codex CLI → Fast path does the same. Verified on Windows 11 with Codex app 26.1027 (bundled CLI 0.166). The Settings → Plugins and Settings → Hooks route was verified with Codex app 26.1117 (bundled CLI 0.171) and plugin 0.3.28.

5. Update the plugin

Your server serves the plugin version it ships, so update CodeNavi first. Then, on Windows, in PowerShell, in any folder other than your install folder:

$codex = Join-Path (Get-AppxPackage OpenAI.Codex).InstallLocation 'app\resources\codex.exe'
curl.exe -o codex.zip http://localhost:8765/plugins/codex.zip
Expand-Archive codex.zip -DestinationPath . -Force
& $codex plugin marketplace remove codenavi
& $codex plugin marketplace add "$PWD\codenavi-plugin-codex"
& $codex plugin add codenavi@codenavi

Added from the .git URL? Then & $codex plugin marketplace upgrade codenavi followed by & $codex plugin add codenavi@codenavi updates it. upgrade works only on a plugin added from the .git URL. On a plugin added from a folder or the .zip, it fails with "marketplace codenavi is not configured as a Git marketplace".

Restart the app from the tray, then trust the plugin's two hooks again in Settings → Hooks. In an app thread, $codenavi:status reports the server and the index. The new version is the folder name under %USERPROFILE%\.codex\plugins\cache\codenavi\codenavi\. These commands were verified on Windows 11 with the bundled CLI 0.166.

ChatGPT's Apps dialog is a different surface

The Apps dialog in ChatGPT asks for a server URL or tunnel ID and an icon. It connects from OpenAI's cloud, not from your machine, so it rejects a local http:// address with "Some app settings were rejected". Use config.toml for CodeNavi.

  • OpenAI Codex CLI: the connect script, usage rules in AGENTS.md, tool approvals, the sandbox.
  • Windows: install, and how to choose between Docker Desktop and Linux inside WSL.
  • Plugins: what each agent's plugin ships.