Skip to content
Last updated

Connecting Claude Code to Treasure AI

Claude Code is Anthropic's CLI for agentic coding. Connect it to Treasure AI to query databases, build segments, debug workflows, and search documentation from natural-language prompts, without switching to the TD Console.

Our Claude Code integration supports two billing patterns — Treasure AI's AI Credits or your own Anthropic Enterprise subscription.

Prerequisites

  • Claude Code installed
  • Node.js and npm
  • A Treasure AI account with API access

Quick Start 1: with Treasure AI Subscription

Use this pattern if you don't have your own Claude subscription, or want to bill Claude Code usage through Treasure AI. tdx claude launches Claude Code pre-configured with Treasure AI's AI Credits billing, TD Skills, and documentation search already installed — no separate Claude Code subscription required.

npm install -g @treasuredata/tdx
tdx auth setup
tdx claude

Once inside, ask Claude Code to operate on your data:

> Create a segment of customers who abandoned their cart in the last 7 days

● Reading parent segment schema (tdx ps describe)
● Drafting rules → cart_abandoners_7d.yml
● Validating (tdx sg validate) ✓ 128,540 profiles matched

✓ Segment "Cart Abandoners – 7d" pushed to production.

For command-level details on what tdx claude configures, see the tdx claude command reference.

Quick Start 2: with Your Anthropic Subscription

Use this pattern if your organization already has an Anthropic Enterprise, AWS Bedrock, or Vertex AI subscription for Claude Code and wants to keep billing there.

With the --no-proxy option, it launches your existing Claude Code account with TD Skills and documentation search pre-configured. See the tdx claude command reference for the full list of options.

npm install -g @treasuredata/tdx
tdx auth setup
tdx claude --no-proxy

Alternatively, you can manually install skills to your Claude Code setup. See TD Skills for the full skill catalog and single-skill install commands.

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

Additionally, you need to let Claude Code search Treasure AI documentation directly via MCP Server (Docs) for solving errors quickly and reliably.

claude mcp add td-docs https://docs.treasure.ai/mcp --transport http

Verify the connection with /mcp in the Claude Code CLI — it lists td-docs with its available tools.

Next Steps