Skip to main content
Codex connects to TrustGate as a streamable HTTP MCP server. One entry covers the Codex CLI, the ChatGPT desktop app, and the IDE extension: they share the same config.toml for a given Codex host. Copy the endpoint from the MCP consumer Connect tab:
MCP credentials are consumer credentials — OAuth, or an API key prefixed ag_. A TrustGuard collector key (tgk_…) never authenticates MCP.

Where the config lives

Each server is one [mcp_servers.<name>] table. The key is snake_case (mcp_servers, not mcpServers). url selects HTTP transport; command selects stdio. Mixing keys from both in one table is rejected. auth defaults to oauth, so the URL is the whole entry:
Then log in once:
Codex opens the browser, registers a client (CIMD or dynamic registration) against the discovery documents TrustGate publishes, and stores the tokens. TrustGate exposes /.well-known/oauth-authorization-server, /.well-known/oauth-protected-resource, and a registration endpoint, so no client ID or secret is pasted. Codex logs in against TrustGate, not against your IdP directly, so nothing has to be registered per developer. Override the callback only when the machine needs a fixed port or a non-loopback base, such as a remote devbox:
Codex appends a server-specific callback id to that base. TrustGate accepts https URLs, http loopback URLs, and private-use schemes, and rejects anything else with invalid_redirect_uri. Which IdP backs the login is a consumer setting, attached once in the console — see Okta or Entra ID.

API-key consumers

Keep the key out of the file with env_http_headers, which reads the value from the environment at connect time:
Static values, when a shared machine has no environment to read:
bearer_token_env_var also works — TrustGate accepts Authorization: Bearer ag_… alongside X-AG-API-Key and x-api-key:
Authenticating to TrustGate is separate from authenticating to the upstream servers. For a registry with OAuth (forwarded), the first call for a user without a stored credential returns a connect link; after that one authorization TrustGate vaults and refreshes the credential.

Private (Hybrid) data plane

Add the gateway slug unless the MCP host already scopes the gateway:
Combine with env_http_headers for the API key when the consumer is not OAuth.

Tool policy and limits

Which tools exist is decided in the NeuralTrust console — consumer Routing, or a role for Identity-based consumers. The keys below are Codex’s own client-side policy over that catalog.
These keys only bind this machine. Restrict tools on the consumer or role so the limit holds for every client, and attach the Per-Tool Rate Limiter policy when you need an execution ceiling on MCP tool calls.

GUI setup

Both write the same config.toml, so a server added in one client shows up in the others.

Verify

In the CLI TUI, /mcp lists active servers. Then call a tool bound to the consumer and confirm the request in TrustGate telemetry — see Metrics.

Troubleshooting