Skip to content
Last updated

Getting Started for AI Agents

The Treasure Data documentation and platform are accessible through Claude Code and other MCP-compatible AI tools via the Model Context Protocol (MCP). This allows AI assistants to access documentation and interact with your Treasure Data environment directly.

Benefits

  • Real-time documentation access: AI assistants receive accurate, contextual help about Treasure Data products and features.
  • Platform interaction: AI assistants can query databases, manage segments, run workflows, and more.
  • Dynamic API guidance: AI assistants can extract and explain API reference content based on user needs.

Ask AI (Documentation Assistant)

The Treasure Data documentation site includes a built-in AI assistant that can answer questions about products, features, and APIs directly from the documentation.

How to Use

  1. Click the Ask AI button in the bottom-right corner of any documentation page.
  2. Type your question in natural language.
  3. The AI assistant searches the documentation and provides relevant answers with source links.

You can also access Ask AI through the Search modal in the top navigation bar.

What You Can Ask

The AI assistant indexes and searches all documentation content:

  • Product guides: Complete documentation for all Treasure Data products
  • API references: OpenAPI specifications and endpoint details
  • Integration guides: Setup instructions for data sources and destinations
  • Best practices: Implementation patterns and recommendations

Example Questions

How do I set up a Parent Segment?
What integrations are available in Integration Hub?
How does Real-Time ID Stitching work?
What are the differences between Trino and Hive?
How do I create a customer journey?

The AI assistant provides answers based on the latest documentation content, with links to the relevant pages for more details.


MCP Servers

For developers and AI tools, Treasure Data provides two MCP servers for different use cases:

MCP ServerPurposeWhat You Can Do
TD Docs MCPDocumentation searchAsk questions about Treasure Data products and features
tdx MCPPlatform interactionQuery databases, manage segments, run workflows, and more

TD Docs MCP Server

Use the TD Docs MCP server to explore documentation and discover APIs.

The server is registered at: https://docs.treasuredata.com/mcp

Available Tools

Documentation Tools

ToolParametersDescription
list-apisname?: stringLists available APIs with their context and purpose.
get-endpointsname: stringReturns all endpoints and their descriptions for a specific API.
get-endpoint-infoname: string, path: string, method: stringReturns comprehensive information about a specific endpoint, including parameters, security, and examples.
get-security-schemesname: stringGets the security schemes for a specific API.
get-full-api-descriptionname: stringReturns the complete OpenAPI description.

Search Tools

ToolParametersDescription
searchquery: stringSearches documentation and returns relevant content for a query.

Use the MCP Server

Users can connect their preferred AI tools that support MCP (for example, Cursor, Claude Code, and VS Code) to the TD Docs MCP server.

  1. Copy the MCP server URL: https://docs.treasuredata.com/mcp
  2. Add it to your tool using the instructions below.

After connecting, the tool can access Treasure Data documentation and API references.

Connect Cursor to the MCP Server

  1. In Cursor, open the command palette.
    • macOS: Command + Shift + P
    • Windows/Linux: Ctrl + Shift + P
  2. Type "Open MCP settings" in the command palette.
  3. Select "Add custom MCP".

Cursor opens the mcp.json file.

Configure the MCP Server

  1. In mcp.json, add the server configuration:
{
  "mcpServers": {
    "td-docs": {
      "url": "https://docs.treasuredata.com/mcp"
    }
  }
}
  1. Save the mcp.json file.
  2. Return to MCP settings and confirm the connection.

After connecting, Cursor displays the list of available tools.

Test the Cursor Connection

In Cursor chat (Agent mode), ask a question that triggers an MCP tool:

How do I configure Real-Time ID Stitching?

tdx MCP Server

The tdx CLI provides an MCP server that enables AI tools to interact with your Treasure Data environment directly.

Setup

First, install and authenticate tdx:

# Install tdx
npm install -g @treasuredata/tdx

# Authenticate
tdx auth setup

Available Tools

ToolParametersDescription
tdx_runargs: string[]Execute any tdx CLI command. Returns JSON output.
tdx_searchquery: string, category?: stringSearch for relevant tdx commands based on what you want to do.

Categories for tdx_search: Data, CDP, AI, Context, Utilities

Use the MCP Server

Connect Cursor to the tdx MCP Server

  1. In Cursor, open the command palette (Command + Shift + P or Ctrl + Shift + P).
  2. Type "Open MCP settings" and select "Add custom MCP".

Configure the MCP Server

In mcp.json, add the tdx server configuration:

{
  "mcpServers": {
    "tdx": {
      "command": "tdx",
      "args": ["mcp"]
    }
  }
}

Without global install (using npx):

{
  "mcpServers": {
    "tdx": {
      "command": "npx",
      "args": ["@treasuredata/tdx", "mcp"]
    }
  }
}

To use a specific profile:

{
  "mcpServers": {
    "tdx": {
      "command": "tdx",
      "args": ["mcp"],
      "env": {
        "TDX_PROFILE": "my-profile"
      }
    }
  }
}

Example Conversation

Once configured, you can have conversations like:

> What databases are available in Treasure Data?

AI uses tdx_run with args: ["databases"]

> Show me the schema for the users table in mydb

AI uses tdx_run with args: ["describe", "mydb.users"]

> Run a query to find the top 10 users by order count

AI uses tdx_run with args: ["query", "SELECT user_id, COUNT(*) as orders
  FROM mydb.orders GROUP BY user_id ORDER BY orders DESC LIMIT 10"]

> Create a segment for users who made a purchase in the last 30 days

AI uses tdx_search to find segment commands, then tdx_run to create the segment

tdx claude: All-in-One Setup

For Treasure Data customers, the easiest way to get started is using tdx claude, which provides:

  • TD LLM Proxy integration: Use your existing AI Suite credits
  • Pre-configured TD Skills: Enhanced capabilities for SQL, workflows, and CDP operations
  • Documentation search: Built-in access to TD documentation

Quick Start

# Install tdx and Claude Code
npm install -g @treasuredata/tdx
curl -fsSL https://claude.ai/install.sh | bash

# Authenticate with Treasure Data
tdx auth setup

# Launch Claude Code with TD integration
tdx claude

Example Conversations

Once inside Claude Code via tdx claude:

> How to set up data ingestion to TD from Snowflake?

> Analyze mydb.user_events data

> Write a workflow to periodically import data from S3

> Create a SQL query to find top customers by revenue

> Build a user segment for customers who purchased in the last 30 days

TD Skills for Enhanced AI Assistance

TD Skills are pre-built Claude Code plugins that enhance AI assistance for Treasure Data workflows:

Skill CategoryWhat It Helps With
SQL SkillsTrino/Hive syntax, TD-specific functions, query optimization
Workflow SkillsDigdag workflows, scheduling, dbt integration
tdx SkillsSegments, journeys, activations, AI agents

All TD Skills are automatically available when using tdx claude.


Learn More