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

# Connect Hoard to OpenAI Codex

> Use Hoard from the OpenAI Codex CLI.

Connect Hoard to the OpenAI Codex CLI so you can drive your store from the terminal.

## What you'll need

* A paid plan ([Gold, Platinum, or Diamond](https://www.tryhoard.com/pricing))
* The OpenAI [Codex CLI](https://github.com/openai/codex) installed and signed in

## Pick your path

Codex authenticates against remote MCP servers in two ways depending on how you use it. Pick the one that matches your setup.

| If you're using...                                  | Use this section                  |
| --------------------------------------------------- | --------------------------------- |
| The Codex plugin / marketplace UI (browser sign-in) | [OAuth](#oauth-plugin-ui)         |
| The `codex mcp` CLI (terminal-only)                 | [Bearer token](#bearer-token-cli) |

The bearer-token path works for both. The OAuth path does not work for the CLI runner — it currently reports `Auth: Unsupported` for OAuth-only servers in `codex mcp list`.

## OAuth (plugin UI)

<Steps>
  <Step title="Edit your Codex config">
    Open `~/.codex/config.toml` (create it if it doesn't exist) and add:

    ```toml theme={null}
    [mcp_servers.hoard]
    url = "https://mcp.tryhoard.com/mcp"
    ```
  </Step>

  <Step title="Run Codex">
    Start a Codex session:

    ```bash theme={null}
    codex
    ```

    The first time you use a Hoard tool, Codex opens your browser to sign in. Sign in to Hoard and click **Allow**.
  </Step>

  <Step title="Try it out">
    Ask Codex:

    > "use hoard: what's my repricing scope set to?"

    Codex calls Hoard via the connector and reports back.
  </Step>
</Steps>

## Bearer token (CLI)

The `codex mcp` CLI does not support OAuth for remote MCP servers. Use your Hoard API key as a bearer token instead.

<Steps>
  <Step title="Grab your API key">
    Open [Settings → Account](https://www.tryhoard.com/settings/account) and copy your API key. It's a 64-character hex string.
  </Step>

  <Step title="Register Hoard with Codex">
    Export the key and register the server in one shot:

    ```bash theme={null}
    export HOARD_API_KEY="<your 64-char key>"
    codex mcp add hoard \
      --url https://mcp.tryhoard.com/mcp \
      --bearer-token-env-var HOARD_API_KEY
    ```

    Make `HOARD_API_KEY` permanent by adding the `export` line to your shell rc file (`~/.zshrc`, `~/.bashrc`).
  </Step>

  <Step title="Verify">
    ```bash theme={null}
    codex mcp list
    ```

    The `hoard` entry should now show `Auth: Bearer (env)` instead of `Auth: Unsupported`.
  </Step>

  <Step title="Try it out">
    Ask Codex:

    > "use hoard: what's my repricing scope set to?"
  </Step>
</Steps>

## Revoking access

* **OAuth path**: Open [Settings → Assistants](https://www.tryhoard.com/settings/connected-apps) in Hoard and click **Revoke** next to the Codex entry.
* **Bearer-token path**: API keys can't be rotated or revoked from Settings today — email [support@tryhoard.com](mailto:support@tryhoard.com) to rotate or revoke your key.
