Behavry Integration — OpenAI Codex CLI
OpenAI Codex CLI speaks MCP over Streamable HTTP. It connects to Behavry's unified MCP gateway (/mcp/v1) with the agent's client credentials as an HTTP Basic header. Configuration lives in ~/.codex/config.yaml.
Prerequisites
- A running Behavry instance (your control-plane URL, or
http://localhost:8000for a local stack) - Codex CLI installed
- An enrolled agent (gives you the
client_id/client_secret)
1. Enroll the agent
In the dashboard: Agents → Enroll Agent → Codex CLI (OpenAI). Behavry provisions the agent and shows the config block with credentials filled in.
2. Config block
Add to ~/.codex/config.yaml:
mcp_servers:
behavry:
url: https://<your-behavry-host>/mcp/v1
transport: streamable-http
headers:
Authorization: "Basic <base64(client_id:client_secret)>"
The Authorization value is Basic + base64 of client_id:client_secret — the dashboard computes it for you. Point at the single gateway endpoint /mcp/v1, not a per-server path.
Verify
- Run
codexin a project directory and invoke a tool - The tool call appears in the dashboard → Live Activity with a policy result
Troubleshooting
401 Unauthorized — Credentials wrong or agent revoked. Re-enroll and paste the fresh block.
Server not connecting — Confirm the url ends in /mcp/v1 and the backend is reachable: curl https://<your-behavry-host>/health.