Connect Codex
These steps work for the Codex CLI, the Codex IDE extension and the ChatGPT desktop app, because they share ~/.codex/config.toml. See the Codex MCP documentation for more options.
Option 1: installation token
Section titled “Option 1: installation token”-
Store the token in an environment variable that Codex can read. Codex stores only the variable name, not the token.
Terminal window # Add this line to your shell profileexport INSIDE_GATEWAY_TOKEN="igw_live_..."Terminal window # Persists for new terminals[Environment]::SetEnvironmentVariable("INSIDE_GATEWAY_TOKEN", "igw_live_...", "User") -
Add the server.
Terminal window codex mcp add inside-gateway --url https://api.inside.chat/mcp --bearer-token-env-var INSIDE_GATEWAY_TOKENOr edit
~/.codex/config.tomldirectly. You can also use a project’s.codex/config.toml, for trusted projects only:[mcp_servers.inside-gateway]url = "https://api.inside.chat/mcp"bearer_token_env_var = "INSIDE_GATEWAY_TOKEN"# Ask before any tool that isn't marked read-only.default_tools_approval_mode = "writes"startup_timeout_sec = 20tool_timeout_sec = 60 -
Restart Codex, or your editor for the IDE extension, so it picks up the new environment variable.
-
Check the connection. Run
codex mcp list, or type/mcpin the Codex terminal UI.
Option 2: short-lived OAuth tokens
Section titled “Option 2: short-lived OAuth tokens”Codex can run a local command to produce request headers, and runs it again when the server returns 401. Gateway OAuth tokens expire after 15 minutes, so Codex fetches a new one automatically.
-
Save the helper script
inside-gateway-mcp-headers.mjssomewhere stable, for example~/.codex/inside-gateway-mcp-headers.mjs. It needs Node.js 18 or later. -
Set the credential variables. Set
INSIDE_CLIENT_IDto the credential ID andINSIDE_CLIENT_SECRETto the credential’s token. Optionally setINSIDE_SCOPES, for example"website_read conversation_read", to request fewer scopes. -
Configure the server without
bearer_token_env_var, because a configured bearer token takes precedence over helper headers:[mcp_servers.inside-gateway]url = "https://api.inside.chat/mcp"http_headers_helper = "node /Users/me/.codex/inside-gateway-mcp-headers.mjs"default_tools_approval_mode = "writes"Use an absolute path. If the path contains spaces, wrap the command in a small shell or batch script and point
http_headers_helperat that script.
The helper prints a single JSON object such as {"Authorization":"Bearer igw_live_..."} and never writes the secret anywhere.
Try it
Section titled “Try it”Ask Codex:
Use the inside-gateway MCP server. Call
gateway_context, read theoverviewguide, then list my websites and the capabilities for the first one.
Keep a human in the loop
Section titled “Keep a human in the loop”default_tools_approval_mode = "writes"asks before any tool that isn’t marked read-only.- List write tools in
disabled_toolsto hide them completely. - Or simply don’t grant write scopes. See writes from agents.