# Roll Out Dtwo in Codex

Roll out your Dtwo gateway to everyone in your organization in Codex.

## Overview

This guide walks you through rolling out Dtwo to your whole organization in Codex and turning off direct connections to MCP servers. If you only want to set it up for yourself, see [Connect Codex for yourself](/docs/connect-yourself-codex).

Codex can't push an MCP server to everyone in your organization, so each person adds the gateway themselves. What admins can do is approve only the gateway, which turns off direct connections to MCP servers.

## Roll out Dtwo to your organization in Codex

Select how your gateway signs people in.

<div class="doc-tabs" data-tabs>

<div class="doc-tablist doc-tablist-cards" role="tablist" aria-label="Sign-in type">
<button type="button" role="tab" class="doc-tab" data-tab="dtwo" aria-selected="true"><img src="/favicon.svg" alt="" width="36" height="36" data-no-lightbox>Dtwo authentication</button>
<button type="button" role="tab" class="doc-tab" data-tab="entra"><img src="/logos/azure.svg" alt="" width="36" height="36" data-no-lightbox>Microsoft Entra ID</button>
<button type="button" role="tab" class="doc-tab" data-tab="okta"><img src="/logos/okta.png" alt="" width="36" height="36" data-no-lightbox>Okta</button>
</div>

<div class="doc-tabpanel" data-panel="dtwo" role="tabpanel">

<p class="doc-step">Step 1: Have everyone in your organization add the gateway</p>

Codex doesn't have a way to push an MCP server to people's machines, so each person adds the gateway themselves. Send your team these instructions, with `<GatewayName>` and `<GatewayURL>` filled in:

1. Add the gateway to `~/.codex/config.toml`. Create the file if it doesn't exist yet.

   ```toml
   [mcp_servers.<GatewayName>]
   url = "<GatewayURL>"
   ```

2. Sign in with your Dtwo account. In the Codex app, open **Settings → MCP servers** and select **Authenticate** next to the gateway. From a terminal, run `codex mcp login <GatewayName>` instead.

Replace the placeholders:

- `<GatewayName>`: the name everyone gives the server.
- `<GatewayURL>`: your gateway's MCP URL. Copy it from your gateway's **Overview** tab in the Dtwo UI. It must start with `https://`.

> **Warning:** Everyone must use exactly the same server name, and it must match the name in the requirements in the next step. Codex blocks any server whose name doesn't match, even if the URL is right.

<p class="doc-step">Step 2: Turn off direct connections to MCP servers</p>

Codex requirements are settings people can't override. You set them in the ChatGPT admin console. Adding an `mcp_servers` list that approves only the gateway makes Codex disable every other MCP server. You need to be a workspace owner, a workspace admin, or have Codex admin permissions.

1. Sign in to ChatGPT with your work account and open **Admin Console**.
2. Select **Agent security**.
3. Select **Workspace default** to apply the requirements to everyone. To start with some people first, select their policy under **Overrides** instead.
4. Open the **Requirements** card and select **Edit as TOML**. Make sure the **Global** scope is selected.
5. Add the following to the **Requirements** text. Keep any entries that are already there.

   ```toml
   [mcp_servers.<GatewayName>]
   identity = { url = "<GatewayURL>" }

   [features]
   apps = false
   ```

   Replace the placeholders:

   - `<GatewayName>`: the server name everyone uses, from the previous step.
   - `<GatewayURL>`: your gateway's MCP URL. Copy it from your gateway's **Overview** tab in the Dtwo UI. It must start with `https://`.

   What each setting does:

   - `[mcp_servers.<GatewayName>]` approves only a server with that name at your gateway's URL. Codex disables every other MCP server.
   - `apps = false` turns off ChatGPT apps and connectors in Codex.

6. Fix any validation messages, then select **Save changes**.

The requirements apply to everyone who signs in to Codex with their work ChatGPT account.

MCP servers that come bundled in Codex plugins are approved separately, under `plugins.<plugin>.mcp_servers.<server>`. See OpenAI's [managed configuration guide](https://learn.chatgpt.com/docs/enterprise/managed-configuration) for details.

<p class="doc-step">Step 3: Check the rollout</p>

1. Start a new task in Codex and run `/mcp`. Your gateway is listed with its tools.
2. Ask Codex which tools it has through your gateway. It should list the tools from the MCP servers behind your gateway.
3. If you turned off other servers, run `/debug-config`. It shows the requirements in effect, including the `mcp_servers` list.

</div>

<div class="doc-tabpanel" data-panel="entra" role="tabpanel">

<p class="doc-step">Step 1: Get Codex's client ID from Microsoft Entra ID</p>

If you've already registered Codex as an app in Microsoft Entra ID, go to **App registrations**, open the Codex app, and copy the **Application (client) ID** from its **Overview** page. This is your `<ClientId>`.

If you haven't registered Codex in Microsoft Entra ID yet, follow [Register Codex in Microsoft Entra ID](/docs/register-codex-entra), then come back here.

<p class="doc-step">Step 2: Have everyone in your organization add the gateway</p>

Codex doesn't have a way to push an MCP server to people's machines, so each person adds the gateway themselves by following [Connect Codex for yourself](/docs/connect-yourself-codex). Share that page with your team, along with these four values, since most people can't look them up in your identity provider or the Dtwo UI themselves:

- **Client ID:** the client ID from Step 1.
- **Gateway name:** the name everyone gives the server.
- **Gateway URL:** your gateway's MCP URL. Copy it from your gateway's **Overview** tab in the Dtwo UI.
- **Callback port:** the port in the redirect URI you registered for Codex. If you followed the registration steps in these docs, it's `33419`.

> **Warning:** Everyone must use exactly the same server name, and it must match the name in the requirements in the next step. Codex blocks any server whose name doesn't match, even if the URL is right.

<p class="doc-step">Step 3: Turn off direct connections to MCP servers</p>

Codex requirements are settings people can't override. You set them in the ChatGPT admin console. Adding an `mcp_servers` list that approves only the gateway makes Codex disable every other MCP server. You need to be a workspace owner, a workspace admin, or have Codex admin permissions.

1. Sign in to ChatGPT with your work account and open **Admin Console**.
2. Select **Agent security**.
3. Select **Workspace default** to apply the requirements to everyone. To start with some people first, select their policy under **Overrides** instead.
4. Open the **Requirements** card and select **Edit as TOML**. Make sure the **Global** scope is selected.
5. Add the following to the **Requirements** text. Keep any entries that are already there.

   ```toml
   [mcp_servers.<GatewayName>]
   identity = { url = "<GatewayURL>" }

   [features]
   apps = false
   ```

   Replace the placeholders:

   - `<GatewayName>`: the server name everyone uses, from the previous step.
   - `<GatewayURL>`: your gateway's MCP URL. Copy it from your gateway's **Overview** tab in the Dtwo UI. It must start with `https://`.

   What each setting does:

   - `[mcp_servers.<GatewayName>]` approves only a server with that name at your gateway's URL. Codex disables every other MCP server.
   - `apps = false` turns off ChatGPT apps and connectors in Codex.

6. Fix any validation messages, then select **Save changes**.

The requirements apply to everyone who signs in to Codex with their work ChatGPT account.

MCP servers that come bundled in Codex plugins are approved separately, under `plugins.<plugin>.mcp_servers.<server>`. See OpenAI's [managed configuration guide](https://learn.chatgpt.com/docs/enterprise/managed-configuration) for details.

<p class="doc-step">Step 4: Check the rollout</p>

1. Start a new task in Codex and run `/mcp`. Your gateway is listed with its tools.
2. Ask Codex which tools it has through your gateway. It should list the tools from the MCP servers behind your gateway.
3. If you turned off other servers, run `/debug-config`. It shows the requirements in effect, including the `mcp_servers` list.

</div>

<div class="doc-tabpanel" data-panel="okta" role="tabpanel">

<p class="doc-step">Step 1: Get Codex's client ID from Okta</p>

If you've already registered Codex as an app in Okta, go to **Applications and Resources → Applications**, open the Codex app integration, and copy the **Client ID** from its **General** tab. This is your `<ClientId>`.

If you haven't registered Codex in Okta yet, follow [Register Codex in Okta](/docs/register-codex-okta), then come back here.

<p class="doc-step">Step 2: Have everyone in your organization add the gateway</p>

Codex doesn't have a way to push an MCP server to people's machines, so each person adds the gateway themselves by following [Connect Codex for yourself](/docs/connect-yourself-codex). Share that page with your team, along with these four values, since most people can't look them up in your identity provider or the Dtwo UI themselves:

- **Client ID:** the client ID from Step 1.
- **Gateway name:** the name everyone gives the server.
- **Gateway URL:** your gateway's MCP URL. Copy it from your gateway's **Overview** tab in the Dtwo UI.
- **Callback port:** the port in the redirect URI you registered for Codex. If you followed the registration steps in these docs, it's `33419`.

> **Warning:** Everyone must use exactly the same server name, and it must match the name in the requirements in the next step. Codex blocks any server whose name doesn't match, even if the URL is right.

<p class="doc-step">Step 3: Turn off direct connections to MCP servers</p>

Codex requirements are settings people can't override. You set them in the ChatGPT admin console. Adding an `mcp_servers` list that approves only the gateway makes Codex disable every other MCP server. You need to be a workspace owner, a workspace admin, or have Codex admin permissions.

1. Sign in to ChatGPT with your work account and open **Admin Console**.
2. Select **Agent security**.
3. Select **Workspace default** to apply the requirements to everyone. To start with some people first, select their policy under **Overrides** instead.
4. Open the **Requirements** card and select **Edit as TOML**. Make sure the **Global** scope is selected.
5. Add the following to the **Requirements** text. Keep any entries that are already there.

   ```toml
   [mcp_servers.<GatewayName>]
   identity = { url = "<GatewayURL>" }

   [features]
   apps = false
   ```

   Replace the placeholders:

   - `<GatewayName>`: the server name everyone uses, from the previous step.
   - `<GatewayURL>`: your gateway's MCP URL. Copy it from your gateway's **Overview** tab in the Dtwo UI. It must start with `https://`.

   What each setting does:

   - `[mcp_servers.<GatewayName>]` approves only a server with that name at your gateway's URL. Codex disables every other MCP server.
   - `apps = false` turns off ChatGPT apps and connectors in Codex.

6. Fix any validation messages, then select **Save changes**.

The requirements apply to everyone who signs in to Codex with their work ChatGPT account.

MCP servers that come bundled in Codex plugins are approved separately, under `plugins.<plugin>.mcp_servers.<server>`. See OpenAI's [managed configuration guide](https://learn.chatgpt.com/docs/enterprise/managed-configuration) for details.

<p class="doc-step">Step 4: Check the rollout</p>

1. Start a new task in Codex and run `/mcp`. Your gateway is listed with its tools.
2. Ask Codex which tools it has through your gateway. It should list the tools from the MCP servers behind your gateway.
3. If you turned off other servers, run `/debug-config`. It shows the requirements in effect, including the `mcp_servers` list.

</div>

</div>

---

Having trouble? Email [support@dtwo.ai](mailto:support@dtwo.ai).