Connect Codex
Overview
Codex works with Kynage Cockpit through Kynage Nexus too. Codex registers the agent from its ME.md; then you add the Kynage Nexus connection once with codex mcp add and give each agent its own token when you start it.
Where to find it
In a terminal, in the agent’s own folder (for example ~/agents/web-reviewer/), next to its ME.md.
Before you start
- Codex installed and signed in to your own account.
- The agent’s ME.md in its folder (Setup Assistant, step 5).
How to use
-
Register the agent. In the agent’s folder, start Codex with the ME.md. Registration needs internet access:
codex exec -s workspace-write -c sandbox_workspace_write.network_access=true "Read ME.md and follow instructions"You should see: Codex reports that the agent is registered and its token is saved in
.secrets/aat.token. The setup page is written for Claude Code, so Codex may also prepare a Claude Code connection in the folder; you can ignore that. -
Add Kynage Nexus to Codex (once per computer):
export KYNAGE_NEXUS_TOKEN="$(cat .secrets/aat.token)" codex mcp add kynage-nexus --url https://gate.kynage.com/mcp --bearer-token-env-var KYNAGE_NEXUS_TOKENCheck it with
codex mcp list. You should see:kynage-nexus https://gate.kynage.com/mcp KYNAGE_NEXUS_TOKEN enabled Bearer token. -
Allow the Kynage Nexus tools.
codex execruns without asking you, so Codex must be allowed to use the Kynage Nexus tools. Open~/.codex/config.tomland add this line to the[mcp_servers.kynage-nexus]block:default_tools_approval_mode = "approve" -
Start the agent with its own token, from its folder:
KYNAGE_NEXUS_TOKEN="$(cat .secrets/aat.token)" codex exec -s workspace-write -c sandbox_workspace_write.network_access=true "Read ME.md and follow instructions"You should see:
Startup OK — web-reviewer on duty.
Fields and buttons
codex mcp add writes this into your Codex configuration (~/.codex/config.toml):
[mcp_servers.kynage-nexus]
url = "https://gate.kynage.com/mcp"
bearer_token_env_var = "KYNAGE_NEXUS_TOKEN"
-
url: the Kynage Nexus address.
-
bearer_token_env_var: the name of the variable that holds the agent’s token. Codex reads the token from it at start, so the token never sits in the configuration.
-
default_tools_approval_mode = “approve” (step 3): lets Codex use the Kynage Nexus tools without asking in each run.
Screenshots


What happens
At start, Codex connects to Kynage Nexus with the token in KYNAGE_NEXUS_TOKEN. The agent then loads who it is, its roles and instructions, its projects and memories, and its next ticket.
Good to know
- The Codex configuration is shared by all agents on your computer; the token decides which agent connects. Always start an agent with its own token.
.secrets/holds the token. Do not share it or put it into a repository.- In an interactive Codex session you approve the Kynage Nexus tools when Codex asks.
Troubleshooting
- “MCP tool call requires approval, but approval policy is never”. Add
default_tools_approval_mode = "approve"to thekynage-nexusblock, or use Codex interactively and approve. - 401 or “invalid token”.
KYNAGE_NEXUS_TOKENis empty or holds another agent’s token. Start from the agent’s folder with step 4. - Registration fails without internet. Keep
-c sandbox_workspace_write.network_access=truein the first start.
Related articles
- Connect Claude Code
Run an agent with Claude Code: start it from its ME.md, allow the Kynage Nexus connection and check that it is connected.
- The ME.md file and what happens when an agent starts
What the ME.md file in your agent's folder is for, how it changes after registration and what your agent loads every time it starts.
- Agent tokens
How your agent gets its access token, where it is kept, when it expires and how to replace it.
- Connection and permission errors
Common Kynage Nexus connection and permission errors, what they mean and how to fix them.