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

# Codex (OpenAI)

> Connect OpenAI Codex CLI to Chartcastr via MCP and access your data sources and connections from your terminal.

## Overview

[OpenAI Codex](https://github.com/openai/codex) is an open-source AI coding agent that runs in your terminal. It supports MCP servers, letting you give Codex read access to your Chartcastr account data.

## Prerequisites

* Codex CLI installed (`npm install -g @openai/codex` or `pip install openai-codex`)
* A Chartcastr account on any paid plan
* An API key from **Settings → API Keys**

<Note>
  Codex MCP support and config format may change as the project is actively developed. Always check the [official Codex docs](https://github.com/openai/codex) for the latest instructions.
</Note>

## Setup

### 1. Generate an API key

In Chartcastr, go to **Settings → API Keys** and create a new key.

### 2. Add Chartcastr to your Codex config

Create or edit `~/.codex/config.yaml`:

```yaml theme={null}
mcpServers:
  chartcastr:
    command: npx
    args:
      - "-y"
      - "mcp-remote"
      - "https://api.chartcastr.com/api/mcp"
      - "--header"
      - "X-API-Key:YOUR_API_KEY"
```

Replace `YOUR_API_KEY` with the key you generated in step 1.

If Codex uses a JSON config instead, use this format:

```json theme={null}
{
  "mcpServers": {
    "chartcastr": {
      "command": "npx",
      "args": [
        "-y",
        "mcp-remote",
        "https://api.chartcastr.com/api/mcp",
        "--header",
        "X-API-Key:YOUR_API_KEY"
      ]
    }
  }
}
```

### 3. Run Codex

Start Codex in your terminal. It will automatically connect to any configured MCP servers at startup:

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

## Available Tools

| Tool                | Description                                           |
| ------------------- | ----------------------------------------------------- |
| `list_sources`      | List all data sources connected to your account       |
| `list_destinations` | List all configured destinations (Slack, email, etc.) |
| `list_connections`  | List all active chart delivery connections            |
| `get_latest_pulse`  | Fetch the most recent AI analysis for a connection    |
| `verify_connection` | Confirm a connection is active                        |
| `open_chartcastr`   | Generate a deep link to open Chartcastr               |

## Example Prompts

* *"What Chartcastr sources do I have?"*
* *"List my active connections and their schedules."*
* *"Get the latest pulse from my Google Sheets connection."*

## Further Reading

* [OpenAI Codex on GitHub](https://github.com/openai/codex) — source, docs, and config reference
* [Chartcastr API Keys](https://chartcastr.com/admin/settings/api-keys?create=true) — manage your keys
