> For the complete documentation index, see [llms.txt](https://docs.allmcp.co/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.allmcp.co/documentation/connect/openai-codex.md).

# OpenAI Codex

Connect AllMCP to the OpenAI Codex CLI agent.

<a href="/pages/416edc1381c20849bc41111b02e482a722a49b94" class="button primary" data-icon="key">Get your API key</a> <a href="/pages/QJVxDLqxIz5KMCH5afbE" class="button secondary" data-icon="table-cells">Browse providers</a>

***

## Configuration

The Codex CLI reads MCP server config from `~/.codex/config.toml`. Add AllMCP under the `[mcp_servers]` section:

{% stepper %}
{% step %}

#### Open your Codex config

The Codex CLI reads MCP server config from `~/.codex/config.toml`.
{% endstep %}

{% step %}

#### Add the `allmcp` server

Add AllMCP under the `[mcp_servers]` section, replacing `YOUR_API_KEY` with your AllMCP key.

{% code title="\~/.codex/config.toml" %}

```toml
[mcp_servers.allmcp]
url = "https://go.allmcp.co/mcp/"

[mcp_servers.allmcp.headers]
X-API-Key = "YOUR_API_KEY"
```

{% endcode %}

If your client only supports a standard `Authorization` header, you can send the same key as a Bearer token instead:

{% code title="\~/.codex/config.toml" %}

```toml
[mcp_servers.allmcp.headers]
Authorization = "Bearer YOUR_API_KEY"
```

{% endcode %}
{% endstep %}

{% step %}

#### Verify it's working

Run the Codex CLI and ask it to list integrations — see [Verify it's working](#verify-its-working) below.
{% endstep %}
{% endstepper %}

***

## Verify it's working

Run the Codex CLI and ask:

```bash
codex "List available AllMCP integrations"
```

{% hint style="success" %}
Codex lists the providers you can connect and shows which ones you have already connected.
{% endhint %}

***

## Per-user scoping

Append `?user_id=your-user-id` to the URL to scope credentials to a specific user.

{% code title="\~/.codex/config.toml" %}

```toml
[mcp_servers.allmcp]
url = "https://go.allmcp.co/mcp/?user_id=your-user-id"

[mcp_servers.allmcp.headers]
X-API-Key = "YOUR_API_KEY"
```

{% endcode %}

***

## Alternative: --mcp-server flag

You can also pass the MCP server inline when running a one-off command:

```bash
codex --mcp-server '{"name":"allmcp","url":"https://go.allmcp.co/mcp/","headers":{"X-API-Key":"YOUR_API_KEY"}}' \
  "List my Bitrix24 contacts"
```

***

{% content-ref url="/pages/416edc1381c20849bc41111b02e482a722a49b94" %}
[Quickstart](/documentation/quickstart.md)
{% endcontent-ref %}

{% content-ref url="/pages/QJVxDLqxIz5KMCH5afbE" %}
[All Providers](/documentation/providers/providers.md)
{% endcontent-ref %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.allmcp.co/documentation/connect/openai-codex.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
