---
title: "How to connect ChatGPT and Codex to your MCP server | FluxOS MCP Blog"
description: "Codex and the OpenAI API connect to a FluxOS MCP server with a key. The ChatGPT app does not yet. Here are the steps and what to expect from each one."
url: "https://www.fluxosmcp.com/en/blog/how-to-connect-chatgpt-and-codex-to-your-mcp-server"
lang: "en-US"
---

[Blog](https://www.fluxosmcp.com/en/blog) · Nov 25, 2026 · FluxOS MCP Team

# How to connect ChatGPT and Codex to your MCP server

[Leia este artigo em português](https://www.fluxosmcp.com/blog/como-ligar-o-chatgpt-e-o-codex-ao-seu-servidor-mcp)

“Does it work with ChatGPT?” is the first question from almost everyone who publishes an MCP server. The honest answer has three parts:

- **Codex** (terminal, editor extension, and desktop app): **yes**, with the key.
- **OpenAI API**: **yes**, with the key.
- **ChatGPT web app**: **not yet**, and the reason is the authentication method.

Let’s go through all three, starting with what works.

## Before you start: address and key

You need two things, and both are in FluxOS MCP:

- **The server address.** On the **Conexão** (Connection) tab of the published server (or, for the client, on the **Ferramentas e conexão** (Tools and connection) page of the portal). It looks like `https://SEU-DOMINIO/mcp/dados-publicos`, where `SEU-DOMINIO` is your domain.
- **An access key.** Created on the client’s **Chaves** (Keys) tab. It starts with `amk_` and is shown only once.

In the examples, the server is `dados-publicos` from the [OpenAPI tutorial](https://www.fluxosmcp.com/en/blog/tutorial-postal-codes-holidays-and-rates-in-your-ai-assistant-with-openapi), with tools for CEP (Brazilian postal code) lookups, holidays, and rates. Swap in your own.

FluxOS MCP speaks **Streamable HTTP** and authenticates **by key only**, sent in the `Authorization: Bearer` header. There is no OAuth. That determines which assistants can connect, as you will see.

## Path 1: Codex

Codex stores MCP servers in the `~/.codex/config.toml` file. For a remote server with a key, OpenAI’s documentation provides for exactly what FluxOS MCP uses: a token sent in the `Authorization` header.

First, put the key in an environment variable:

```bash
export FLUXOS_MCP_KEY="amk_SUA_CHAVE"

```

Then, in `~/.codex/config.toml`:

```toml
[mcp_servers.dados_publicos]
url = "https://SEU-DOMINIO/mcp/dados-publicos"
bearer_token_env_var = "FLUXOS_MCP_KEY"

```

Pay attention to the field: `bearer_token_env_var` takes the **name of the variable**, not the key. Codex reads the variable and builds the header. That way the key is never written in the file.

To verify:

```bash
codex mcp list

```

And inside Codex, the `/mcp` command shows the active servers.

### One configuration, three places

Codex in the terminal, the editor extension, and the ChatGPT desktop app **share this same configuration**. You set it up once and the server shows up in all three.

### Useful settings

In the same block of `config.toml`:

```toml
[mcp_servers.dados_publicos]
url = "https://SEU-DOMINIO/mcp/dados-publicos"
bearer_token_env_var = "FLUXOS_MCP_KEY"
enabled_tools = ["consultar_cep", "listar_feriados"]
tool_timeout_sec = 120

```

- `enabled_tools`: allows only the tools listed. `disabled_tools` does the opposite.
- `tool_timeout_sec`: the maximum time for a call. The default is 60 seconds. Raise it if your tool queries a slow system.
- `startup_timeout_sec`: how long the server has to respond when connecting. The default is 10 seconds.

For a server that applies to a single project, use `.codex/config.toml` in the project folder instead of the file in your home folder. The key stays in the environment variable.

## Path 2: the OpenAI API

For anyone building a product. The Responses API has a tool of type `mcp`: you pass the address and OpenAI connects, lists the tools, and makes the calls.

```bash
curl https://api.openai.com/v1/responses \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $OPENAI_API_KEY" \
  -d '{
    "model": "gpt-6.2-astra",
    "input": "What is the address for CEP 01001-000?",
    "tools": [
      {
        "type": "mcp",
        "server_label": "dados-publicos",
        "server_url": "https://SEU-DOMINIO/mcp/dados-publicos",
        "authorization": "amk_SUA_CHAVE",
        "allowed_tools": ["consultar_cep"],
        "require_approval": "never"
      }
    ]
  }'

```

As with xAI, there are **two different keys**: `$OPENAI_API_KEY` is your OpenAI key, and `amk_SUA_CHAVE`, inside `tools`, is the FluxOS MCP key.

The fields:

- `server_url` and `server_label`: the server’s address and label. The API accepts Streamable HTTP.
- `authorization`: the token the server requires. OpenAI’s documentation presents it as an access token and does not detail how the header is built. **We have not tested it against a FluxOS MCP server:** start by passing just the key, as in the example. If the server responds with 401, try the full value, `Bearer amk_SUA_CHAVE`.
- `allowed_tools`: allows only some tools. OpenAI warns that exposing many tools increases cost and latency.
- `require_approval`: by default, the API **asks for approval before each call** to the server, and your application has to respond to that request. With `"never"`, the calls go straight through. Use `"never"` only for read tools you trust. For tools that change data, keep the approval.

## Path 3: the ChatGPT app (not yet)

ChatGPT on the web lets you connect your own MCP server: under **Plugins**, the add button and the **Add custom MCP server** option. The form asks for a name, an address, and the authentication.

Authentication is where this path closes. The documented options are:

- OAuth;
- no authentication;
- a combination of the two.

**There is no option for a fixed key in the header.** And FluxOS MCP has neither a keyless mode nor OAuth: every server requires the key, on purpose, because the key is what identifies the client, enforces the limits, and keeps the data separate.

The result is that **the ChatGPT app does not connect to a FluxOS MCP server today**. It is not a missing setting: the two ends speak different forms of authentication.

What to do in the meantime:

- **For personal use or the technical team:** Codex, including in the ChatGPT desktop app, connects with the key (path 1).
- **For a product of your own:** the API (path 2).
- **For end users in a ready-made chat:** today, the assistants that accept a key in the header, such as [Claude Code](https://www.fluxosmcp.com/en/blog/how-to-connect-claude-code-to-your-mcp-server) and [Grok in the terminal](https://www.fluxosmcp.com/en/blog/how-to-connect-grok-to-your-mcp-server).

If the ChatGPT app is essential for you, tell us: that is the kind of information that decides the order of what we build.

## When it won’t connect

The server responds with a code that tells you why:

- **401:** the key is missing, wrong, revoked, or expired. Check that you copied the whole key.
- **402:** the client’s subscription is awaiting payment.
- **403:** the client’s subscription is suspended or canceled.
- **429:** the key went over its per-minute or per-day limit. The message says how many seconds to wait before trying again.

If a tool does not show up, check that the server is **published** and that the tool is among those allowed for that key.

## Summary of the four articles

The same server, the same key, four families of assistants:

- [Claude Code](https://www.fluxosmcp.com/en/blog/how-to-connect-claude-code-to-your-mcp-server): one command in the terminal.
- [Claude, app and API](https://www.fluxosmcp.com/en/blog/how-to-use-your-mcp-server-with-claude-app-and-api): the API connects; the app depends on the account.
- [Grok](https://www.fluxosmcp.com/en/blog/how-to-connect-grok-to-your-mcp-server): the API and the terminal connect; the app is still to be confirmed.
- **ChatGPT and Codex:** Codex and the API connect; the web app, not yet.

The rule that explains every case: **wherever you can send an `Authorization` header, FluxOS MCP connects.**
