Codex can use every token your shell exports. Give it none.
Codex reads its MCP servers from one file, `~/.codex/config.toml`, so one setup covers every Codex session on the machine: the CLI, the IDE extension and the desktop app. No `GITHUB_TOKEN` or `SLACK_TOKEN` in your shell; each call is checked and logged instead.
One command, once per machine
You need Node.js 18 or later. Run it from a directory you’ll keep, such as your main project: the agent’s key is stored there and the Codex config points at it.
Run the register command. Add
--projectif you also want anAGENTS.mdin this directory.Terminal npx @agentvalet/register # or, to also write AGENTS.md here npx @agentvalet/register --projectYour browser opens. Sign in, or create a free account, and the CLI finishes registering when you authorise it. You don’t copy any ids on this path.
Start a new
codexsession. AgentValet appears in its tool list whenever the agent needs a platform.In the dashboard, approve the new agent and grant the platforms it needs. It starts with nothing: every call is refused until you grant it.
Connect over OAuth instead, with no key file
This path needs your owner id. It’s in the dashboard under Settings, Account, Owner ID. The Connect Claude, ChatGPT, Copilot… button on the Agents page builds the whole URL for you. Codex’s OAuth needs the server to support dynamic client registration, which AgentValet does, so there’s no client id to enter.
Add the server, then log in. The login opens your browser; approve, and AgentValet creates a new agent for this connection with nothing granted.
Terminal codex mcp add agentvalet --url https://api.agentvalet.ai/mcp/v1/<owner-id> codex mcp login agentvaletGrant that agent its platforms in the dashboard.
Write the TOML by hand
Run npx @agentvalet/register once first. It creates the key on this machine and prints the four values below when it finishes. The MCP server needs all four; an entry without them won’t start.
Add this block to
~/.codex/config.toml.~/.codex/config.toml [mcp_servers.agentvalet] command = "npx" args = ["-y", "@agentvalet/register@latest", "mcp-server"] env = { AGENT_ID = "<agent-id>", OWNER_ID = "<owner-id>", PROXY_URL = "https://api.agentvalet.ai", AGENT_PRIVATE_KEY_PATH = "/absolute/path/to/.agentvalet/agent.key" }
What’s governed here
Nothing is allowed until you grant it. This is a typical first grant for Codex CLI; you decide every row, and you can change it without touching the agent.
| What the agent tries | Platform | Decision |
|---|---|---|
| Read an issue | Linear | Allowed within grant |
| Comment on a pull request | GitHub | Allowed within grant |
| Change a DNS record | Cloudflare | Asks you |
| Delete a storage bucket | Supabase | Not granted |
Codex guide in the docsThe longer walkthrough, kept with the product docs.
Put Codex CLI behind AgentValet.
Register the agent, grant only what it needs, and approve the risky calls from your phone. Free to start, no credit card.