# Connect Aroai to OpenAI Codex

Wire OpenAI Codex CLI or App to Aroai Streamable HTTP tools using codex mcp add or ~/.codex/config.toml.

Canonical: https://aroai.com/integrations/codex/

```text
codex mcp add aroai --url https://mcp.aroai.com/v1 --bearer-token-env-var AROAI_API_KEY
```

## At a glance

- **CLI command**: codex mcp add aroai --url https://mcp.aroai.com/v1 --bearer-token-env-var AROAI_API_KEY
- **Config file**: ~/.codex/config.toml
- **Env variable field**: bearer_token_env_var holds the NAME of your env var ("AROAI_API_KEY"), not the key value

## Setup configurations

### Manual ~/.codex/config.toml block

Equivalent TOML configuration for global or project .codex/config.toml (reads AROAI_API_KEY from environment).

```text
[mcp_servers.aroai]
url = "https://mcp.aroai.com/v1"
bearer_token_env_var = "AROAI_API_KEY"
```

## What happens once connected

- Codex injects server instructions along with tool names and JSON schemas at startup so tasks can query official NZ/AU rates and rules alongside repository code.

## Prompts to try

- **Verify in Codex**: "Call aroai_status and verify my workspace connection."
- **Validate tax rules for billing code**: "Check current NZ income tax bracket thresholds and ACC earner levy rules using Aroai before reviewing our calculator implementation."

## Troubleshooting

### Codex returns an auth error even though config.toml is saved.

Check that bearer_token_env_var is set to the environment variable name "AROAI_API_KEY" (not the secret string itself), and that AROAI_API_KEY is set in the shell session launching Codex.
