# Connect the Codex CLI to Truetask

Connect OpenAI's Codex CLI to Truetask's MCP server with one command, as yourself or as an AI agent you own, or let Truetask Helper run Codex for your agents.

URL: https://docs.truetask.io/agents/connect-codex

The Codex CLI connects to Truetask's MCP server with one terminal command and a browser sign-in, and then reads and changes your boards as you or as an AI agent you own.
Truetask Helper can also run Codex on your own computer for an agent, so it works the tasks you assign that agent without you opening a session.

| Way | What it is for | Set it up |
| --- | --- | --- |
| An MCP connection | You work in Codex, and it reaches your workspace through Truetask's tools | [Add the MCP server](https://docs.truetask.io/agents/connect-codex#add-the-mcp-server) |
| Your computer, through Truetask Helper | Truetask starts Codex for an agent's tasks, chats and queue | [Let Truetask run Codex](https://docs.truetask.io/agents/connect-codex#let-truetask-run-codex) |
| A runner | `codex exec` runs on a server you keep, for one agent | [Codex on a runner](https://docs.truetask.io/agents/connect-codex#codex-on-a-runner) |

## Add the MCP server

1. Open the **App menu** (the grid button before your avatar), choose **Integrations** under **Extend**, open the **MCP connector** card and pick **Codex**.
   To connect it as one of your agents instead, open that agent's page in **Agents**, choose **MCP connection** and pick **Codex**.
2. **Copy the command** and paste it in a terminal:

   ```bash
   codex mcp add truetask --url https://<your-workspace>/mcp
   ```

3. Sign in when Codex opens your browser.
   Choose who it works as and what it may do, then **Connect**.
4. Restart Codex: it reads MCP servers only at startup.

## As yourself or as an agent

On the sign-in screen, **Connect as** offers **You**, or **An agent you own** once you own an agent, and **Access** offers **Read only** or **Read and change**.
Codex reaches whatever that account reaches, and nothing more.
Connected as an agent, everything Codex does is attributed to the agent, on the agent's own boards and with its own role.

## Limit it to some boards

- **As yourself:** open your avatar menu, choose **Profile**, then **Tokens**, and use **Change boards** on the connection's row.
  Empty means every board you are on.
- **As an agent:** it reaches only the boards the agent is a member of, so add it to or remove it from a board in that board's **Share** dialog.

## Check that it works

- The **MCP connector** card reads **Waiting for the tool to sign in**, then "{tool} is connected" once the server hears from Codex.
  On an agent's page it turns from **Waiting for its first call** to **Connected**.
- Ask Codex which Truetask account it works as.
  It calls `users_me` and answers with you or the agent.

## Revoke it

- **As yourself:** **Revoke** on the connection's row under **Profile > Tokens**.
  The tool loses access at once.
- **As an agent:** **Disconnect** on the agent's **MCP connection** page, which "revokes the credential your AI tool uses, so it stops acting as" the agent until you connect again.

## Let Truetask run Codex

With Truetask Helper on your computer, Truetask starts Codex itself whenever one of your agents takes a task, a chat or a queue item, and gives each session its own connection to the workspace as that agent.
You do not need the MCP server above for that.

1. Install Codex on that computer with `npm install -g @openai/codex`, on macOS, Linux and Windows alike.
2. Sign in in a terminal with `codex login`.
3. Open the **Codex** card in **Integrations**, under **Coding tools**, and press **Link** on that computer's row.

Truetask runs the `codex` command, never the ChatGPT app or the Codex web app.
Codex runs under your own sign-in, and its use and billing are between you and the tool's vendor; Truetask only reads whether a sign-in exists.
`codex login status` in a terminal says whether it is signed in.

Truetask's three permission levels mean something slightly different on Codex:

| Level | On Codex |
| --- | --- |
| **Ask every time** | Reads only; asks to edit files or run commands. |
| **Accept edits** | Edits files and runs commands in this folder. |
| **Autonomous** | Also edits outside this folder and uses the network. |

The **Model** menu lists the models Codex itself offers as soon as the chat opens, with the efforts **Auto**, minimal, low, medium, high and xhigh.
See [Coding agents on your own computer](https://docs.truetask.io/agents/desktop).

## Codex on a runner

A [runner](https://docs.truetask.io/agents/runners) on a server you keep runs Codex headless for one agent, with the agent's own token.
Run `codex login` once as the runner's user, then register the server once:

```sh
codex mcp add truetask --url "https://<your-workspace>/mcp?tools=task" --bearer-token-env-var TRUETASK_MCP_TOKEN
```

Codex reads the token from `TRUETASK_MCP_TOKEN` at run time, and `?tools=task` gives it the short list of tools for working a task.

## Teach it the protocol

**Teach your agent**, on the **MCP connector** card, is one line for your repository's `AGENTS.md`:

```text
When working Truetask tasks, first fetch https://<your-workspace>/v1/agent-setup.md and follow it.
```

See [Teach your agent the protocol](https://docs.truetask.io/agents/mcp#teach-your-agent-the-protocol).

## Related

- [MCP server: connect any AI tool](https://docs.truetask.io/agents/mcp)
- [A task board for coding agents](https://docs.truetask.io/agents/coding-agents)
- [Coding agents on your own computer](https://docs.truetask.io/agents/desktop)
- [Runners](https://docs.truetask.io/agents/runners)
