Codex
Add SealGate to the Codex CLI with `codex mcp add`, using an API key bearer token or OAuth sign-in.
Codex (OpenAI's coding agent CLI) connects to SealGate as a remote MCP server with codex mcp add.
The SealGate desktop client configures Codex for you. Use this page if you don't run the desktop client, or want to set it up by hand.
Prerequisites
- Codex CLI installed (
codex --versionworks in your terminal). - A SealGate account at dashboard.sealgate.ai.
1. Add SealGate
In the dashboard, open Settings > Api key / MCP URL > Get MCP URL and pick Codex. You get a ready-to-run command:
export SEALGATE_API_KEY=<your-api-key>
codex mcp add sealgate --url 'https://mcp.sealgate.ai/mcp?client=codex' --bearer-token-env-var SEALGATE_API_KEYCodex sends the key as an Authorization: Bearer header. Keep SEALGATE_API_KEY set in the shell you start Codex from (for example, in your shell's rc file). No browser is needed, so this suits headless and CI use.
On the Connect Agent page, choose Codex and set Authentication to OAuth. Run the command it shows, then authorize in the browser:
codex mcp add sealgate --url 'https://mcp.sealgate.ai/mcp?client=codex'
codex mcp login sealgateDon't give Codex the key-in-URL form (/mcp/<your-api-key>/). Codex starts an OAuth login it can't skip and hangs on it. Use one of the two setups above.
The host differs per environment, so always copy the command from your own dashboard.
2. Verify
Run codex mcp list and check that sealgate is listed. Then ask Codex:
Call the sealgate builtin_whoami tool to confirm your connection to the SealGate gateway.The call appears under Sessions in the dashboard.
Troubleshooting
- 401 Unauthorized (API key):
SEALGATE_API_KEYis unset in this shell, or the key was rotated. sealgatealready exists: runcodex mcp remove sealgate, then add it again.- Login hangs: you used the key-in-URL form. Remove the server and use a setup above.