Connecting Codex
Connect Codex to ZopNight's MCP server via Streamable HTTP transport to query your cloud infrastructure from within the Codex environment.
Connect Codex to ZopNight’s MCP server to query your cloud infrastructure from within the Codex environment.
Setup
- Open Codex
- Go to Settings
- Click MCP Servers
- Click Add Server
- Select Streamable HTTP (not STDIO)
- Fill in the fields below
- Click Save
Configuration
| Field | Value |
|---|---|
| Name | zopnight |
| Transport | Streamable HTTP |
| URL | MCP_SERVER_URL |
The settings dialog documented by OpenAI asks only for a name, a transport and the URL. If it offers no field for a custom header, use the config.toml route below, which is the documented way to supply the token.
Note
- Replace
MCP_SERVER_URLwith the Server URL shown on your Organisation Settings page, or on the Developer Settings page where you create your token. Copying it from the app means you always get the right host for your environment. - Replace
MCP_PATwith your own personal access token (it startszn_pat_). Paste it plainly, with no angle brackets around it.
Configure via config.toml
Codex also reads MCP servers from ~/.codex/config.toml, or a project-scoped .codex/config.toml, shared by the CLI, the IDE extension and the desktop app. Unlike most clients, Codex takes the name of an environment variable holding your token rather than the token itself:
[mcp_servers.zopnight]url = "MCP_SERVER_URL"bearer_token_env_var = "ZOP_MCP_TOKEN"Export the token in your shell before starting Codex — export ZOP_MCP_TOKEN=zn_pat_… — and Codex sends it as Authorization: Bearer …. This is the documented way to supply the token: the settings UI exposes only name, transport and URL. Codex also accepts an http_headers table for other static headers, and env_http_headers to read their values from the environment.
The CLI does the same thing in one line:
codex mcp add zopnight --url MCP_SERVER_URL --bearer-token-env-var ZOP_MCP_TOKENA project-scoped .codex/config.toml loads only in a project you have marked as trusted, which is a common reason a server appears to be ignored.
Verify Connection
Once configured, ask Codex:
List my organisationsIf configured correctly, it will call the list_organisations tool and show your organisations.