current_database
Get the current database context being used for queries
Queries Treasure Data in Trino SQL, reads the SQL behind a CDP audience segment, and monitors or retries a failed Digdag workflow.
LABSCO SUMMARY
Queries run as Trino SQL with Treasure Data's own UDFs, and on a large table td_interval keeps a question from scanning years of history. The CDP and workflow tools are what make it more than a SQL client: you can read the SQL that defines an audience, and retry a failed Digdag session from a named task without leaving the conversation.
An MCP server over Treasure Data that opens read-only: catalogue browsing and SELECT queries by default, with writes behind an explicit switch.
A Treasure Data API key in TD_API_KEY, and Node.js 18 or higher. TD_SITE picks the region — us01 by default, with jp01, eu01, ap02, ap03 and dev available — and TD_DATABASE sets a default database. Writes stay off unless TD_ENABLE_UPDATES is true, which is what keeps the execute tool inert on a read-only setup. Run it over stdio with npx @treasuredata/mcp-server. The server is in public preview: free during the preview, with usage-based pricing on query volume planned afterwards.
One command plus a key — npx @treasuredata/mcp-server, then supply credentials
USE CASES
List the databases, then the tables in one, then the columns on the candidate.
Set the database context once, then run the SELECT against it.
Bound the time range with td_interval rather than filtering after the fact.
Find the parent segment, read the SQL behind it, then open the segment's filtering rules.
Find the session, open its attempts, list the tasks, then read the failing task's log.
Cancel what is still running, then retry the session from the task that broke.
Counted once with only startup setup. Other versions, modes or optional credentials may expose a different list.
current_databaseGet the current database context being used for queries
describe_tableGet column information for a specific table
executeExecute write operations (UPDATE, DELETE, INSERT, etc.) when enable_updates=true
get_attempt_tasksList all tasks within an attempt with their execution status
get_parent_segment[EXPERIMENTAL] Get details of a specific parent segment by its ID. Requires parent_segment_id parameter. Use list_parent_segments first to find available parent segment IDs.
get_segment[EXPERIMENTAL] Get detailed information about a specific segment including its filtering rules. Requires both parent_segment_id and segment_id parameters. Use list_parent_segments and list_segments first to find available IDs.
get_session_attemptsGet detailed information about all attempts for a specific session
get_task_logsRetrieve logs for a specific task
kill_attemptRequest cancellation of a running attempt
list_activations[EXPERIMENTAL] List all activations (syndications) for a specific segment. Requires both parent_segment_id and segment_id parameters. Use list_parent_segments and list_segments first to find available IDs.
list_databasesList all available databases in Treasure Data
list_parent_segments[EXPERIMENTAL] List all parent segments (audiences) in Customer Data Platform. No parameters required.
list_projectsList all workflow projects
list_segments[EXPERIMENTAL] List all segments under a specific parent segment. Requires parent_segment_id parameter. Use list_parent_segments first to find available parent segment IDs.
list_sessionsList workflow execution sessions with filtering options
list_tablesList all tables in a specific database
list_workflowsList workflows. Optionally filter by project name.
parent_segment_sql[EXPERIMENTAL] Get the SQL statement for a parent segment (audience). Requires parent_segment_id parameter. Use list_parent_segments first to find available parent segment IDs.
queryExecute a read-only SQL query (SELECT, SHOW, DESCRIBE) using Trino SQL dialect with Treasure Data UDFs. For better performance on large tables, use td_interval(time, '-30d/now') to limit the time range.
retry_attemptRetry a specific failed attempt with resume capabilities
retry_sessionRetry a failed session from the beginning or a specific task
segment_sql[EXPERIMENTAL] Get the SQL statement for a segment with filtering conditions applied to the parent segment (audience) SQL. Requires both parent_segment_id and segment_id parameters. Use list_parent_segments and list_segments first to find available IDs.
use_databaseSwitch the current database context for subsequent queries
BEFORE YOU INSTALL
23 tools when we connected. execute, the only SQL-writing tool, refuses unless TD_ENABLE_UPDATES=true (default false). The CDP and Digdag workflow tools are marked experimental, and kill_attempt, retry_session and retry_attempt work even in read-only mode.
Both documented clients run the server on your machine.
CONTEXT COST
Rated by the size of the 23 tool definitions that ride along on every turn, not by how many there are
INSTALLATION
npx @treasuredata/mcp-server{
"mcpServers": {
"treasuredata": {
"command": "npx",
"args": [
"@treasuredata/mcp-server"
],
"env": {
"TD_API_KEY": "<YOUR_TD_API_KEY>",
"TD_SITE": "us01",
"TD_ENABLE_UPDATES": "false",
"TD_DATABASE": "sample_datasets"
}
}
}
}claude mcp add td -e TD_API_KEY=$TD_API_KEY -- npx @treasuredata/mcp-server