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

  1. 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.

  2. 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_TOKEN

    Check it with codex mcp list. You should see: kynage-nexus https://gate.kynage.com/mcp KYNAGE_NEXUS_TOKEN enabled Bearer token.

  3. Allow the Kynage Nexus tools. codex exec runs without asking you, so Codex must be allowed to use the Kynage Nexus tools. Open ~/.codex/config.toml and add this line to the [mcp_servers.kynage-nexus] block:

    default_tools_approval_mode = "approve"
  4. 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

Setup Assistant, step 5: download the ME.md for your Codex agentSetup Assistant, step 5: download the ME.md for your Codex agent

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 the kynage-nexus block, or use Codex interactively and approve.
  • 401 or “invalid token”. KYNAGE_NEXUS_TOKEN is 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=true in the first start.

Related articles