An MCP Endpoint is a remote MCP server for Treasure AI Studio work folders. A client connected to it gets six tools: two to find out what the work folders offer, three to start or continue work, and one to collect a result. The work runs in Treasure AI Studio, not in the client. The client calls a tool, Studio starts a chat in a work folder, and the tool returns the agent's answer.
Who the chat runs as depends on the endpoint's connection method. Through a static-token endpoint, it runs as the endpoint's executor in the one shared work folder the endpoint publishes. Through an OAuth endpoint, it runs as the person who connected the client, in their own work folders.
This page covers configuring a client, what each tool does, and how to read what comes back. It is for whoever sets up the client and for anyone writing an agent against the endpoint directly. To create the endpoint and get its URL, see Static-Token MCP Endpoints or OAuth MCP Endpoints.
- The client sends a tool call to the endpoint's URL with its credential in the
Authorizationheader: the endpoint's token for a static-token endpoint, or the access token the client obtained when the person allowed access for an OAuth endpoint. - Treasure AI Studio checks the credential on every request — that it belongs to this endpoint and has not expired or been revoked, and that the endpoint is enabled. For a static-token endpoint it also checks that the endpoint has an executor and that the executor still has access to the folder; for an OAuth endpoint, that the person can still use the folder the tool names.
- Tools that start work open a chat in a work folder. Through a static-token endpoint, the chat runs as the executor, reads the folder read-only, and writes only to a temporary work area that is discarded with the chat. Through an OAuth endpoint, it is the connected person's own ordinary Studio chat, which can change files in their work folders — see The Chats Are the Person's Own Studio Chats.
- The gateway waits for the answer and returns it as the tool result. If the agent is still working when the wait runs out, the result says so and gives the chat ID to come back with. The chat keeps running.
No per-chat token is issued or exchanged with either method. A static-token endpoint's Gateway Token is covered in Gateway Tokens and Chat Access Tokens; an OAuth client obtains and renews its own credentials, as described in OAuth MCP Endpoints.
The endpoint speaks MCP over Streamable HTTP. What else the client needs depends on the endpoint's connection method.
The client needs to support OAuth sign-in for remote MCP servers. Give it one value:
| Setting | Value |
|---|---|
| Server URL | The endpoint's Connection URL, https://<your account's Agent Gateway>/v1/mcp/<endpoint ID>, or, if the endpoint holds the account's common URL, the Common MCP URL, https://<your account's Agent Gateway>/v1/mcp |
| Transport | Streamable HTTP |
Leave the header empty. When the client first connects, the endpoint answers 401 and tells the client where to sign in. The client registers itself with Treasure AI Studio, then opens a browser so the person can sign in and select Allow access. What a Person Sees When They Connect walks through that screen.
| Tool | What It Does | Arguments |
|---|---|---|
list_work_folders | Lists the work folders available through the connection, each with its id and name. A static-token endpoint publishes exactly one, so its list always has one entry. Through an OAuth endpoint, the list is the connected person's private work folders and the shared work folders they have added to Studio and can still use | None |
list_actions | Lists the folder's Actions, each with its name and description, sorted by name | work_folder_id |
run_action | Starts a new chat that runs an Action with its saved instructions, then waits for the result. Each call is a separate run | work_folder_id, action_name |
start_chat | Starts a new chat with the task in message, then waits for the result. Use it when no Action fits | work_folder_id, message |
continue_chat | Sends a new instruction to an existing chat, to ask for more work or a revision, then waits for the reply | chat_id, message |
get_chat_result | Reads the result of the chat's latest instruction, including one sent with continue_chat, without sending anything. Waits if the chat is still running | chat_id |
Every endpoint offers all six, and an endpoint cannot hide any of them. Through an OAuth endpoint, all six tools require the same mcp scope, including the tools that run Actions and start or continue chats — see The MCP Permission. Arguments are checked against each tool's published schema before anything runs. Unknown arguments are refused rather than ignored, and every problem with a call is reported together in one error.
list_actions returns the Actions defined in the work folder you pass. Pass the name it returns to run_action. The list is read when the tool is called, so an Action added to the folder is available to the client right away.
run_action takes no input beyond the Action's name: no arguments and no extra instructions. It runs the Action exactly as it is saved, which makes it the predictable choice and the one the tool descriptions steer a client toward first.
start_chat takes a task in plain language instead. The agent in Studio does not see the client's conversation, so message has to carry everything the task needs: the context, the data to use, and what the result should look like.
Use continue_chat to send an instruction on an existing chat. Use get_chat_result to wait for an answer that is still being produced. Calling a starting tool again for the same task starts a second, separate run.
Every tool answers with one JSON object in a text block. list_work_folders and list_actions return their data directly. The four tools that work with a chat return an object whose status says what happened:
status | Meaning | What to Do Next |
|---|---|---|
completed | The turn finished. result holds the agent's answer as text | Read result |
running | The agent was still working when the gateway's wait ran out. The chat has not stopped | Call get_chat_result with the chat_id. Do not start another run or resend the instruction |
question | The agent asked a question instead of answering. question holds it. The gateway declines it on your behalf, and declined says whether that was confirmed; when it is true, the agent carries on without an answer | Call get_chat_result to read the outcome. To change the direction of the work, send a continue_chat |
failed | The turn ended in failure. error is one of a fixed set of messages, and the underlying reason stays inside the platform | Decide whether to retry; there is nothing more to read from this result |
unknown | The result could not be read. The chat may still be running | Call get_chat_result with the chat_id. Do not repeat the original instruction |
The wait exists because MCP clients put a time limit on a tool call, and an Action can take longer than that. The gateway waits up to 200 seconds, then answers running with the chat ID rather than letting the client time out. A client that calls get_chat_result in a loop until the status changes will reach the final status.
Only the agent's text comes back. The agent's reasoning, the tools it called, and their output are not included, and neither are any files it wrote. Through a static-token endpoint, those files are discarded with the work area; through an OAuth endpoint, they stay in the person's work folder, but the client still cannot read them. Anything the client needs has to be in the answer, so for an Action that produces a file, have the Action say what it produced.
continue_chat and get_chat_result reach only chats that were started through the same endpoint. A chat ID from a different endpoint, or from a chat started in Studio, is answered with not_found, even when the folder is the same. Through a static-token endpoint, a chat started with one token can be continued with another token of the same endpoint, so rotating a token does not cut off a conversation. Through an OAuth endpoint, follow-ups also reach only the connected person's own chats.
The chats appear in a Studio chat list with a conversation icon of two speech bubbles. A static-token endpoint's chats are in the executor's list, labelled MCP. An OAuth endpoint's chats are in the connected person's own list under the folder they ran in, with the folder's name as the label; the icon's tooltip reads "Created through MCP".

| Limit | Value |
|---|---|
| New chats | 30 per minute, counted across run_action and start_chat. A static-token endpoint counts per endpoint, across all of its tokens; an OAuth endpoint counts per endpoint for each connected person. Over the limit, the tool answers rate_limited |
| Message length | 1 to 32,768 characters for start_chat and continue_chat |
| Wait per tool call | Up to 200 seconds, then running |
| Folders per connection | One for a static-token endpoint. Through an OAuth endpoint, the connected person's private work folders and the shared work folders they have added to Studio and can still use |
| Requests per call | One JSON-RPC message per HTTP request. Batches are refused |
The connection is stateless. There is no MCP session to open or close, so POST is the only HTTP method the endpoint accepts, and a client that drops its connection mid-call does not stop the chat it started.
- Answering the agent's questions. A question is always declined automatically, and the result reports it as
status: "question". - Arguments for an Action.
run_actionruns the Action as saved. To pass input, usestart_chatand describe the task. - Choosing a different folder or executor per call on a static-token endpoint. Both are fixed on the endpoint.
- Resources, prompts, and other MCP capabilities. The endpoint offers tools only.
- Static-token and OAuth on one endpoint. The connection method is chosen at creation and cannot be changed.
- OAuth clients that return the authorization code by hand. Sign-in has to come back through a browser callback.
- Browsers. Requests with an
Originheader are refused.
A call can fail at two levels. A refused credential fails the whole HTTP request; a problem with one tool call comes back as a tool result with isError set.
| Response | Meaning |
|---|---|
HTTP 401 with invalid_token | The credential is unknown, revoked, or expired, or it belongs to a different endpoint, or the endpoint has been deleted. All of these look the same from outside. When an OAuth client sends no credential, the 401's WWW-Authenticate header leaves out the error code and points the client to where to sign in; the body still reads invalid_token |
HTTP 403 with insufficient_scope | OAuth only. The client's token does not include mcp. The response names this scope so the client can request it |
HTTP 403 with mcp_disabled | The endpoint is disabled. For a static-token endpoint, also when it has no executor or the executor has lost access to the folder |
HTTP 403 with browser_refused | The request carried an Origin header |
HTTP 405 | The client used GET or DELETE. Only POST is accepted |
HTTP 406 | The request's Accept header did not include both application/json and text/event-stream |
| JSON-RPC error "The service is temporarily unavailable." | Treasure AI Studio could not be reached for this call. Nothing was started; try again |
Tool error invalid_request | The arguments did not match the tool's schema. The message lists every problem |
Tool error not_found | The folder ID, Action name, or chat ID does not exist or is not reachable through this endpoint — or, through an OAuth endpoint, by the connected person |
Tool error rate_limited | Too many chats were started on this endpoint in the last minute — through an OAuth endpoint, by this person. Try again later |
Tool error dispatch_failed | The Action, chat, or follow-up could not be started. Try again |
Tool error folder_unavailable | The folder's contents could not be read at that moment. Try again |
| Symptom | Cause and Fix |
|---|---|
An OAuth client keeps asking to sign in, or is refused with 401 | If the common MCP URL setting changed, authorize again. If the endpoint was deleted or the person left the account, access through that endpoint cannot be restored; ask an account administrator about another OAuth endpoint. See OAuth MCP Endpoints for errors on the consent screen |
Every request with a static token is refused with 401 | Check that the header is Authorization: Bearer <token> with the full token, and that the URL and token come from the same endpoint. If they do, the token has expired or been revoked — issue a new one on the endpoint's detail page |
Every request is refused with 403 | Open the endpoint in Settings → Agent Channels and check its status. If it is Disabled or Stopped — needs an executor, it has to be enabled again; if a static-token endpoint is Active, the executor may have lost access to the folder. Through an OAuth endpoint, insufficient_scope means the client's token does not include mcp; authorize the client again and grant mcp |
list_actions returns nothing, or not the Action you expected | The Action is not defined in the work folder passed as work_folder_id. Open the folder in Studio and check that it appears as an Action in the Actions and Skills section — see Actions |
A tool keeps returning running | The chat is still working. Keep calling get_chat_result with the same chat_id; to see progress, the executor (static token) or the connected person (OAuth) can open the chat in Studio |
continue_chat answers not_found for a chat you started | The chat was started through a different endpoint, it has been deleted, or, through an OAuth endpoint, another person started it. Follow-ups work only on the endpoint that started the chat |
- Static-Token MCP Endpoints — a static-token endpoint, its executor, and its tokens.
- OAuth MCP Endpoints — endpoints each person connects to as themselves.
- Connect Snowflake Cortex Code to Treasure AI — step-by-step setup for the Snowflake Cortex Code CLI.
- Connect Databricks Genie Code to Treasure AI — step-by-step setup for the Databricks Genie Code CLI.
- Actions — write the Actions the client runs.
- What an Agent Channel Chat Can Reach — the workspace, credentials, and limits behind each chat.
- Gateway Tokens and Chat Access Tokens — rotate and revoke the endpoint's token.