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

# Using Codex

# Using Codex with Marrow

Use Codex when you want an OpenAI coding agent that can read your synced Marrow store and ad data.

**Recommended:** connect via OAuth from AI Platforms. Use MCP only if you prefer a key-based config or OAuth is unavailable for your setup.

## Prerequisites

* At least one data source connected in [Integrations](../Marrow%20Basics/Features/Integrations.md) and syncing in [Data Explorer](../Marrow%20Basics/Features/Data%20Explorer.md)
* A Codex account (CLI, IDE extension, or ChatGPT desktop Codex — they share MCP config)
* For MCP: an MCP key from [AI Platforms](../Marrow%20Basics/Features/AI%20Platforms.md)

## Option A: OAuth (recommended)

1. In Marrow, open **AI Hub → AI Platforms**.
2. Under **Quick connection: OAuth**, select **Codex**.
3. Click **Connect** and complete the authorization steps.
4. Confirm a session appears under **OAuth sessions**.

If Codex is already connected via OAuth, you do **not** need to add Marrow again via MCP.

## Option B: MCP

### Step 1: Get Marrow credentials

From **AI Platforms**:

* MCP server URL: `https://mcp.marrow.ai/mcp/v1`
* Create an **MCP key** and copy it (shown only once)

### Step 2: Add the Marrow MCP server

Add this to `~/.codex/config.toml` (global) or `.codex/config.toml` (project-scoped):

```toml theme={null}
[mcp_servers.marrow]
url = "https://mcp.marrow.ai/mcp/v1"
bearer_token_env_var = "MARROW_MCP_KEY"
startup_timeout_sec = 30
```

Then set the environment variable to your MCP key (do not hard-code the key in the file):

```bash theme={null}
export MARROW_MCP_KEY="YOUR_MCP_KEY"
```

Alternatively, you can use static headers:

```toml theme={null}
[mcp_servers.marrow]
url = "https://mcp.marrow.ai/mcp/v1"
http_headers = { "Authorization" = "Bearer YOUR_MCP_KEY" }
startup_timeout_sec = 30
```

### Step 3: Reload Codex

Restart your Codex session (or reload the IDE extension) so it picks up the new server.

### Step 4: Test the connection

```
Show me my Amazon Seller sales for the last 7 days.
```

If Codex returns real numbers from your synced accounts, you are connected.

## Security

* Marrow is **read-only** — it never posts or changes store/ad settings.
* Prefer `bearer_token_env_var` over pasting keys into committed config files.
* Revoke the OAuth session or rotate the MCP key from AI Platforms when needed.

## Related

* [MCP overview](./MCP.md)
* [AI Platforms](../Marrow%20Basics/Features/AI%20Platforms.md)
* [Skills](../Marrow%20Basics/Features/Skills.md)
