> ## Documentation Index
> Fetch the complete documentation index at: https://docs.trypopcorn.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Connect Codex

> Add Popcorn to Codex CLI with two commands, sign in through your browser, and try your first requests.

Codex connects to Popcorn through Codex CLI. You run two commands that Popcorn gives you: the first registers Popcorn, the second starts the sign-in that opens Popcorn's approval screen in your browser.

## Before you start

* A Popcorn role with **API keys** view access, so you can open **Settings → AI assistants**. **Owner**, **Admin** and **Manager** have it.
* Codex CLI installed on your computer.
* If you belong to more than one workspace, switch to the one you want first. The connection belongs to the workspace you approve it in.

## Connect

**1. Copy the commands**

In Popcorn, go to **Settings → AI assistants**. Under **Connect an assistant**, find the **Codex** card (labelled **Codex CLI**) and click **Copy commands**. The commands are:

```
codex mcp add popcorn --url https://api.trypopcorn.ai/mcp
codex mcp login popcorn
```

**2. Register Popcorn**

Run the first command. It adds Popcorn to Codex as a server named `popcorn`.

**3. Sign in and approve**

Run the second command. Codex opens Popcorn's approval screen in your browser. If you are not signed in, you are sent to sign in first and then brought back.

The screen shows the **App** asking, the **Workspace** it will reach (with your email), when the **Request expires**, the **Connection address**, and **Requested access** with one line per area, such as "Campaigns: Read". Check that the workspace is the one you intend, then click **Allow access**. Return to your terminal.

**4. Try a request**

Ask Codex something read-only first, for example "Give me an overview of my Popcorn workspace" or "Show my last five orders."

> [!NOTE]
>
> The approval request is valid for 10 minutes. If the page says **Authorization request was not found.**, run `codex mcp login popcorn` again.

## What the approval screen means

* **Requested access** lists each area Codex asked for, in the form "Inbox: Send", with a short description and the access code beside it. A description that says "after you confirm the action" means Codex must show you a preview and get your go-ahead each time before Popcorn carries it out.
* If Codex does not ask for specific areas, Popcorn grants read-only access to every area your role can view.
* Access never exceeds your own Popcorn role. If Codex asks for more than your role can grant, the page shows **Authorization request expired.** instead of the approval screen.
* **Deny** cancels the request. Nothing is connected.
* Codex uses the main address, so billing is available (with confirmation), unlike ChatGPT and the Claude connector.

See [Permissions and safety](https://docs.trypopcorn.ai/ai-assistants/permissions-and-safety.md) for the full model.

## First requests to try

| Ask Codex | What happens |
| - | - |
| "Which of my campaigns had the most failed deliveries this month, and why?" | Reads campaign delivery results and summarises the failure reasons. |
| "Import these customers" followed by a list of names and phone numbers | Prepares an import and shows which rows would be created or updated. It runs only after you confirm. |
| "Add a product called X at 120 SAR with this description." | Prepares the product and shows the preview. It is created only after you confirm. |
| "Turn off the recommendation rule for the summer collection." | Updates the rule. |
| "List my team and any pending invites." | Reads the team. |

## Built-in workflows

Popcorn publishes four ready-made workflows that Codex can list and run: **Safely prepare and launch a campaign**, **Triage the Popcorn inbox**, **Review and publish an agent version**, and **Connect a commerce or messaging integration**. Each walks Codex through reading first, showing you a preview, and waiting for your confirmation. See [What you can do](https://docs.trypopcorn.ai/ai-assistants/what-you-can-do.md#built-in-workflows).

## Troubleshooting

| Symptom | What to do |
| - | - |
| The first command fails | Check the URL is exactly `https://api.trypopcorn.ai/mcp`. |
| **Authorization request was not found.** | The 10-minute window passed, or the request was already approved or denied. Run `codex mcp login popcorn` again and approve promptly. |
| **Authorization request expired.** on a request you just started | The page uses this text for several refusals: you are signed in to Popcorn as a different user than the one who started the connection, or your role cannot grant the access Codex asked for. Sign in as the right user or ask an Owner or Admin about your role, then run the login command again. |
| **Unable to complete authorization.** after you click **Allow access** | Popcorn could not finish the approval, for example because it lapsed or was already used. Run the login command again. |
| Codex says it lacks permission for an action | Your role does not allow it, or the connection was approved before that area existed. Check your role under **Settings → Roles and permissions**, then run the login command again so the new access is requested. |
| Codex says too many requests | Popcorn limits how fast each assistant can call it. Wait for the time it reports and try again. |
| Codex stopped working after a team change | If your role was changed or you were removed from the workspace, access ends with the next request. |

## Related

* [What you can do](https://docs.trypopcorn.ai/ai-assistants/what-you-can-do.md)
* [Permissions and safety](https://docs.trypopcorn.ai/ai-assistants/permissions-and-safety.md)
* [Connect ChatGPT](https://docs.trypopcorn.ai/ai-assistants/connect-chatgpt.md) and [Connect Claude](https://docs.trypopcorn.ai/ai-assistants/connect-claude.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.