# Codex CLI MCP setup

> Source: <https://adaptorch.com/integrations/codex/>
> Published: 2026-11-25 08:34:29+00:00

**Key takeaway:** Codex CLI reads MCP servers from TOML in ~/.codex/config.toml, so an AdaptOrch entry needs `url = "https://adaptorch.com/mcp"` plus `bearer_token_env_var = "ADAPTORCH_API_KEY"` to keep the key out of the file, and a `tools/list` call verifies auth without spending plan allowance.

INTEGRATION · UPDATED

# Connect Codex CLI to AdaptOrch in config.toml.

Codex CLI reads MCP servers from `~/.codex/config.toml`. The AdaptOrch entry points Codex at the hosted endpoint and reads your AdaptOrch key from an environment variable. No free hosted LLM is bundled; BYOK provider headers are optional.

§ 01

## Before you start

Create an account at [/app/signup](https://adaptorch.com/app/signup?entrypoint=integration-codex) and an API key at /app/api-keys. Authenticate with your AdaptOrch API key. No free hosted LLM is bundled; BYOK provider headers are optional when you want model calls. Set the key only in your local environment, never in a shared transcript or committed file.

```
export ADAPTORCH_API_KEY="ado_..."
```

§ 02

## Configure Codex CLI

Merge the block into `~/.codex/config.toml` without replacing existing servers. The file is TOML, not JSON. After setup, check the server list with `/mcp` inside Codex.

```
[mcp_servers.adaptorch]
url = "https://adaptorch.com/mcp"
bearer_token_env_var = "ADAPTORCH_API_KEY"
```

Codex reads the AdaptOrch key from the named environment variable, so the key itself never appears in the file. Keep it in your own secret environment. To use your own provider account instead (BYOK), also set ADAPTORCH_PROVIDER, ADAPTORCH_PROVIDER_MODEL and ADAPTORCH_PROVIDER_KEY, and add `env_http_headers` that map X-Provider, X-Provider-Model and X-Provider-Key to those variable names.

§ 03

## Confirm authentication without running a model

This read-only `tools/list` request checks the endpoint and your AdaptOrch key. It does not submit a run or spend plan allowance. A valid key returns a `result.tools` array that includes `adaptorch_run`. Without a key the endpoint answers HTTP 401 with `Missing bearer token`, which still proves it is reachable.

```
curl --fail --silent --show-error https://adaptorch.com/mcp \
  -H "Authorization: Bearer $ADAPTORCH_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Accept: application/json, text/event-stream" \
  -d '{"jsonrpc":"2.0","id":1,"method":"tools/list"}'
```

§ 04

## Submit one bounded run

Ask Codex CLI to call `adaptorch_run` once with the single-task payload below. This consumes plan allowance; optional BYOK model tokens are billed by your provider. Do not resubmit it while polling.

```
{
  "payload": {"subtasks": [{"id": "ping", "description": "Reply exactly PONG", "estimated_tokens": 16}]},
  "synthesis_mode": "paper",
  "budget_policy": {"global_timeout_budget_seconds": 20}
}
```

Use the returned `run_id` with `adaptorch_get_run` and `adaptorch_get_artifacts`, or open /app/runs.

§ 05

## What the record shows, and what it does not

The run record shows the inputs, the selected model and outputs, recorded commands and check outcomes when an execution environment is configured, and open review items. A SUCCEEDED run is not a test pass: a repository code check needs a separately configured execution environment, and missing or skipped checks stay unverified.

AdaptOrch documents the Codex CLI configuration format above, but this connection has not been tested by AdaptOrch end to end in Codex CLI. Read the [claim boundary](https://adaptorch.com/claim-boundary) before relying on run records in a review process, and see the [AI PR review guide](https://adaptorch.com/ai-pr-review/) for what to inspect.

§ 06

## Codex CLI integration FAQ

## Q.01Where does Codex CLI configure MCP servers?

In ~/.codex/config.toml under an [mcp_servers.<name>] table. AdaptOrch uses [mcp_servers.adaptorch] with url and bearer_token_env_var. Provider headers are optional for BYOK.

## Q.02Is the Codex configuration JSON?

No. Codex CLI uses TOML. A JSON mcpServers block from another client will not work in config.toml.

## Q.03Does a SUCCEEDED run mean my tests passed?

No. A completed run is not a test pass. A repository code check needs a separately configured execution environment, and only a record that shows the check actually ran counts as verification.

## Q.04Has AdaptOrch tested this client?

AdaptOrch documents this configuration format, but the connection has not been tested by AdaptOrch end to end in this client. Confirm it with the read-only tools/list request on this page.

NEXT

## Other clients

See all [AdaptOrch integrations](https://adaptorch.com/integrations/), or the full [MCP documentation](https://adaptorch.com/mcp-docs) for Gemini CLI, VS Code and Windsurf configuration formats.

Pro is $39 a month for 200 admitted runs and 5 workspace users. Team is $149 a month for 1,000 admitted runs and 15 workspace users. Both start with a 3-day free trial. No free hosted LLM is bundled; bringing your own API key and endpoint (BYOK) is optional. [Compare plans](https://adaptorch.com/#pricing) · [Start a 3-day free trial](https://adaptorch.com/app/signup?entrypoint=integration-codex)
