---
title: Codex
description: "Connect the Codex CLI and the Codex IDE extension to the platform through config.toml, with clika-cli mcp install, with codex mcp add, or by hand, then check the connection and remove it."
---

Connect the Codex CLI or the Codex IDE extension to the CLIKA Platform and you can ask it about your devices and benchmarks while you work. Both read one config file, `~/.codex/config.toml` (`$CODEX_HOME/config.toml` when `CODEX_HOME` is set, `%USERPROFILE%\.codex\config.toml` on Windows), and one entry there connects both. There are three ways to add it; pick one.

| Way | Use it when | Where the API key lives |
| --- | --- | --- |
| [`clika-cli mcp install`](#register-with-the-clika-cli-recommended) (recommended) | You use the CLIKA CLI. | In your CLIKA CLI profile. `config.toml` holds no key. |
| [`codex mcp add`](#add-it-with-codex-mcp-add) | You do not use the CLIKA CLI. | In an environment variable Codex reads when it starts. |
| [An entry by hand](#add-the-entry-by-hand) | You manage the config file yourself. | In your CLIKA CLI profile. |

Each needs an [API key](index.md#you-need-an-api-key).

ChatGPT Desktop reads the same file. An entry added on this page shows up there too, and a server added in ChatGPT Desktop's Settings ([ChatGPT Desktop](chatgpt-desktop.md)) is one Codex uses as well.

## Register with the CLIKA CLI (recommended)

With the CLIKA CLI installed and logged in ([Get started with the CLI](../cli/get-started.md)), one command registers the platform:

```bash
clika-cli mcp install codex
```

If a Codex session or ChatGPT Desktop is running, the command says so: restart it to load the server.

What the command does:

- It first checks the profile's key with one request to the deployment. If the profile has no key or the deployment refuses it, the command offers to log in when it runs at a terminal, and prints the `login` command to run otherwise.
- It adds a `[mcp_servers.clika-platform]` table to `config.toml`. Every other table and key in the file keeps its place and formatting.
- The entry is an HTTP connection to `<base-url>/api/mcp`. Its `Authorization` header comes from `http_headers_helper`: a command Codex runs to get the header, here `clika-cli --profile default mcp headers`, which prints it from the CLIKA CLI profile. The API key never lands in `config.toml`, and a new key needs a new `clika-cli login` and no change to the entry.

Useful flags:

| Flag | What it does |
| --- | --- |
| `--profile staging` | Registers another deployment's profile. |
| `--name clika-staging` | Picks the entry's name. |
| `--dry-run` | Prints the entry without writing it. |
| `--insecure-tls` | For a deployment with a self-signed certificate: the entry runs the CLIKA CLI as a local bridge (`mcp --remote`) instead of connecting over HTTP. [Troubleshooting](troubleshooting.md#a-self-signed-certificate-on-premise) explains why. |

The [CLI reference](../cli/mcp.md#mcp-install-uninstall-status-and-headers) lists every flag.

## Add it with `codex mcp add`

Without the CLIKA CLI, register the endpoint with Codex's own command:

```bash
codex mcp add clika-platform --url https://platform.clika.io/api/mcp --bearer-token-env-var CLIKA_API_KEY
```

- Codex has no option to write the header itself. `--bearer-token-env-var` names an environment variable, and Codex sends its value as the bearer token each time it starts the server. The entry in `config.toml` holds the variable's name, `bearer_token_env_var = "CLIKA_API_KEY"`, not the key.
- Set `CLIKA_API_KEY` to your API key wherever Codex runs, for example with `export CLIKA_API_KEY=clika_your_api_key` in your shell's profile on macOS and Linux, or `setx CLIKA_API_KEY clika_your_api_key` on Windows and then a new terminal. The Codex IDE extension sees the variable only when the editor was started from an environment that has it.
- A new key means changing the variable, with no change to the entry.
- `codex mcp add` has no option to skip certificate verification. On a deployment with a self-signed certificate, register with `clika-cli mcp install codex --insecure-tls` instead ([Troubleshooting](troubleshooting.md#a-self-signed-certificate-on-premise)).

## Add the entry by hand

Log in with the CLIKA CLI first (`clika-cli --base-url https://platform.clika.io login`). Then add the table to `config.toml`:

```toml
[mcp_servers.clika-platform]
url = "https://platform.clika.io/api/mcp"
http_headers_helper = "/usr/local/bin/clika-cli --profile default mcp headers"
```

- Use the CLIKA CLI's absolute path. On Windows that is the path the installer printed after `installed clika-cli to`. A TOML literal string in single quotes keeps its backslashes as they are, for example `'C:\Users\you\AppData\Local\Programs\clika\bin\clika-cli.exe --profile default mcp headers'`.
- If a Codex session or ChatGPT Desktop is running, restart it.
- An entry you write by hand is yours: `mcp install` and `mcp uninstall` never change or remove it. If it uses the name `clika-platform`, `mcp install` refuses that name and asks for `--name`.

### A server added in ChatGPT Desktop

ChatGPT Desktop saves the server as a `[mcp_servers.clika-platform]` table with the API key in its `http_headers`, in plain text. Like an entry written by hand, it is yours: `mcp install` and `mcp uninstall` never change or remove it, and `mcp install` refuses the name `clika-platform` while it exists and asks for `--name`.

## Check the connection

`clika-cli mcp status` reports, for each client, whether `mcp install` registered the server, under which name and profile, and which config file it read. Then start a Codex session and ask:

> Which of my Clika Platform devices are online?

The answer comes from the device list tool, `get_devices`. If the tools do not appear, see [Troubleshooting](troubleshooting.md).

## Remove it

Remove the entry the way you added it:

| Added with | Remove with |
| --- | --- |
| `clika-cli mcp install` | `clika-cli mcp uninstall codex`. It deletes the tables it added for the profile and leaves the rest of the file as it was. |
| `codex mcp add` | `codex mcp remove clika-platform`, then unset `CLIKA_API_KEY` if nothing else uses it. |
| ChatGPT Desktop's Settings | ChatGPT Desktop ([Remove it](chatgpt-desktop.md#remove-it)). |
| By hand | Delete the table from `config.toml`. |

If a Codex session or ChatGPT Desktop is running, restart it. If no other client uses the API key, revoke it under **Settings**, then **Developer access**.
