MCP Access
Every data-mode Space can expose its DataAgent as an MCP (Model Context Protocol) server, so external agents — Claude, Cursor, or any MCP-capable client — can query and analyze the Space's datasets as first-class tools.
Data mode only
MCP access is available for data-mode Spaces. General-mode Spaces (and their keys) are rejected by the MCP endpoint — use the Open API there instead.
Connect a client
- Open the Space → click the ⋮ menu (top right) → MCP access.
- Create an API key (keys are shared with API access — creating or revoking one takes effect in both places, and the full key is shown exactly once).
- Point your MCP client at the endpoint with the key as a Bearer token.
Endpoint: https://console.datyo.ai/mcp (Streamable HTTP)
Claude Code
claude mcp add --transport http datyo https://console.datyo.ai/mcp \
--header "Authorization: Bearer sk-df-..."Cursor (~/.cursor/mcp.json, or .cursor/mcp.json inside a project)
{
"mcpServers": {
"datyo": {
"url": "https://console.datyo.ai/mcp",
"headers": { "Authorization": "Bearer sk-df-..." }
}
}
}Claude Desktop (claude_desktop_config.json — remote servers with an auth header go through the mcp-remote bridge, requires Node.js)
{
"mcpServers": {
"datyo": {
"command": "npx",
"args": ["-y", "mcp-remote", "https://console.datyo.ai/mcp",
"--header", "Authorization: Bearer sk-df-..."]
}
}
}OpenAI (Responses API — attach the MCP server as a tool)
from openai import OpenAI
client = OpenAI()
resp = client.responses.create(
model="gpt-4.1",
tools=[{
"type": "mcp",
"server_label": "datyo",
"server_url": "https://console.datyo.ai/mcp",
"headers": {"Authorization": "Bearer sk-df-..."},
"require_approval": "never",
}],
input="Top 5 cities by sales",
)
print(resp.output_text)JSON config (generic Streamable HTTP — most other clients)
{
"mcpServers": {
"datyo": {
"type": "streamable_http",
"url": "https://console.datyo.ai/mcp",
"headers": { "Authorization": "Bearer sk-df-..." }
}
}
}Tools
| Tool | What it does |
|---|---|
list_datasets | Dataset catalog of the Space — name, description, columns, engine, plus the exact table / table_alias names to use in run_sql (use them verbatim; quote non-ASCII names) |
ask | End-to-end natural-language Q&A: the DataAgent generates and runs SQL, optionally charts, and returns {answer, sql, result, chart} |
generate_sql | Question → one DuckDB SQL statement (generated only, not executed) |
run_sql | Execute a DuckDB SQL statement over the Space's datasets, returns {columns, rows, took_ms} |
make_chart | Pick a Datyo chart spec (line, bar, pie, scorecard, …) for a result set, returns {type, config} |
generate_summary | Natural-language summary of a result set |
Spaces with SLS or MaxCompute datasets additionally expose run_sls_query / run_maxcompute_query, with the same contracts as the built-in agent tools.
A typical orchestration: list_datasets → generate_sql → run_sql → make_chart / generate_summary. Or just call ask and let the DataAgent do all of it in one step.
Notes
- Results larger than 500 rows are truncated (
truncated: true, withtotal_rows). - All model-backed tools (
ask,generate_sql,make_chart,generate_summary) are billed and rate-limited like normal chat; usage is attributed to the key owner's account.list_datasetsand the SQL execution tools don't call the model and are free. - Revoked keys fail immediately.