# Codex

Connect Codex to Valakes so it can run commands on your SSH servers through the agent tools, with approvals where you want them.

Source: https://docs.valakes.com/agents/codex/

Last updated: 2026-11-25

Codex uses the same bridge program as Claude Code, `valakes-mcp`, and reads its entry from `config.toml`. Before you register the bridge, turn on the agent API and create the agent. The four steps are on the [Claude Code page](https://docs.valakes.com/agents/claude-code/#turn-on-the-api-and-create-the-agent), and they do not depend on the client.

## Add the bridge to `config.toml`

Codex reads `~/.codex/config.toml`, or the `config.toml` in the folder that the variable `CODEX_HOME` names when you have set it. The **Connect an agent** wizard shows the exact path for your computer. Windows paths need doubled backslashes in TOML, and the snippet already has them.

Windows:

```toml
[mcp_servers.valakes]
command = "C:\\Program Files\\Valakes\\resources\\bin\\valakes-mcp.exe"
args = []
env = { VALAKES_AGENT = "k3m9q2xa" }
```

macOS:

```toml
[mcp_servers.valakes]
command = "/Applications/Valakes.app/Contents/Resources/bin/valakes-mcp"
args = []
env = { VALAKES_AGENT = "k3m9q2xa" }
```

The value of `VALAKES_AGENT` is the handle of the agent you created, here `k3m9q2xa`. It is not a secret. The token never goes into this file.

## Or let Codex write the entry

One command makes Codex create the same entry in the same `config.toml`. Windows:

```sh
codex mcp add valakes --env VALAKES_AGENT=k3m9q2xa -- "C:\Program Files\Valakes\resources\bin\valakes-mcp.exe"
```

macOS:

```sh
codex mcp add valakes --env VALAKES_AGENT=k3m9q2xa -- "/Applications/Valakes.app/Contents/Resources/bin/valakes-mcp"
```

## A second profile of Valakes

If you run a second profile of Valakes with a different data folder, add `VALAKES_DATA_DIR` to the same `env` table. It names a folder. It is never a URL and never a token, and the bridge refuses anything else.

## Check that it works

```sh
codex mcp list
```

The list should show `valakes` as connected. Ask Codex to call `list_hosts`: you should see the hosts you opened to agents and no others. Press **Test connection** in the wizard to see the first call from Valakes' side, with its time and the tool that was called.

When the bridge cannot start, it prints one line and exits. The lines and what to do about each are on the [Claude Code page](https://docs.valakes.com/agents/claude-code/#check-that-it-works), because the bridge is the same program.

## What Codex can do

Codex gets the same ten tools as every other agent and the same gate on each call: the token, the host's access level, the risk of the command and, where needed, your approval. See [how agents work](https://docs.valakes.com/agents/) for the four levels and for what waits for you, and the [security model](https://docs.valakes.com/security/) for how the local API is protected.
