# Connect Codex to Aria

> Add Aria's MCP server to OpenAI Codex in ~/.codex/config.toml with a bearer token variable. Exact TOML, the aria mcp add shortcut, and a test.

Source: https://getaria.cloud/docs/agents/codex (updated 1 November 2026)

To connect Codex, add a `[mcp_servers.<name>]` table to `~/.codex/config.toml` with the Aria address as its `url` and the name of an environment variable that holds your key as `bearer_token_env_var`. The server address is `https://api.getaria.cloud/mcp/w/<app id>`. Codex sends the key as a Bearer token.

## What is the quickest way?

```bash
aria login
aria mcp add --agent codex
```

The command asks you to approve a new key in Aria, then adds the server to `~/.codex/config.toml`. With `--app wsp_YOURAPP` it also installs the Aria skill for Codex. It sets the file so that only you can read it, because it writes the key into the file.

## How do I add it by hand?

Make a key under **AI & MCP**, then **Make a key**. Put the key in an environment variable, then add the server to the config.

```bash
export ARIA_MCP_KEY=YOUR_KEY
```

```toml
[mcp_servers.aria-myapp]
url = "https://api.getaria.cloud/mcp/w/wsp_YOURAPP"
bearer_token_env_var = "ARIA_MCP_KEY"
```

Replace `aria-myapp` with any name and `wsp_YOURAPP` with your app's id. Codex reads `ARIA_MCP_KEY` when it starts, so export it in your shell profile or in the environment you launch Codex from.

## Can I put the key in the file?

You can, with a static header. This is what Aria's own command writes, so keep the file private:

```toml
[mcp_servers.aria-myapp]
url = "https://api.getaria.cloud/mcp/w/wsp_YOURAPP"
http_headers = { Authorization = "Bearer YOUR_KEY" }
```

```bash
chmod 600 ~/.codex/config.toml
```

Never commit this file.

## How do I check that it works?

```bash
codex mcp list
```

`aria-myapp` should be in the list. Then start Codex and ask:

```text
Use Aria to show the status of this app.
```

## What should I ask it to do?

```text
Call get_stack_prompt, read this repository, write aria.yaml, check it with validate_stack_file, then save it with submit_stack_file. Ask me to enter any secret values; never print them.
```

Saving the file does not deploy it. Deploy with `aria deploy --wait`. Launching and changing variables wait for your approval in Aria. See the [safety model](https://getaria.cloud/docs/mcp).

Next: [The aria command line](https://getaria.cloud/docs/cli)
