Skip to content
Last updated

Connecting OpenAI Codex to Treasure AI

OpenAI Codex is OpenAI's CLI coding agent. Connect it to Treasure AI's MCP Server (Platform) to query databases, build segments, and debug workflows from natural-language prompts in your terminal. This page covers installing the tdx CLI, registering it as an MCP server in Codex, and adding TD Skills for CDP-specific guidance.

Documentation Search

Codex connects to MCP Server (Platform) for platform operations. MCP Server (Docs) (documentation search over HTTP) is not currently documented for Codex — the setup below covers platform access only.

Prerequisites

  • OpenAI Codex CLI installed and authenticated
  • Node.js and npm
  • A Treasure AI account with API access

Install and Authenticate tdx

npm install -g @treasuredata/tdx
tdx auth setup

Add the MCP Server to Codex

codex mcp add tdx -- tdx mcp

To share the connection with your team, commit the server configuration to your repository instead of running the command per machine:

# .codex/config.toml — commit to your repo
[mcp_servers.tdx]
command = "tdx"
args = ["mcp"]

Each teammate still runs tdx auth setup individually to authenticate.

Install TD Skills

TD Skills give Codex CDP-specific guidance for SQL, workflows, and segment/journey syntax.

codex plugin marketplace add treasure-data/td-skills
codex plugin add tdx-skills@td-skills
codex plugin add sql-skills@td-skills
codex plugin add workflow-skills@td-skills

Start a new Codex session before using the installed skills. See TD Skills for the full skill catalog and additional plugins.

Try It

Ask Codex a question that requires querying your data:

> Which of our databases has last week's web events?

Next Steps