> Documentation index: https://metorial.com/llms.txt. Every page is available as Markdown by adding .md to its URL.

# Connect Codex to Metorial
URL: https://metorial.com/docs/platform/clients/codex

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.

---

{/* VERIFY: Codex steps come from the marketing client registry (clientSetup.ts), checked against the Codex docs on 2026-10-16 and marked "pending engineering review". */}

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.

<PageIntro>
  <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
  </Learn>

  <Reading title="Before you start">
    * A [portal](/docs/platform/workforce/portals) with SSO and the integrations people need
    * The Codex CLI, IDE extension, or ChatGPT desktop app
  </Reading>
</PageIntro>

## Connect Codex [#connect-codex]

<Steps>
  <Step title="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.
  </Step>

  <Step title="Add the server and sign in">
    ```bash
    codex mcp add metorial --url <your-magic-mcp-url>
    codex mcp login metorial
    ```

    `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.
  </Step>

  <Step title="Check the connection">
    Type `/mcp` in Codex to see Metorial and its tools. `codex mcp list` shows every configured server.
  </Step>
</Steps>

## Share the configuration [#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:

```toml
[mcp_servers.metorial]
url = "<your-magic-mcp-url>"
```

The file holds no secret. Each person still runs `codex mcp login metorial` once to sign in.

{/* VERIFY: ChatGPT Business and Enterprise admins can push Codex defaults (config.toml) and requirements (requirements.toml) through managed configuration. Confirm that mcp_servers entries are supported there before recommending it for rollout. */}

On ChatGPT Business and Enterprise, admins can also manage Codex defaults centrally through OpenAI's [managed configuration](https://developers.openai.com/codex/enterprise/managed-configuration).

## Limit what Codex can do [#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                                               |

{/* VERIFY: confirm Metorial passes its read-only and destructive tool tags to clients as MCP tool annotations, so Codex's `writes` mode recognizes Metorial's read-only tools. */}

These settings live on each machine. For limits that apply to everyone, set [tool filters](/docs/platform/guides/tool-permissions) in Metorial: a team whose integrations reject **Write Tools** and **Destructive Tools** never receives those tools in Codex or any other client.

## Troubleshooting [#troubleshooting]

### Metorial is listed but tools are missing [#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 [#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 [#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-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 [#faq]

### Does one Codex setup cover the CLI, IDE extension, and desktop app? [#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? [#do-we-put-api-keys-in-configtoml]

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? [#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? [#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](/docs/platform/clients/chatgpt).

## Related pages [#related-pages]

<Cards columns="2">
  <Card title="Supported clients" icon="computer" href="/docs/platform/clients">
    Setup guides for every client Metorial supports.
  </Card>

  <Card title="Tool permissions" icon="lock" href="/docs/platform/guides/tool-permissions">
    Give teams read-only access or block destructive tools.
  </Card>

  <Card title="Audit MCP tool calls" icon="file-list-3" href="/docs/platform/guides/audit-logs">
    See every call Codex made through Metorial.
  </Card>

  <Card title="Codex on metorial.com" icon="external-link" href="https://metorial.com/agents/codex">
    How Metorial works with Codex.
  </Card>
</Cards>