# Codex

`npx brynth init` connects Codex for you. This page shows what it writes and the settings that matter for Brynth. Checked against the Codex documentation on 2026-10-07.

## Connect

```bash
npx brynth connect codex
```

The CLI creates a key for Codex (all scopes, label, agent and platform `codex`) and adds this table to `~/.codex/config.toml`, or to `$CODEX_HOME/config.toml` when `CODEX_HOME` is set:

```toml
[mcp_servers.brynth]
url = "https://mcp.brynth.ai/mcp"
http_headers = { "Authorization" = "Bearer brk_live_…" }
tool_timeout_sec = 150
```

The rest of the file is left as it is, and the file is made readable only by you (mode 0600). Restart Codex to load the server.

- `tool_timeout_sec = 150`: `ask_approval`, `ask_human`, `policy_set`, `inbox_wait`, `email_send` and `file_url` can wait up to 120 seconds for an answer. The Codex default would cut them off.
- If a `brynth` server already exists, the CLI asks before replacing it, or replaces it with `--force` (with `--yes` or without a terminal, it stops unless you add `--force`). The previous key stays active: the message names its id when the CLI created it, otherwise find it with `npx brynth status --json`.
- If the server is configured in a form the CLI does not edit (dotted keys, an inline table, an array of tables), it changes nothing and prints the table to paste, with `<BRYNTH_KEY>` in place of the token.

## The skill

```bash
npx brynth skill install --client codex
```

This writes `.agents/skills/brynth/SKILL.md` in the current folder, the same text as the Claude Code skill (see [Claude Code](/get-started/claude-code.md#the-skill)).

## codex exec

`codex exec` runs without a person at the keyboard, so a tool call that needs your approval in Codex is refused. To let the Brynth tools run there, add this line to the `[mcp_servers.brynth]` table:

```toml
default_tools_approval_mode = "approve"
```

Brynth's own policy still applies: an `email_send` that your rules send to a person still waits for that person. `brynth connect codex --force` rewrites the table, so add the line again after it.

## Check

Run `codex mcp list`: `brynth` is listed. Then ask "Check my Brynth inbox."

## Disconnect

Remove the `[mcp_servers.brynth]` table from `config.toml`, then revoke the key with `DELETE /v1/keys/{id}` (see [REST](/reference/rest.md)).
