> ## Documentation Index
> Fetch the complete documentation index at: https://developers.klarity.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Codex

> Register the Klarity MCP server with the OpenAI Codex CLI.

Two install paths are supported. The plugin path is preferred — it ships the bundled skill prompt and uses OAuth.

## Plugin install (preferred, OAuth)

Codex splits this into a shell command to register the marketplace, then a slash command inside Codex to install the plugin.

<Steps>
  <Step title="Add the marketplace from your shell">
    ```bash theme={null}
    codex plugin marketplace add Klarity-AI/klarity-mcp
    ```
  </Step>

  <Step title="Install the plugin from a Codex session">
    Open the plugins picker:

    ```text theme={null}
    /plugins
    ```

    Search for **klarity** and install the plugin.
  </Step>

  <Step title="Sign in">
    The first request that hits a Klarity tool will prompt you to authenticate.
  </Step>
</Steps>

## Config file install (API key)

Use this for long-running background agents. Generate an API key from `Settings → MCP` in your Klarity workspace (see [Authentication](/authentication#api-key)) and add the server to `~/.codex/config.toml`:

```toml theme={null}
[mcp_servers.klarity]
url = "https://api.klarity.ai/mcp"
bearer_token_env_var = "KLARITY_MCP_TOKEN"
```

Set the environment variable in your shell profile (`~/.zshrc`, `~/.bashrc`):

```bash theme={null}
export KLARITY_MCP_TOKEN=<YOUR_API_KEY>
```

Restart your terminal (or source the profile) so Codex picks up the new variable.

<Warning>
  Treat the API key like a password. Rotate it from `Settings → MCP` in Klarity if it's exposed.
</Warning>

## Verify

In a Codex session, ask:

```text theme={null}
Search Klarity for AI transformation opportunities across our processes — where could we build skills or deploy agents?
```

The assistant should call `search` and return process results from your workspace.
