Skip to content

Connecting AWS Kiro to Treasure AI

AWS Kiro is an agentic IDE with built-in Model Context Protocol (MCP) support. Connect AWS Kiro IDE to Treasure AI through MCP so Kiro's agent can query databases, inspect schemas, manage parent segments, segments, journeys, and workflows, or run Treasure AI Studio Actions and chats without leaving your editor.

You can connect AWS Kiro IDE to Treasure AI using either or both of two MCP integration patterns:

  • Local MCP Server (tdx mcp): Runs the Treasure Code (tdx) CLI locally over stdio. Kiro calls tdx_search and tdx_run using your local tdx profile to query databases and work with parent segments, segments, journeys, and workflows directly against Treasure AI APIs.
  • Treasure AI Studio MCP Endpoint: Connects over Streamable HTTP to the Treasure AI Studio Agent Gateway. Kiro delegates work to a shared work folder in Treasure AI Studio, runs saved Actions, and starts or continues Studio chats.

Which MCP Connection Should You Use?

Aspect Local MCP Server (tdx mcp) Treasure AI Studio MCP Endpoint
Best forEngineers querying tables, exploring databases, and working with parent segments, segments, journeys, and workflows from KiroTeams running saved Studio Actions, listing shared work folders, and starting or continuing Studio chats from Kiro
TransportLocal stdio process (tdx mcp) started by KiroRemote Streamable HTTP (https://agent-gateway.<REGION>.treasure.ai/v1/mcp/<endpoint-id>)
AuthenticationYour tdx profile stored in your system keychain (optional dedicated TDX_PROFILE=kiro)Static Gateway Token (Authorization: Bearer tasgwt_<secret>)
Runs asThe Treasure AI user authenticated in your tdx profileThe MCP endpoint's designated executor in one shared work folder
AI token usageKiro only (Treasure AI serves standard API requests)Kiro + Treasure AI Studio (Treasure AI Credits for Studio chats and Actions)
Tools exposedtdx_run, tdx_searchlist_work_folders, list_actions, run_action, start_chat, continue_chat, get_chat_result

You can connect both MCP servers to Kiro at the same time in ~/.kiro/settings/mcp.json. With both configured, Kiro has tdx (2 tools, running locally on your machine) and tai-studio (6 tools, running work in Studio).

Option 2: Treasure AI Studio MCP — Remote HTTP

Streamable HTTP
Bearer tasgwt_...

Runs as executor

AWS Kiro IDE

AI Studio Agent Gateway

Shared Work Folder
Saved Actions & Studio Chats

Option 1: Local MCP Server — Local stdio

stdio (tdx profile)

HTTPS (Keychain credentials)

AWS Kiro IDE

tdx mcp

Treasure AI APIs
Databases, Segments, Journeys, Workflows

Option 2: Treasure AI Studio MCP — Remote HTTP

Streamable HTTP
Bearer tasgwt_...

Runs as executor

AWS Kiro IDE

AI Studio Agent Gateway

Shared Work Folder
Saved Actions & Studio Chats

Option 1: Local MCP Server — Local stdio

stdio (tdx profile)

HTTPS (Keychain credentials)

AWS Kiro IDE

tdx mcp

Treasure AI APIs
Databases, Segments, Journeys, Workflows

Prerequisites

The commands below are shown for macOS (Apple Silicon). Intel Macs, Linux, and Windows follow the same steps with their platform-specific Kiro installer and terminal commands.

Requirement Details
Kiro IDE and sign-inAWS Kiro IDE installed (choose Kiro IDE, not Kiro Crew) and signed in with a GitHub or Google account
Node.jsVersion 22.12 or later, required for tdx and the optional npx endpoint check. On macOS, install with Homebrew (brew install node), or see the tdx Installation Guide for other operating systems
Treasure AI account (for tdx mcp)An API key or SSO sign-in with permissions for the databases, segments, journeys, and workflows you plan to use
Treasure AI Studio access (for Studio MCP Endpoint)Manage access to a non-archived shared work folder, permission under your account's endpoint creation policy (Static-Token MCP Endpoints), access to Studio on Web or Desktop (not Mobile), and HTTPS connectivity to the Studio Agent Gateway

Option 1: Connect Local MCP Server (tdx mcp)

Use this setup so Kiro starts tdx mcp locally over stdio. Every command runs with the permissions of the Treasure AI user behind your tdx profile. Kiro's configuration file stores only the path to tdx (and optionally a profile name); tdx keeps credentials in your system credential store.

Step 1: Install and Open Kiro IDE

If you already have Kiro IDE installed and signed in, skip to Step 2.

  1. Go to kiro.dev, select Download, and pick Kiro IDE for your platform (for example, Kiro IDE for Mac (Apple Silicon) — not Kiro Crew).
  2. Install and launch Kiro. On macOS, open the downloaded .dmg, drag Kiro into Applications, and launch it from Applications.
  3. Select Sign in, choose GitHub or Google, approve in the browser, and return to Kiro.
  4. Optionally create a practice folder (File → Open Folder, create kiro-td-test, and open it). Type hello in Kiro's agent chat panel to confirm you receive a reply.

Step 2: Check Node.js and Install tdx

Open your terminal and confirm Node.js is version 22.12 or later:

node --version

If Node.js is missing or older than 22.12, install a current release (for example, brew install node on macOS).

Install @treasuredata/tdx globally and note the full path returned by which tdx:

npm install -g @treasuredata/tdx
tdx --version
which tdx

Write down the full path printed by which tdx (for example, /opt/homebrew/bin/tdx on Apple Silicon macOS). You need this exact path in Step 4.

Separate installation from Treasure Work

Treasure Work ships its own bundled copy of tdx inside the desktop app. Kiro cannot reach that bundled binary, so install this separate global copy of @treasuredata/tdx for Kiro.

Step 3: Sign In to Treasure AI

Check whether tdx is already authenticated:

tdx user

If it displays your Treasure AI account and email, continue to Step 4. Otherwise, run tdx auth setup and follow the prompts:

tdx auth setup
tdx user
  • For a non-US site, pass --site eu01, --site ap01, or --site ap02.
  • For SSO sign-in, pass --account-name <YOUR_ACCOUNT>.
  • tdx stores credentials in your system credential store (macOS Keychain, Windows Credential Manager, or Linux Secret Service) rather than in a plain-text file.

Optional: Create a Dedicated kiro Profile

Create a dedicated profile to tie Kiro to a single Treasure AI account (such as a sandbox account) without changing your default tdx setup:

tdx profile create kiro
tdx status --profile kiro

If the prompts do not ask you to sign in, run tdx auth setup --profile kiro. You reference this profile name in Step 4.

Step 4: Register tdx in Kiro

Create and open Kiro's user-level MCP configuration file at ~/.kiro/settings/mcp.json:

mkdir -p ~/.kiro/settings && touch ~/.kiro/settings/mcp.json && open -a Kiro ~/.kiro/settings/mcp.json

Edit the file inside Kiro (or another code editor). Do not edit it in macOS TextEdit, which replaces straight quotes with smart quotes and produces invalid JSON.

Paste the configuration below into ~/.kiro/settings/mcp.json, replacing /opt/homebrew/bin/tdx with the path you noted from which tdx in Step 2. If the file already defines other servers, add the "tdx" entry inside the existing "mcpServers" object:

{
  "mcpServers": {
    "tdx": {
      "command": "/opt/homebrew/bin/tdx",
      "args": ["mcp"],
      "autoApprove": ["tdx_search"]
    }
  }
}

Save the file (Cmd+S on macOS, Ctrl+S on Windows/Linux). Kiro reloads MCP servers automatically when the file changes.

To use a dedicated tdx profile (such as the optional kiro profile from Step 3), add an "env" block to the "tdx" entry:

"env": { "TDX_PROFILE": "kiro" }
Do not auto-approve tdx_run

Never add tdx_run to autoApprove. tdx_run can execute any tdx command, including workflow runs and segment pushes that cannot be undone. tdx_search only looks up commands, so it is safe to auto-approve.

Credential precedence and workspace configuration

tdx mcp resolves credentials in this order: TDX_PROFILE, then TDX_API_KEY plus TDX_SITE, then your default tdx sign-in. Prefer profiles over TDX_API_KEY so no API key is stored in mcp.json. Kiro also supports a project-level configuration file at .kiro/settings/mcp.json if you want tdx enabled for a single workspace; never commit a workspace config file that contains credentials.

Step 5: Verify the tdx Connection

Select the Kiro icon in the left sidebar and check the MCP Servers section. You should see tdx connected with two tools: tdx_run and tdx_search.

AWS Kiro chat confirming that the tdx MCP server is connected with tdx_search and tdx_run tools available

Try these prompts in Kiro's chat. When Kiro asks for permission to run tdx_run, review the command arguments and select Allow:

  • "Use tdx to list my Treasure AI databases."
  • "Show the tables in sample_datasets and describe one of them."
  • "Using tdx, run this query: SELECT COUNT(1) FROM sample_datasets.www_access"
AWS Kiro prompting for approval before executing @tdx/tdx_run with SELECT COUNT(1) FROM sample_datasets.www_access

Kiro returns the query results from tdx, confirming the local MCP connection is working:

AWS Kiro chat returning 5000 rows from sample_datasets.www_access via tdx_run

Option 2: Connect a Treasure AI Studio MCP Endpoint

Use this setup to let Kiro list your Studio shared work folder, run saved Actions, and start or continue Treasure AI Studio chats over Streamable HTTP. Calls run as the endpoint's executor (by default, the person who created the endpoint) using that person's permissions and Treasure AI Credits.

Step 1: Create or Choose a Shared Work Folder

A static-token MCP endpoint publishes one shared work folder. If you already manage a non-archived shared work folder you want to use, skip to Step 2. For the full folder layout and manager workflow, see Shared Work Folders and Sharing a Work Folder.

  • Create a new shared folder: Open the Work Folders catalog with +, then select New shared folder. Creating a new folder requires fewer than 25 active work folders on your account.
  • Share an existing folder: Open its ⋯ menu, select Share…, and choose which top-level items to publish. The folder converts in place, its chats continue working, and private contents move into your my/ area.
  • Publish and grant access: A new shared folder starts in Setting up. Publishing is one-way—a shared folder cannot become private again, though membership can change. To grant access, open the folder, select ⋯ → Shared folder settings, then under People select Add people, search by email within the same Treasure AI account, assign one or more work modes, and publish when ready.
Work Mode What It Allows
View onlyReads the entire folder and writes only to your private my/ area
Custom foldersWrites only to the top-level folders listed in the mode, such as reports/
Write everywhereReads and writes the entire shared folder
ManageFull access, including members, work modes, settings, and deletion

The person who creates the MCP endpoint must hold Manage access on the shared folder. The endpoint wizard lists only non-archived folders where you hold Manage.

Step 2: Create a Static-Token MCP Endpoint in Treasure AI Studio

  1. Open Treasure AI Studio on Web or Desktop (not Mobile).
  2. Go to Settings → Agent Channels → New MCP Endpoint.
  3. Leave Static token · shared executor selected, enter a name (for example, kiro-test), and select Next.
  4. Under Shared work folder, choose your folder from Step 1. Requests from Kiro will run as you and use your Treasure AI Credits.
  5. Choose a token lifetime (for example, 30 days).
  6. Select Create endpoint & issue first token.
  7. Copy both the Connection URL (https://agent-gateway.<REGION>.treasure.ai/v1/mcp/<endpoint-id>) and the Token (tasgwt_...) into your password manager right away.
  8. Check I have stored the values, then select Done.
Connect your MCP client completion screen in Treasure AI Studio showing the Connection URL and the Authentication header
Store the token immediately

The tasgwt_ token is displayed only once. A lost token cannot be recovered; you must issue a new token on the endpoint's detail page and revoke the old one.

If New MCP Endpoint is unavailable

If you do not see New MCP Endpoint, or no shared folder appears in the wizard, ask your account administrator. Either you need Manage rights on a shared work folder, or your account's creation policy restricts endpoint creation to account administrators.

Step 3: Test the Endpoint Before Configuring Kiro (Optional)

Verify that the endpoint responds on its own so any later issue can be isolated to Kiro's configuration. In your terminal, substitute your Connection URL and token and run:

export MCP_SERVER_URL="https://agent-gateway.<REGION>.treasure.ai/v1/mcp/<endpoint-id>"
export MCP_TOKEN="tasgwt_..."
npx @modelcontextprotocol/inspector --cli "$MCP_SERVER_URL" --transport http --header "Authorization: Bearer $MCP_TOKEN" --method tools/list

If npx prompts to install @modelcontextprotocol/inspector, enter y.

To keep the token out of your zsh shell history, replace the second export line with a hidden prompt:

read -rs 'MCP_TOKEN?Paste the Studio token (hidden): '
export MCP_TOKEN
printf '\n'
echo ${MCP_TOKEN:0:7}

The output should list all six Studio tools: list_work_folders, list_actions, run_action, start_chat, continue_chat, and get_chat_result.

  • 401 Unauthorized: The Connection URL or token was copied incorrectly, or the token is expired or revoked.
  • 403 Forbidden: The endpoint is disabled, has no executor, or the executor lost access to the shared folder.

Step 4: Add tai-studio to Kiro's mcp.json

  1. Reopen Kiro's user-level MCP configuration file:
open -a Kiro ~/.kiro/settings/mcp.json
  1. Add the "tai-studio" block inside "mcpServers" alongside "tdx". Replace the URL and token with your own values, keeping the word Bearer followed by a single space before tasgwt_.... Keep your own tdx binary path from Option 1:
{
  "mcpServers": {
    "tdx": {
      "command": "/opt/homebrew/bin/tdx",
      "args": ["mcp"],
      "autoApprove": ["tdx_search"]
    },
    "tai-studio": {
      "url": "https://agent-gateway.<REGION>.treasure.ai/v1/mcp/<endpoint-id>",
      "headers": { "Authorization": "Bearer tasgwt_..." },
      "autoApprove": ["list_work_folders", "list_actions", "get_chat_result"]
    }
  }
}
  1. Save with Cmd+S (Ctrl+S on Windows/Linux).

The three auto-approved tools (list_work_folders, list_actions, get_chat_result) are read-only. Leaving run_action, start_chat, and continue_chat out of autoApprove ensures Kiro asks for your approval before starting Studio work that spends credits.

Keep the Studio token out of Git repositories

~/.kiro/settings/mcp.json lives in your home directory, outside Git repositories. Never place a tasgwt_ token in a project-level .kiro/settings/mcp.json file.

Step 5: Verify the Studio Connection in Kiro

Open the MCP Servers section in Kiro's sidebar and confirm tdx shows 2 tools and tai-studio shows 6 tools.

AWS Kiro chat confirming that the tai-studio MCP server is connected with all six Studio tools and listing available folder Actions

Test the Studio connection with prompts such as:

  • "List the actions in my Treasure AI Studio folder."
  • "Run the <action_name> Action in tai-studio. If it returns a running status, poll get_chat_result until it finishes."
  • "Start a Studio chat in that folder asking: summarize what's in this folder."
  • "Use tdx to count rows in sample_datasets.www_access, then start a Studio chat that explains the result."

Available Tools and Example Prompts

Local MCP Server (tdx)

Tool What It Does
tdx_runExecutes a tdx CLI command and returns the output
tdx_searchFinds the tdx command that matches a task
Area Example Prompt
Data"List the tables in sample_datasets and describe www_access."
Queries"Count rows in sample_datasets.www_access grouped by HTTP method."
CDP"List my parent segments and the child segments under one of them."
Journeys"List my journeys and show the stages of one."
Workflows"List my workflow projects and show the last few sessions for one."

Treasure AI Studio MCP Endpoint (tai-studio)

Tool Inputs What It Does
list_work_foldersNoneLists the work folders reachable through this endpoint
list_actionswork_folder_idLists the saved Actions in a work folder
run_actionwork_folder_id, action_nameRuns a saved Action in Studio
start_chatwork_folder_id, messageStarts a free-form Studio task
continue_chatchat_id, messageSends a follow-up instruction to an existing Studio chat
get_chat_resultchat_idRetrieves the latest result of a Studio chat, or waits for it to finish

For full tool schemas and status codes, see Connecting an MCP Client.


Guardrails and Operational Limits

Commands with real-world side effects (tdx mcp)

tdx_run can run any tdx command that your profile's user has permission to execute, including operations that cannot be undone. Ask Kiro for a dry run first and review every tool call before approving it:

  • tdx wf run: Starts a workflow attempt immediately. Activation workflows send to the full audience right away.
  • tdx journey resume: Resumes a paused journey so audience members enter stages and activations fire.
  • Segment, journey, and parent segment pushes (for example, tdx sg push, tdx journey push, tdx ps push): Update live CDP configurations.

Ask Kiro to run mutating commands with --dry-run first, or use read-only validation commands (tdx wf validate, tdx sg validate, tdx journey validate). Point Kiro's tdx profile at a demo or sandbox account whenever possible.

  • Studio shared folder scope: A static-token endpoint publishes one shared work folder read-only and executes every call as the endpoint's executor, using that person's permissions and Treasure AI Credits. Each chat runs in a temporary workspace that is discarded when the chat ends.
  • Rate and message limits: Up to 30 new chats per minute. Messages must be between 1 and 32,768 characters.
  • Actions and clarifying questions: Saved Actions do not accept arguments—use start_chat when you need to pass inputs. If Studio would ask a clarifying question, it is declined automatically, so include all required inputs in your prompt.
  • Supported MCP primitives: Only MCP tools are exposed; MCP resources and prompts are not supported.
  • Long-running Studio tasks: Tool calls wait up to 200 seconds. If a task runs longer or times out in Kiro, poll get_chat_result with the returned chat_id instead of starting the task again.

Security Notes

  • Prefer TDX_PROFILE over TDX_API_KEY: Using a tdx profile keeps credentials in your system keychain rather than in mcp.json.
  • Follow least privilege: Kiro can perform any action permitted to the tdx profile's user or the Studio endpoint's executor. Use an account with only the permissions required.
  • Keep mutating tools out of autoApprove: Never add tdx_run, run_action, start_chat, or continue_chat to autoApprove.
  • Protect ~/.kiro/settings/mcp.json: Because this file holds the tasgwt_ token in plain text, keep it in your home directory and restrict file permissions with chmod 600 ~/.kiro/settings/mcp.json. Never commit tokens to Git, place them in a workspace .kiro/settings/mcp.json, or paste them into chat tools.
  • Rotate and revoke tokens: Set an expiration when creating the Studio endpoint and rotate tokens regularly. If a token is exposed, revoke it in Settings → Agent Channels and issue a new one.
  • Revoking access:
    • For Local MCP Server: Delete the tdx block from ~/.kiro/settings/mcp.json, then run tdx auth clear (or tdx profile delete kiro if you created a dedicated profile).
    • For Studio MCP Endpoint: To stop access immediately, disable the endpoint in Settings → Agent Channels. Disabling does not revoke tokens—revoke tokens separately if needed.

Troubleshooting

Symptom Likely Cause Fix
Kiro will not open on macOS ("unidentified developer")macOS Gatekeeper blocked the first launchRight-click Kiro in Applications, select Open, then confirm Open
npm: command not found or npx: command not foundNode.js is not installedInstall Node.js 22.12 or later (for example, brew install node on macOS) and retry
EACCES permission error during npm install -g @treasuredata/tdxNode.js is installed in a system-owned directoryUse a user-writable Node installation such as Homebrew (which node should show /opt/homebrew/bin/node on Apple Silicon). Do not run npm install -g with sudo
Node.js version errorInstalled Node.js is older than 22.12Upgrade Node.js to 22.12 or later
tdx mcp appears to hang when run directly in TerminalExpected behavior—tdx mcp waits for stdio messages from an MCP clientPress Ctrl+C; Kiro starts tdx mcp for you
tdx shows as failed in Kiro's MCP ServersThe "command" path is wrong, or Kiro cannot find tdx on its PATH (common with nvm)Run which tdx and paste that exact full path into "command" in ~/.kiro/settings/mcp.json
Auth errors or wrong Treasure AI account in tdxtdx is not signed in, or Kiro is pointing at a different profileRun tdx user (or tdx status --profile kiro) and re-run tdx auth setup if needed
A long query times out in tdxtdx commands time out after 15 minutesAsk Kiro to submit long queries asynchronously with tdx job submit
Other tdx errorsLocal tdx runtime or API errorInspect the local log with tail -50 ~/.cache/tdx/logs/tdx.log
New MCP Endpoint is missing or disabled in StudioEndpoint creation is restricted to account administratorsAsk an account administrator to create the endpoint or update the creation policy
No shared folder appears in the endpoint wizardYou do not hold Manage access on a non-archived shared folderAsk a folder manager for Manage access, or select an eligible shared folder
401 Unauthorized from the Studio endpointThe URL or token was copied incorrectly, the token expired or was revoked, or the endpoint was deletedRe-copy the URL and token, or issue a new token in Settings → Agent Channels
403 Forbidden from the Studio endpointThe endpoint is disabled, has no executor, or the executor lost access to the folderRe-enable the endpoint or restore folder access in Studio
MCP Inspector test passes, but tai-studio fails in KiroInvalid JSON syntax, or the header is missing Bearer (with a space)Check for valid JSON (commas between server blocks) and confirm "Authorization": "Bearer tasgwt_...". Edit the file in Kiro, not TextEdit
tdx disappeared after adding tai-studioReplacing mcp.json removed the tdx blockPut both "tdx" and "tai-studio" inside the same "mcpServers" object
Studio tool call returns a running statusThe Studio task took longer than 200 secondsAsk Kiro to call get_chat_result with the returned chat_id
Studio responds about the wrong folder or ActionsThe endpoint publishes a different shared folder than expectedCheck the endpoint overview in Studio, then ask Kiro to run list_work_folders and list_actions

Next Steps