---
title: "How to Connect Codex to Chatfuel"
description: "Run codex mcp add chatfuel-api --url https://mcp.chatfuel.com/panel/api, then codex mcp login chatfuel-api. The ChatGPT desktop app shares this setup."
canonical_url: https://chatfuel.com/docs/mcp/connect-codex-to-chatfuel
markdown_url: https://chatfuel.com/docs/mcp/connect-codex-to-chatfuel.md
last_updated: 2026-10-26
lang: en
site: https://chatfuel.com/docs
llms_txt: https://chatfuel.com/docs/llms.txt
---

# How to Connect Codex to Chatfuel

Run codex mcp add chatfuel-api --url https://mcp.chatfuel.com/panel/api, then codex mcp login chatfuel-api. The ChatGPT desktop app shares this setup.

Codex connects to Chatfuel with `codex mcp add` and a sign-in through `codex mcp login`. The setup is shared between Codex CLI and the ChatGPT desktop app, so a Chatfuel server added in one appears in the other.

## How to add the Chatfuel server [#how-to-add-the-chatfuel-server]

Run the two commands to add the server and sign in to Chatfuel:

```
codex mcp add chatfuel-api --url https://mcp.chatfuel.com/panel/api
codex mcp login chatfuel-api
```

The `chatfuel-api` server gives Codex the full Chatfuel GraphQL API. For the ready-made tools for everyday bot management, add the `chatfuel` server with `https://mcp.chatfuel.com/panel` in the same way:

```
codex mcp add chatfuel --url https://mcp.chatfuel.com/panel
codex mcp login chatfuel
```

The two servers are separate connections, so you sign in to each. How they differ is in [MCP or API MCP: which Chatfuel link to use](https://chatfuel.com/docs/mcp/which-chatfuel-mcp-link-to-use).

## How to add Chatfuel in the ChatGPT desktop app [#how-to-add-chatfuel-in-the-chatgpt-desktop-app]

The ChatGPT desktop app keeps its servers in `~/.codex/config.toml`, the same file Codex CLI uses. A server added with `codex mcp add` already appears there. To add it in the app instead, open **Settings** → **MCP servers** → **Add server**, then click **Authenticate**. The full desktop steps are in [how to connect ChatGPT to Chatfuel](https://chatfuel.com/docs/mcp/connect-chatgpt-to-chatfuel).

## How to connect Codex with a CLI token [#how-to-connect-codex-with-a-cli-token]

Use a CLI token when Codex can't sign in through the browser, for example in CI. Codex reads the token from an environment variable each time it starts:

```
export CHATFUEL_TOKEN=<token>
codex mcp add chatfuel-api --url https://mcp.chatfuel.com/panel/api --bearer-token-env-var CHATFUEL_TOKEN
```

Add the `export` line to your shell profile so the token is there after a restart. Where to create the token is in [Chatfuel MCP sign-in, read-only access and CLI token](https://chatfuel.com/docs/mcp/mcp-sign-in-read-only-and-cli-token).

## What can I ask Codex? [#what-can-i-ask-codex]

Examples:

* *"Show me the GraphQL operations for bookings and write a script that lists this week's appointments."*
* *"Who has access to my bot, and what role does each person have?"*
* *"Review my recent chats and list suggested fixes. Don't change anything."*

More requests are in [Chatfuel MCP example prompts](https://chatfuel.com/docs/mcp/chatfuel-mcp-example-prompts).

## Common issues [#common-issues]

### Codex says the server needs login [#codex-says-the-server-needs-login]

Run `codex mcp login chatfuel-api` (or `codex mcp login chatfuel`) and sign in to Chatfuel again. The sign-in may have expired or been revoked in **Connected apps** in the Chatfuel dashboard.

### Codex can't find CHATFUEL\_TOKEN after a restart [#codex-cant-find-chatfuel_token-after-a-restart]

The `export` line was set only in the old terminal session. Add it to your shell profile, open a new terminal and start Codex again.
