---
title: "Connect while to Codex over MCP in 2026: step by step"
url: https://while.sh/en/guides/connect-codex/
author: "Aloïs Oddon, co-founder of Nextmap"
updated: 2026-11-19
---

# Connect while to Codex in 2026: the command and the authorization

Codex already writes your code. Connected to while over MCP, it also puts it on while, with its data, and leaves what matters for you to approve. Here is the connection, the authorization, and what Codex can do next.

Codex already writes your code. **Connected to while over MCP**, it also puts it on while: while builds the code, runs its tests, gives it an HTTPS address, watches it and tells you when it breaks (source 2). The connection takes a minute, and you stay in control of what matters.

> **The short version.** Two terminal commands are enough. On the first call, while opens a page in your browser: you choose where Codex acts, one tool or the whole organization, and its level, Read, Read and act, or Administer. What matters, like a production release, then waits for a person's approval.

## The connection at a glance

| The moment | What you do |
|---|---|
| Connect | Two commands, below |
| Authorize | A page in the browser: the tool or the organization, and the level |
| Try without an account | The trial server, named while-essai |
| No browser, in CI | A token in the Authorization header, confirmed with a link |

## Step 1: connect while to Codex

```sh titre="Terminal"
codex mcp add while --url https://app.while.sh/mcp
codex mcp login while
```

To connect every AI tool on your computer at once, while's install script does the same thing (source 2):

```sh titre="Terminal"
curl -fsSL https://app.while.sh/install.sh | sh
```

## Step 2: authorize Codex

Ask Codex for a first action on while. **On the first tool call, while opens the authorization page** in your browser: you sign in, then choose where Codex acts, **one tool or the whole organization**, and its level, **Read, Read and act, or Administer** (source 2). The second command, codex mcp login while, opens the authorization page right away (source 2).

> You, to your AI: Put this tool on while, with its data, and keep it for the team.

## What Codex does next

Over MCP, Codex **puts the tool on while**, reads **logs and errors**, queries **the data** and **rolls back** when a version causes trouble (source 2).

- **Put the tool on while.** Codex writes the while.yaml file, sends the code, and while builds it, runs its tests and returns the address.
- **Understand an error.** Codex reads the logs and the errors grouped in while, finds the cause and fixes it.
- **Roll back.** If the latest version breaks something, Codex puts the previous one back.

<figure class="illus"><img src="/illustrations/connecter-codex-autorisation-1200.webp" srcset="/illustrations/connecter-codex-autorisation-768.webp 768w, /illustrations/connecter-codex-autorisation-1200.webp 1200w" sizes="(min-width: 48rem) 46rem, 100vw" width="1536" height="1024" loading="lazy" decoding="async" alt="Authorizing Codex on while: the browser page where you choose one tool or the whole organization and the Read, Read and act or Administer level, then a production release waiting for a person's approval" /><figcaption>You choose where Codex acts and at what level, and what matters waits for a person.</figcaption></figure>

## What waits for your approval

Some actions wait for a person, and Codex gives you the link. **A production release, deleting a database, an outside API or an access**: a person in the organization decides. At the Read and act level, an administration action, like adding a person, creating a token or granting a role, is confirmed with one click (source 2). Your AI never approves.

The credentials of your software stay in while, and Codex never sees them. The details are on our [security](/en/security/) page, and in [connect an API with no credentials in the code](/en/guides/api-keys-out-of-code/).

## Without an account: the trial

The **trial server**, https://app.while.sh/essai, needs no sign-in: the same commands, named while-essai. The tool has its address for a limited time, and Codex gives you a link to keep it by creating your account (source 2).

Once the tool is on while, keep it for your colleagues with [their email account](/en/guides/internal-tool-company-sign-in/), or share it with a client through [a link and a password](/en/guides/share-app-with-password/). The same guides exist for [Claude Code](/en/guides/connect-claude-code/), [Gemini CLI](/en/guides/connect-gemini-cli/) and [Cursor](/en/guides/connect-cursor/).

## Try it with Codex

Give this message to Codex. The trial is **free, with no sign-up**, and your tool has its address **in 3 minutes**.

```text titre="The message to give your AI"
Read while.sh/agents and help me get started with while.
```

## Sources

1. [Codex, Model Context Protocol](https://learn.chatgpt.com/docs/extend/mcp?surface=cli), 2026-11-19
2. [while, the page for AI tools](https://app.while.sh/agents?lang=en), 2026-11-19

## Questions

### How do you connect while to Codex?

Two terminal commands are enough: they add while's MCP server, https://app.while.sh/mcp. On the first tool call, while opens an authorization page in your browser (sources 1 and 2).

### Do you need a token?

No, Codex is authorized in your browser. For a CI with no browser, a token in the Authorization header replaces it: your AI creates it, and you confirm it with a link (source 2).

### What permissions should you give Codex?

At authorization, you choose where it acts, one tool or the whole organization, and its level: Read, Read and act, or Administer. Start with a single tool (source 2).

### Does Codex see my credentials?

No. The credentials of your software stay in while, and calls to an outside API go through while, which adds them.

### Can you try without a while account?

Yes. The trial server, https://app.while.sh/essai, needs no sign-in: the same commands, named while-essai. The tool has its address for a limited time, with a link to keep it (source 2).
