ChatGPT desktop / Codex MCP setup

Connect ChatGPT desktop or Codex to Modeledge with shared Codex configuration and an environment-backed API key.

Before you start

The macOS desktop application is named ChatGPT and includes Codex. You do not necessarily need a separate Codex download, but the bundled codex command may not be on your normal Terminal PATH.

Generate a Modeledge MCP API key from your account page. Keep the raw key out of config.toml, repositories, and shell history.

Connection details

Server name
modeledge
Server URL
https://mcp.modeledge.ai/mcp
Transport
streamable HTTP or HTTP MCP
Auth header
Authorization: Bearer <API key>
Key source
Modeledge account page

Steps

  1. Generate a Modeledge MCP API key from your account page.
  2. Add Modeledge and tell Codex which environment variable contains the bearer token.
  3. Make the key available to the Codex CLI or ChatGPT desktop process.
  4. Fully restart ChatGPT or start a new Codex session.
  5. Use /mcp, then make a small Modeledge request to verify both loading and authentication.

Add the server

Run this in Terminal. The bearer-token option records only the environment variable name in Codex config; it does not store your Modeledge key.

Command
codex mcp add modeledge \
  --url https://mcp.modeledge.ai/mcp \
  --bearer-token-env-var MODELEDGE_API_KEY

If Terminal reports codex: command not found and you already have ChatGPT installed in /Applications, try the bundled executable below. This application-internal path may change in a future release.

macOS ChatGPT fallback
/Applications/ChatGPT.app/Contents/Resources/codex mcp add modeledge \
  --url https://mcp.modeledge.ai/mcp \
  --bearer-token-env-var MODELEDGE_API_KEY

Make the token available

For Codex running in the same Terminal session, export the key before starting Codex:

Terminal or CLI
export MODELEDGE_API_KEY="YOUR_MODELEDGE_API_KEY"

An application already launched from Finder or the Dock does not inherit a later Terminal export. For ChatGPT desktop on macOS, the following prompts for the key without putting it in shell history and makes it available to applications in the current login session:

macOS desktop
read -s "MODELEDGE_API_KEY?Modeledge API key: "; echo
launchctl setenv MODELEDGE_API_KEY "$MODELEDGE_API_KEY"
unset MODELEDGE_API_KEY

After setting the variable, fully quit ChatGPT with Command-Q and reopen it. Closing only the window is not sufficient. The launchctl value lasts until you log out or restart your Mac.

What the command changes

Codex writes user-level MCP configuration to ~/.codex/config.toml. ChatGPT desktop, the Codex CLI, and the IDE extension share this local file; ChatGPT web does not read it.

The resulting entry should look like this:

config.toml
[mcp_servers.modeledge]
url = "https://mcp.modeledge.ai/mcp"
bearer_token_env_var = "MODELEDGE_API_KEY"

Restart and verify

  1. Fully quit and reopen ChatGPT, or start a new Codex CLI session.
  2. Enter /mcp and confirm that modeledge appears without an environment-variable or authentication error.
  3. Ask: Use Modeledge to find NVIDIA.
  4. Confirm the result includes ticker NVDA and CIK 1045810. A successful tool call verifies both the connection and the API key.

Troubleshooting

  • codex: command not found — use the bundled ChatGPT path above or install the standalone Codex CLI.
  • MODELEDGE_API_KEY is not set — the desktop app did not inherit the variable. Use the macOS desktop steps, then fully quit and reopen ChatGPT.
  • Modeledge appears but requests fail — regenerate the API key, set the variable again, and restart the client.
  • The config changed but the server is absent — restart the client and create a new task so it reloads MCP configuration.
  • It works locally but not in ChatGPT web — local ~/.codex/config.toml applies to ChatGPT desktop, Codex CLI, and the IDE extension, not ChatGPT web.