# Use Codex on your servers

Add Valakes to the Codex config.toml, or run one codex mcp add command, and Codex works on your servers under your host policies without seeing a password.

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

Last updated: 2026-11-24

Codex can reach your servers through Valakes as an MCP server. It runs what each host's policy allows, and a command you have not allowed waits for your approval.

## What Codex gets

Codex gets Valakes as an MCP server called `valakes`, with tools to list hosts, open sessions, run commands and read what they print. You ask Codex for a task in its own terminal, and the work lands on your servers through Valakes: every session it opens is a tab in Valakes that carries the agent's name.

Valakes hands Codex its own guide when it connects, covering the tools, the credential placeholder, approvals and production hosts, so nothing has to go into your prompt.

## Set it up

Codex keeps its MCP servers in `config.toml`, and there are two ways to put Valakes there: let `codex mcp add` write the entry, or add the table by hand. Both name the bridge, `valakes-mcp`, and the agent's handle. Neither contains the token; the bridge reads it from a file only you can read.

1. In Valakes, open Settings, Agent API, and turn on the local server for agents. Confirm when Valakes asks.

2. Press Connect an agent in the Agents panel, choose Codex and name the agent, for example "Codex on laptop".

3. Let Codex write the entry itself with one command, using your own agent handle in place of `k3m9q2xa`:

   ```
   # Windows
   codex mcp add valakes --env VALAKES_AGENT=k3m9q2xa -- "C:\Program Files\Valakes\resources\bin\valakes-mcp.exe"
   
   # macOS
   codex mcp add valakes --env VALAKES_AGENT=k3m9q2xa -- "/Applications/Valakes.app/Contents/Resources/bin/valakes-mcp"
   ```

4. Or add the same table to `~/.codex/config.toml` yourself (or to `config.toml` in the folder `CODEX_HOME` names):

   ```
   # Windows
   [mcp_servers.valakes]
   command = "C:\\Program Files\\Valakes\\resources\\bin\\valakes-mcp.exe"
   args = []
   env = { VALAKES_AGENT = "k3m9q2xa" }
   
   # macOS
   [mcp_servers.valakes]
   command = "/Applications/Valakes.app/Contents/Resources/bin/valakes-mcp"
   args = []
   env = { VALAKES_AGENT = "k3m9q2xa" }
   ```

5. Press Test connection in the wizard and start Codex. The wizard reports the first call Valakes saw from it.

The connection wizard in Valakes shows this setup, with your own paths and handle.

Windows paths in TOML need doubled backslashes, which the snippet already has. A second profile of Valakes, with its own data folder, adds `VALAKES_DATA_DIR` to the same `env` table. It names a folder, never a URL or a token, and the bridge refuses anything else.

## Check that it works

`codex mcp list` should show `valakes`. Then give Codex a small task that calls `list_hosts`: the answer must list exactly the hosts you opened to agents. If a host you expected is missing, its agent access is still Off. Test connection in the wizard confirms the same call from inside Valakes.

```sh
codex mcp list
```

"Valakes is busy: try again in a moment" means the app answered the bridge's proof request with too many requests twice in a row; wait and start Codex again. "Valakes could not unlock its vault" means the vault locked after the idle time and did not open again: open Settings, Credentials and vault.

## What it can and cannot do

Everything Codex does on a server goes through a Valakes tool, and the tools stop at the same lines for every agent. Nothing returns a secret, and nothing changes a policy or approves a request. Within those lines, the host's agent access level decides which commands run at once and which wait for you.

### It can

- See the hosts you opened to agents, and no others
- Open a session, which Valakes shows as a tab with its name
- Run a command and page through its output
- Look at a full-screen program and send it keys
- Use a saved password through its `{{cred:name}}` placeholder
- Upload and download inside its workspace folder, once you approve

### It cannot

- Get a credential, a key or a token back from any tool
- Approve anything, or change a policy or a setting
- Read the audit log
- Answer a host key prompt
- Reach a host left at Off

## Host policy and approvals

A new host is closed to Codex until you choose its agent access in the host editor. Read-only lets it run a fixed list of read commands and refuses the rest, while Approve writes sends every other command to your approval queue. A command that uses a credential on a production host waits for you even on Full.

## Documentation

[Read the docs: Codex](https://docs.valakes.com/agents/codex/)

## Read next

- [AI agents work under your rules](https://valakes.com/features/ai-agents/): Valakes has a local API that lets an AI agent such as Claude Code or Codex open sessions and run commands on the hosts you allow. The agent never sees a password, and changes wait for your approval.
- [Dangerous commands wait for you](https://valakes.com/features/command-check/): The command check reads each command you type before it runs. A dangerous one stops on a card that says why, and it runs only when you choose.
