# Local MCP Server

The Local MCP Server (`tdx mcp`) exposes the [Treasure Code (`tdx`) CLI](/treasure-code/) over local `stdio`, so AI coding agents can query databases, manage segments, and run workflows in your Treasure AI environment directly from natural-language prompts. Use it when you want an AI coding tool on your machine to operate on your data with your local `tdx` credentials, not just search documentation.

## Set Up and Run the Local MCP Server

```bash
npm install -g @treasuredata/tdx
tdx auth setup
tdx mcp
```

## Available Tools

| Tool  | Parameters  | Description  |
|  --- | --- | --- |
| `tdx_run` | `args: string[]` | Executes a `tdx` CLI command and returns JSON output |
| `tdx_search` | `query: string`, `category?: string` | Searches for relevant `tdx` commands based on what you want to do |


**Categories for `tdx_search`:** `Data`, `CDP`, `AI`, `Context`, `Utilities`.

For the full tool reference, blocked commands, and troubleshooting, see the [`tdx mcp` command reference](/treasure-code/commands/mcp).

## Connect Your Tool

[Claude Code](/products/headless/claude-code), [OpenAI Codex](/products/headless/openai-codex), [VS Code and GitHub Copilot](/products/headless/vscode-github-copilot), [Cursor](/products/headless/cursor), [Snowflake Cortex Code](/products/headless/snowflake-cortex-code), and [Databricks Genie Code](/products/headless/databricks-genie-code) can all connect to the Local MCP Server. See [Headless](/products/headless) or [Agent Setup](/getting-started/ai#pick-your-agent) for tool-specific setup steps. For other MCP clients (such as Claude Desktop or Windsurf), see the [`tdx mcp` command reference](/treasure-code/commands/mcp).

## Next Steps

- [`tdx mcp` command reference](/treasure-code/commands/mcp) — full tool reference, blocked commands, and troubleshooting
- [MCP Server (Docs)](/getting-started/ai/mcp-server-docs) — search live documentation instead of operating on data
- [Headless](/products/headless) — connect AI assistants and coding agents to Treasure AI
- [Agent Setup](/getting-started/ai) — one-click setup prompt and TD Skills catalog