Trackio documentation
Trackio as an API and MCP Server
Trackio as an API and MCP Server
The Trackio dashboard can be configured to run as both an HTTP API server and an MCP (Model Context Protocol) server, allowing external tools and applications to programmatically interact with your experiment tracking data, or for you to be able to “chat with your experiment data” in natural language using ChatGPT, Claude, Deepseek, or various LLMs that support MCPs. This makes Trackio an ideal choice for LLM agents running autonomous ML experiments, as they can seamlessly log metrics and query experiment results.
Setup
Install the optional MCP dependency, then enable the MCP server when launching the Trackio dashboard. You can do this a few different ways:
pip install "trackio[mcp]"Option 1: CLI Command
trackio show --mcp-server
Option 2: Python Function
import trackio
trackio.show(mcp_server=True)Option 3: Environment Variable
export GRADIO_MCP_SERVER=True
trackio showWhen MCP server mode is enabled, Trackio:
- Mounts a streamable-HTTP MCP server alongside the dashboard
- Exposes read-only project/run/metric inspection tools to MCP clients
- Exposes a small set of mutation tools (delete/rename/sync) gated by a write token
- Serves the Trackio agent skill over MCP (see Skills over MCP)
API Usage
Trackio exposes each MCP tool as a plain HTTP endpoint at POST /api/{tool_name}. The body is JSON; pass arguments as {"kwargs": {...}}, {"args": [...]}, or simply as a flat {"name": value} object.
import httpx2
base = "http://127.0.0.1:7860"
projects = httpx2.post(f"{base}/api/get_all_projects").json()["data"]
print("Projects:", projects)
runs = httpx2.post(
f"{base}/api/get_runs_for_project",
json={"project": "my-project"},
).json()["data"]
print("Runs:", runs)
values = httpx2.post(
f"{base}/api/get_metric_values",
json={"project": "my-project", "run": "run-1", "metric_name": "loss"},
).json()["data"]
print("Loss values:", values)const base = "http://127.0.0.1:7860";
async function call(name, payload = {}) {
const res = await fetch(`${base}/api/${name}`, {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify(payload),
});
return (await res.json()).data;
}
console.log("Projects:", await call("get_all_projects"));
console.log("Runs:", await call("get_runs_for_project", { project: "my-project" }));
console.log("Loss:", await call("get_metric_values", {
project: "my-project",
run: "run-1",
metric_name: "loss",
}));# Get all projects
curl -s -X POST http://127.0.0.1:7860/api/get_all_projects \
-H "Content-Type: application/json" -d '{}'
# Get runs for a project
curl -s -X POST http://127.0.0.1:7860/api/get_runs_for_project \
-H "Content-Type: application/json" \
-d '{"project": "my-project"}'
# Get values for a metric
curl -s -X POST http://127.0.0.1:7860/api/get_metric_values \
-H "Content-Type: application/json" \
-d '{"project": "my-project", "run": "run-1", "metric_name": "loss"}'MCP Usage
When running as an MCP server, Trackio exposes its tools at a single streamable-HTTP endpoint that MCP-compatible clients (Claude Desktop, Claude Code, etc.) can connect to.
MCP Server URL
The MCP server is available at:
http://127.0.0.1:7860/mcp/
When deployed to a Hugging Face Space, the URL is https://<your-space>.hf.space/mcp/.
Available MCP Tools
Read tools:
- get_all_projects – List all Trackio projects on this server.
- get_runs_for_project – List runs for a given project.
- get_metrics_for_run – List metric names recorded for a run.
- get_metric_values – Fetch metric values for a run, optionally around a step or time.
- get_project_summary – Summary metadata for a project.
- get_run_summary – Summary metadata for a run.
- get_system_metrics_for_run – List system metric names recorded for a run.
- get_system_logs – Fetch system metric logs for a run.
- get_snapshot – Fetch a single snapshot around a step or timestamp.
- get_logs – Fetch metric logs for a run.
- get_alerts – Fetch alerts for a project, optionally filtered by run or level.
- get_settings – Return dashboard settings and asset configuration.
Mutation tools (require write access — see below):
- delete_run – Delete a run.
- rename_run – Rename a run.
- trigger_sync – Trigger an export/sync pass to Hugging Face.
Write Access for Mutation Tools
Mutation tools are gated:
- Local dashboard: pass the
write_tokenargument. The token is printed in the terminal when you runtrackio show(it’s also embedded as?write_token=...in the dashboard URL printed at startup). For example:{"project": "my-project", "run": "run-1", "write_token": "<token from startup output>"} - Hugging Face Spaces: pass an
hf_tokenargument with write access to the Space’s repo. The localwrite_tokenis not used in this case.
Read tools never require a token.
MCP Client Configuration
To add Trackio to clients that support streamable-HTTP MCP servers, use a config like:
{
"mcpServers": {
"trackio": {
"url": "http://127.0.0.1:7860/mcp/"
}
}
}Skills over MCP
The MCP server also serves Trackio’s agent skill (the same files trackio skills add installs) using the MCP Skills extension (io.modelcontextprotocol/skills, SEP-2640). Agents that connect to the server get both the tools and the instructions for using Trackio well: how to log metrics, add alerts, and query runs, traces, and logbooks. Nothing needs to be installed locally.
- The server advertises
io.modelcontextprotocol/skillswithdirectoryRead: truein its capabilities and implementsskills/list,skills/get, andresources/directory/read. - Each skill file is an MCP resource under
skill://huggingface-trackio/, starting atskill://huggingface-trackio/SKILL.md. Clients without the Skills extension can still read these throughresources/listandresources/read. The server instructions point agents to the skill’s URI. - The skill shipped with your installed Trackio version is served, so its instructions always match the server’s tools.
Serving skills requires mcp>=2.0, which pip install "trackio[mcp]" installs by default. With older mcp versions only the tools are exposed.