MLflow MCP Server: Experiment Tracking, Querying, Model Registry
Track, query, and compare ML experiments with an MCP server offering artifact access and a model registry.
npx -y @kkruglik/mlflow-mcpOverview
The MLflow MCP Server implements the Model Context Protocol (MCP) on top of MLflow storage and tracking backends. It provides a lightweight HTTP API to discover experiments and runs, read artifacts, and interact with a simple model registry. For teams that already use MLflow for experiment tracking, this server makes it easier to query, compare and consume experiment metadata and artifacts from other services or production pipelines.
By exposing a consistent REST surface that focuses on experiment querying and model metadata, the MCP server is useful for automation, CI/CD integration, model promotion workflows, and dashboards. It can sit next to an MLflow tracking server and provide additional convenience endpoints (search, compare, artifact download, model lookup) without changing existing tracking stores.
Features
- REST API for listing experiments, runs and run metadata
- Query and filter runs by tags, metrics, params and time range
- Artifact access and streaming download for any run artifact
- Simple model registry with model name, versions and metadata
- Run comparison utilities (metric diffs, parameter diffs)
- OpenAPI / Swagger UI for interactive exploration
- Pagination and basic filtering for large result sets
- Deployable as a standalone service or containerized app
Installation / Configuration
Run from source (recommended for development):
Configure environment variables and start the server (example):
# or an HTTP MLflow server
# Assuming the app entrypoint is `mcp.app:app` (adjust to actual package)
Run with Docker (example):
Example docker-compose fragment linking to MLflow:
version: "3.7"
services:
mlflow:
image: mlfloworg/mlflow:latest
ports:
# configure backend store and artifact store
mcp:
image: kkruglik/mlflow-mcp:latest
ports:
environment:
- MLFLOW_TRACKING_URI=http://mlflow:5000
Configuration notes:
- MLFLOW_TRACKING_URI should point to your MLflow tracking server or backend store URI.
- The server may accept additional env vars for auth or storage paths — check the repo for exact names when deploying.
Available Resources
Common HTTP endpoints (paths are illustrative; refer to the running server’s OpenAPI for exact signatures):
| Path | Method | Description |
|---|---|---|
| /experiments | GET | List experiments with pagination |
| /experiments/{id}/runs | GET | List runs for an experiment, supports filtering |
| /runs/{run_id} | GET | Fetch run metadata, metrics, params, tags |
| /runs/{run_id}/artifacts/{path} | GET | Stream/download an artifact file or folder |
| /models | GET/POST | List models / register new model |
| /models/{name} | GET | Get model metadata and versions |
| /models/{name}/versions | POST | Create a new model version from a run/artifact |
| /compare | GET | Compare two or more runs (metrics/params diffs) |
| /openapi.json, /docs | GET | OpenAPI schema and Swagger UI |
The server typically exposes an interactive Swagger UI at /docs for exploration and an OpenAPI JSON at /openapi.json.
Use Cases
- Automating model promotion
- CI pipeline queries the MCP server for the latest model version that passed validation:
- GET /models/{model_name} -> find approved/latest version
- GET /runs/{run_id}/artifacts/path/to/model -> download artifact
- Promote the found version to staging or production via registry metadata.
- Comparing experiments programmatically
- Script to compare two runs’ key metrics before deploying:
- GET /compare?runs=runA,runB -> receive metric diffs and parameter differences
- Use results to gate deployment: only deploy if metric delta > threshold.
- Artifact-driven deployments
- Production service fetches a serialized model directly from the MCP server:
- curl -o model.pkl “http://mcp:8080/runs/<run_id>/artifacts/model/model.pkl”
- Keeps deployment decoupled from MLflow internals; the MCP server can add caching, auth or ACLs as needed.
- Centralized experiment dashboards
- A lightweight dashboard polls /experiments and /models endpoints to surface recent runs, top-performing runs, and model versions without needing direct MLflow DB access.
Example curl to list experiments:
Example Python snippet to download an artifact:
=
=
Next steps and resources
- Start the server and open /docs to inspect the full API schema and example payloads.
- Integrate into CI/CD or orchestration pipelines to automate model selection and artifact retrieval.
- For advanced deployments, place the server behind an API gateway and add authentication (JWT, mTLS) and logging as needed.