MLflow MCP Server Tutorial: Query Traces with Python and Natural Language
Learn how to use the MLflow MCP (Model Context Protocol) server to talk to your tracking data from code or from an AI assistant. MCP lets clients and AI agents call external services as tools. The MLflow MCP server can run locally or alongside a tracking server, and it exposes about 20 to 30 function tools for both read and write operations: analyze latencies, diagnose errors, log traces with annotations, and delete data. This tutorial covers two ways to interact with the server: 🔹 Programmatic: connect asynchronously with the Python fastmcp client and call specific tools, including filtering by genai or traditional ml categories 🔹 Natural language: configure Claude, VS Code, or Cursor with a JSON file and query tracking data in plain English Live demos include: 🔹 Seeding traces: simulated experiments with high-latency tasks, flaky tools/exceptions, RAG chains, and chat token usage 🔹 Querying and filtering: error-status traces, executions longer than one second, production tags, and token count breakdowns 🔹 Writing back and cleanup: save trace annotations to the server, retrieve them, then delete traces so the data stays idempotent 🔹 Notebook: https://github.com/dmatrix/mlflow-genai-tutorials/blob/main/mlflow_mcp_server.ipynb Speaker: Jules Damji, Developer Advocate (Databricks) 00:00 – Introduction to the MCP 00:39 – Architecture and Capabilities of the MLflow MCP Server 02:35 – Setting up the Local Tracking Server and Environment 03:26 – Seeding Fake Experimental Data and Trace Types 05:05 – Programmatic Discovery: Categorizing Tools via FastMCP 07:29 – Two Approaches to Interacting with the MCP Server 08:13 – Programmatic Querying: Filtering Errors and Measuring Latency 09:48 – Writing Data Back: Logging Trace Annotations and Hierarchy 12:36 – Natural Language Querying 14:02 – Live Claude Demo #MLflow #MCP #GenAI #MachineLearning #Python #Cursor #Claude #VSCode #Observability