Skip to main content

mcp-ml-lab

Let AI agents run real ML experiments end-to-end.

PyPI Python License

An MCP server that gives Claude (or any MCP-aware AI agent) the ability to profile a CSV, define an ML task, tune XGBoost and LightGBM with Optuna, and produce a markdown report with feature importance — all from natural language.

Why this exists

The existing ML-related MCP servers wrap MLflow, ZenML, or Weights & Biases and expose them as read-only — agents can browse experiment history but can't actually run anything. mcp-ml-lab fills the gap: it lets agents execute the full experimentation loop from a user's natural-language request.

A user typing "train a model on titanic.csv to predict survival" should not need to know what XGBoost is, what cross-validation is, or how to write a hyperparameter search. The agent handles all of that — mcp-ml-lab is the tools layer that makes it possible.

Quick start

pip install mcp-ml-lab

Add to your Claude Desktop config (~/Library/Application Support/Claude/claude_desktop_config.json on macOS):

{
  "mcpServers": {
    "ml-lab": {
      "command": "mcp-ml-lab"
    }
  }
}

Restart Claude Desktop. The five tools below are now available.

Example queries

Try these in Claude Desktop with mcp-ml-lab connected:

  • "Profile this CSV and tell me if there's class imbalance"
  • "Compare XGBoost and LightGBM on titanic.csv with 60 seconds of tuning"
  • "Show me the top 10 features the winning model used"
  • "How did my last three experiments on the wine dataset compare?"

Tools

Tool What it does
inspect_data Profile a CSV — shape, dtypes, nulls, summary stats, class balance
define_task Register an ML task (CSV + target + classification/regression)
run_experiment Train one or more models, optionally tuning with Optuna
get_results Markdown report with metrics, hyperparameters, feature importance
compare_runs Side-by-side comparison of multiple experiments

Each tool's full signature is in its docstring; they self-document to the LLM.

How it works

Claude Desktop  ───MCP/stdio───  mcp-ml-lab server
                                  │
                                  ├── data.py        CSV loading, schema inference, preprocessor
                                  ├── trainers/      Pluggable XGBoost + LightGBM adapters
                                  ├── search.py      Stratified CV + Optuna TPE tuning
                                  ├── metrics.py     Accuracy, F1, AUC, log loss
                                  ├── storage.py     SQLite via SQLAlchemy 2.0
                                  └── reporting.py   Markdown report generation

All experiments and trials are persisted to ~/.mcp-ml-lab/store.db so an agent can refer back to runs across sessions.

Full design notes in ARCHITECTURE.md.

Roadmap

v0.1.0 ships classification with XGBoost and LightGBM. Planned for v0.2.0+:

  • Regression tasks
  • Time series forecasting (sktime / darts integration)
  • Deep learning baselines (pytorch-tabular)
  • Optuna multi-objective search (accuracy × latency × model size)
  • Persisted model artifacts with Docker reproducibility
  • Permutation feature importance (bias-free alternative to gain importance)
  • Notebook export — emit a Jupyter notebook that reproduces the winning run

Issues and PRs welcome.

Development

git clone https://github.com/rohithraju-ops/mcp-ml-lab.git
cd mcp-ml-lab
python -m venv .venv && source .venv/bin/activate
pip install -e ".[dev]"
pytest -v

Local debugging is easiest with the MCP Inspector:

npx @modelcontextprotocol/inspector mcp-ml-lab

License

MIT.

Metadata

Release files for mcp-ml-lab 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for mcp-ml-lab 0.1.0
File Size Uploaded
mcp_ml_lab-0.1.0.tar.gz 23.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for mcp-ml-lab 0.1.0
File Interpreter ABI Platform
mcp_ml_lab-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 47.5 kB

Release files / mcp_ml_lab-0.1.0.tar.gz

Download URL mcp_ml_lab-0.1.0.tar.gz
Size 23.5 kB
Tags Source
SHA-256 checksum
How to use checksums
707bf6efafe17e5c2027ddebf1c3e45731abaa9668242a3916434b8622576f98
BLAKE2b-256 checksum
How to use checksums
72a57bed700bd28b11c854362285c45f02f21bd68b956eeb41fc54de4e09ea32
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.12

Release files / mcp_ml_lab-0.1.0-py3-none-any.whl

Download URL mcp_ml_lab-0.1.0-py3-none-any.whl
Size 24.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0e80a6f4b54f1c23d3faa8f5ccb255843ca1775dba1fc43ff416db302ce13382
BLAKE2b-256 checksum
How to use checksums
85ddf00720f6b0552a8f464afe71cf573c4b3068c3b31804d47f19cc4cc54ee7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.12

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page