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

# Connect to Codex CLI

> Use V5 Gateway tools in OpenAI Codex CLI agentic sessions

## Prerequisites

* Codex CLI installed (`npm install -g @openai/codex`)
* A V5 bearer token — get one from `POST /admin/tokens/issue`

## Setup

<Steps>
  <Step title="Add the V5 server to Codex config">
    Codex reads MCP config from `.codex/config.json` at the project root:

    ```json .codex/config.json theme={null}
    {
      "mcpServers": {
        "ascend": {
          "type": "http",
          "url": "https://ascend-gateway-v5.ascendgtm.workers.dev/mcp",
          "headers": {
            "Authorization": "Bearer ${ASCEND_GATEWAY_TOKEN}"
          }
        }
      }
    }
    ```

    The `ascend-gtm-ops` repo includes this file pre-configured.
  </Step>

  <Step title="Set your token">
    ```bash theme={null}
    export ASCEND_GATEWAY_TOKEN=<your-token>
    # Add to ~/.zprofile to persist
    ```
  </Step>

  <Step title="Verify">
    ```bash theme={null}
    codex "What are my top HubSpot deals by amount?"
    ```

    Codex should call `hubspot_crm` and return results.
  </Step>
</Steps>

## TOML config (alternative)

Codex also reads `.codex/config.toml`:

```toml .codex/config.toml theme={null}
[mcpServers.ascend]
type = "http"
url = "https://ascend-gateway-v5.ascendgtm.workers.dev/mcp"

[mcpServers.ascend.headers]
Authorization = "Bearer ${ASCEND_GATEWAY_TOKEN}"
```

## Agentic mode with V5

Codex works best in full-auto mode for GTM data tasks:

```bash theme={null}
codex --full-auto "Pull last week's Google Ads performance, identify the top 3 campaigns by ROAS, and write a summary I can paste into Slack."
```

With V5 connected, Codex can call `google_ads_query`, `ga4_report`, and format the output — all in one command.

## Notes

* Codex has no session hook — manually update `HANDOVER.md` after multi-step sessions
* Bearer token auth (no OAuth flow) — suitable for scripts and CI
