Trackio documentation

Trackio as an API and MCP Server

Hugging Face's logo
Join the Hugging Face community

and get access to the augmented documentation experience

to get started

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 show

When 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.

Python
JavaScript
Bash
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)

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:

  1. get_all_projects – List all Trackio projects on this server.
  2. get_runs_for_project – List runs for a given project.
  3. get_metrics_for_run – List metric names recorded for a run.
  4. get_metric_values – Fetch metric values for a run, optionally around a step or time.
  5. get_project_summary – Summary metadata for a project.
  6. get_run_summary – Summary metadata for a run.
  7. get_system_metrics_for_run – List system metric names recorded for a run.
  8. get_system_logs – Fetch system metric logs for a run.
  9. get_snapshot – Fetch a single snapshot around a step or timestamp.
  10. get_logs – Fetch metric logs for a run.
  11. get_alerts – Fetch alerts for a project, optionally filtered by run or level.
  12. get_settings – Return dashboard settings and asset configuration.

Mutation tools (require write access — see below):

  1. delete_run – Delete a run.
  2. rename_run – Rename a run.
  3. trigger_sync – Trigger an export/sync pass to Hugging Face.

Write Access for Mutation Tools

Mutation tools are gated:

  • Local dashboard: pass the write_token argument. The token is printed in the terminal when you run trackio 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_token argument with write access to the Space’s repo. The local write_token is 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/skills with directoryRead: true in its capabilities and implements skills/list, skills/get, and resources/directory/read.
  • Each skill file is an MCP resource under skill://huggingface-trackio/, starting at skill://huggingface-trackio/SKILL.md. Clients without the Skills extension can still read these through resources/list and resources/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.

Update on GitHub