Skip to content

Connect while to Codex over MCP, to deploy your apps

Codex already writes your app. Connected to while over MCP, in two commands, it deploys it too, with its database and its access settings, and asks for your approval for what matters.

By Aloïs Oddon, co-founder of Nextmap. Facts checked on November 2, 2026.

View as Markdown

Prerequisites

  • Codex, installed on your computer.
  • A browser, to authorize your agent once.

Step 1: Connect while to Codex

In a terminal, add while to Codex’s MCP servers, then sign in1:

Terminal
codex mcp add while --url https://app.while.sh/mcp
codex mcp login while

Or let your agent do it: paste “Connect to while with my account (while.sh/agents), then deploy my app.” into it, and it connects itself.

Step 2: Authorize it in your browser

The second command opens a page in your browser: choose “A new app”, then click Authorize. Without a browser, add --no-browser: open the address it displays on a device that has a browser, then paste into the terminal the address you’re sent back to.

What your agent does

Codex then sees while’s tools: deploy, create a database, read the logs, query the database, open a preview, roll back. It calls them when you ask, with your permissions.

Deploy your app

You, to your agent: Deploy my app with while.

Your agent writes while.yaml, sends the code, and gives you your app’s address, over HTTPS. The details are in the guides, from Next.js to Django.

Understand an error

You, to your agent: Why has the app been returning errors since this morning?

Your agent reads the logs and the grouped errors in while, finds the cause and fixes it.

Query your database

You, to your agent: How many sign-ups this week?

Your agent reads your database in SQL over MCP, with your permissions on the data, and it can’t write to it.

See a new version before you deploy it

You, to your agent: Show me the new version before you deploy it.

Your agent opens a preview, at its own address, with its own data. You look at it, then your agent puts it into production.

Go back to the previous version

You, to your agent: Go back to the previous version.

In the 30 minutes after a deployment, the previous version comes back in a second. After that, it takes a few seconds. Once the previous version is back, your agent reads what broke in while’s logs, fixes it and deploys again.

Connect all the agents on your computer

You, to your agent: Connect while to all my agents.

One command connects Claude Code, Codex, Cursor, Gemini CLI and VS Code at once. Read the script first, if you like:

Terminal
curl -fsSL https://app.while.sh/install.sh | sh

In the docs: Previews and Versions and rollback.

Next steps

Sources

  1. Codex, MCP servers, accessed November 2, 2026

Questions

Do I need a token?

No: your agent gets authorized in your browser, once. For a CI without a browser, a token takes its place: your agent creates it, and you confirm it in one click.

Does my agent see my keys?

No: your keys stay in while, and calls to an external API go through while, which adds the key.

What can my agent do without me?

Deploy, and read the logs and the database. Sensitive actions, like deleting a production database, wait for your approval.

Connect your agent, it takes care of the rest

To paste into your agent

Read while.sh/agents, then deploy my app with while.

Copy the instructions

No account needed to try: your app is live right away. To keep it, sign in.

A project for your company? Talk to the team: hello@while.sh