Connect Codex to Metorial
Add Metorial to the Codex CLI, IDE extension, and ChatGPT desktop app with two commands, sign in with OAuth, and limit tools in config.toml.
To connect Codex to Metorial, run codex mcp add metorial --url <your-magic-mcp-url>, then codex mcp login metorial to sign in with your company account. The Codex CLI, IDE extension, and ChatGPT desktop app share this configuration, so one setup covers all three. Each person signs in as themselves and reaches only the integrations and tools their Metorial groups allow.
What you'll learn
- How to add Metorial to Codex and sign in
- How to share the config and limit which tools Codex sees
- How to fix timeouts and missing tools
Before you start
- A portal with SSO and the integrations people need
- The Codex CLI, IDE extension, or ChatGPT desktop app
Connect Codex
Copy the Magic MCP URL
Open your company's Metorial portal, sign in, and copy the URL from the Magic MCP URL card on the home page.
Add the server and sign in
codex mcp login opens a browser for the OAuth sign-in. In a terminal without a browser, add --no-browser, open the printed URL elsewhere, and paste the full redirect URL back into the terminal. Metorial asks which integrations Codex may use and which tools to allow for each.
Check the connection
Type /mcp in Codex to see Metorial and its tools. codex mcp list shows every configured server.
Share the configuration
The commands above write a [mcp_servers.metorial] table to ~/.codex/config.toml. You can also put it in a project-scoped .codex/config.toml so everyone working in the repository gets it:
The file holds no secret. Each person still runs codex mcp login metorial once to sign in.
On ChatGPT Business and Enterprise, admins can also manage Codex defaults centrally through OpenAI's managed configuration.
Limit what Codex can do
Codex has per-server settings in config.toml:
| Setting | What it does |
|---|---|
enabled_tools | Allow list of tools Codex sees from Metorial |
disabled_tools | Deny list, applied after enabled_tools |
default_tools_approval_mode | auto, prompt, writes, or approve; writes prompts only for tools not marked read-only |
tools.<tool>.approval_mode | Approval override for a single tool |
startup_timeout_sec | How long Codex waits for the server to start; default 10 seconds |
tool_timeout_sec | How long a tool call may run; default 60 seconds |
These settings live on each machine. For limits that apply to everyone, set tool filters in Metorial: a team whose integrations reject Write Tools and Destructive Tools never receives those tools in Codex or any other client.
Troubleshooting
Metorial is listed but tools are missing
Codex can connect without credentials and then see nothing. Run codex mcp login metorial to complete the OAuth sign-in. If tools are still missing, check the person's groups in Metorial and the integrations they selected at sign-in.
Metorial times out at startup
Codex waits 10 seconds by default. Raise startup_timeout_sec under [mcp_servers.metorial] in ~/.codex/config.toml.
Long tool calls fail after a minute
The default tool timeout is 60 seconds. Raise tool_timeout_sec for the metorial server in config.toml.
The browser sign-in does not complete
The portal only accepts OAuth redirects that match its allowed patterns. In the portal's Settings, open Client Settings and check Allowed OAuth Redirects. Local callbacks need Localhost apps (http://localhost:*/*).
FAQ
Does one Codex setup cover the CLI, IDE extension, and desktop app?
Yes. They share the same Codex configuration, so adding Metorial once makes it available in all three.
Do we put API keys in config.toml?
No. The config only holds the Magic MCP URL. People sign in with codex mcp login, and Metorial uses each person's own connected accounts for tool calls.
Can Codex skip approval for read-only tools only?
Codex's writes approval mode prompts only for tools that are not marked read-only. Pair it with Metorial tool filters so write and destructive tools are removed for teams that should not have them.
Is ChatGPT setup the same as Codex setup?
No. ChatGPT web adds Metorial as a custom MCP server plugin, while Codex reads config.toml. See Connect ChatGPT.