Complete guide for setting up Model Context Protocol (MCP) servers with marimo-flow across all development environments.
marimo-flow provides three MCP servers for AI-powered development:
| MCP Server | Purpose | Tools |
|---|---|---|
| Marimo | Notebook introspection & debugging | get_active_notebooks, get_notebook_errors, get_cell_runtime_data, get_tables_and_variables |
| Context7 | Live documentation for Python libraries | search_docs, get_library_docs |
| MLflow | Experiment tracking & model management | search_experiments, search_runs, log_metric, list_models |
- 📚 Live Documentation - Access up-to-date library docs without leaving your workflow
- 🔍 Notebook Introspection - Debug notebooks by inspecting runtime state
- 📊 Experiment Tracking - Query and manage MLflow experiments via AI
- 🤖 AI-First Development - Context-aware assistance from Claude, Cursor, etc.
Run each service in its own terminal:
# Terminal A — MLflow tracking + UI
uv run mlflow server \
--host 0.0.0.0 --port 5000 \
--backend-store-uri sqlite:///data/mlflow/db/mlflow.db \
--default-artifact-root data/mlflow/artifacts \
--serve-artifacts
# Terminal B — Marimo with MCP
uv run marimo edit examples/ --mcp --no-token --headless --port 2718For the full Docker stack instead, see README → Quick Start with Docker.
This starts:
- MLflow Server: http://localhost:5000
- Marimo with MCP: http://localhost:2718
- Marimo MCP Endpoint: http://localhost:2718/mcp/server
# Check MLflow
curl http://localhost:5000/health
# Check Marimo MCP
curl http://localhost:2718/mcp/server
# Check running services
ps aux | grep -E "mlflow|marimo"Choose your environment:
- Claude Desktop - Full MCP support
- VSCode - Marimo extension + tasks
- Cursor - AI coding with custom rules
- GitHub Actions - CI/CD with MCP
Purpose: Introspect running notebooks, debug errors, analyze data
How to start:
marimo edit examples/ --mcp --port 2718Endpoint: http://localhost:2718/mcp/server
Available Tools:
get_active_notebooks- List all open notebooksget_notebook_errors- Find runtime errors in cellsget_cell_runtime_data- Inspect cell execution stateget_tables_and_variables- Analyze DataFrames and variablesget_database_tables- Inspect DuckDB/SQL connectionsget_lightweight_cell_map- Get notebook structureget_marimo_rules- Get marimo best practices
Example Usage (with Claude):
User: "List active marimo notebooks"
Claude: [Uses get_active_notebooks]
→ Returns: ["01_pina_poisson_solver.py", "lab.py"]
User: "Find errors in the PINA solver notebook"
Claude: [Uses get_notebook_errors for 01_pina_poisson_solver.py]
→ Returns: Cell execution errors with stack traces
User: "Show me the variables in the Poisson solver notebook"
Claude: [Uses get_tables_and_variables]
→ Returns: Schema, row count, column types
Purpose: Live documentation for Python libraries
How it works: Automatically configured in .marimo.toml as a preset
Endpoint: https://context7.com/api/v1/mcp/sse (SSE transport)
Available Tools:
search_docs- Search documentation for any Python libraryget_library_docs- Get comprehensive library reference
Supported Libraries: Polars, Pandas, NumPy, Plotly, Altair, Marimo, scikit-learn, PyTorch, and 1000+ more
Example Usage:
User: "How do I use polars window functions?"
Claude: [Uses search_docs for "polars window functions"]
→ Returns: Latest polars docs + code examples
User: "Show me plotly 3D scatter plot examples"
Claude: [Uses get_library_docs for plotly]
→ Returns: Current plotly API with working samples
Purpose: Query experiments, track metrics, manage models
How to start:
export MLFLOW_TRACKING_URI=http://localhost:5000
mlflow mcp runTransport: stdio (for Claude Desktop/Code)
Available Tools:
search_experiments- Find ML experimentsget_experiment- Get experiment detailssearch_runs- Query training runsget_run- Get run detailslog_metric- Track experiment metricslog_param- Log hyperparameterslist_models- Browse model registryget_model_version- Get model version info
Example Usage:
User: "What experiments are in my MLflow?"
Claude: [Uses search_experiments]
→ Returns: List of experiments with IDs and names
User: "Show me the best run for the PINA experiment"
Claude: [Uses search_runs with filter]
→ Returns: Run with highest accuracy metric
User: "Log a new metric to run abc123"
Claude: [Uses log_metric]
→ Logs: run_id=abc123, metric=accuracy, value=0.95
# Install uv (if not already installed)
curl -LsSf https://astral.sh/uv/install.sh | sh
# Install project dependencies
uv sync.marimo.toml - MCP presets and server config:
[mcp]
presets = ["marimo", "context7"]
[mcp.mcpServers.mlflow]
command = "mlflow"
args = ["mcp", "run"]
env = { MLFLOW_TRACKING_URI = "http://localhost:5000" }# Terminal 1 - MLflow tracking server + UI
uv run mlflow server \
--host 0.0.0.0 --port 5000 \
--backend-store-uri sqlite:///data/mlflow/db/mlflow.db \
--default-artifact-root data/mlflow/artifacts \
--serve-artifacts
# Terminal 2 - Marimo with MCP
export MLFLOW_TRACKING_URI=http://localhost:5000
uv run marimo edit examples/ --mcp --no-token --port 2718
# Terminal 3 - MLflow MCP (optional, for IDEs that need stdio)
export MLFLOW_TRACKING_URI=http://localhost:5000
uv run mlflow mcp runVSCode users: each command above is also a task in
.vscode/tasks.json (Ctrl+Shift+P →
"Tasks: Run Task").
Ctrl+C in each terminal. To kill stragglers by port:
# Linux/macOS
lsof -ti :5000 :2718 | xargs kill
# Windows (PowerShell)
Get-NetTCPConnection -LocalPort 5000,2718 |
Select-Object -ExpandProperty OwningProcess |
ForEach-Object { Stop-Process -Id $_ -Force }Claude Desktop has full MCP support out of the box.
| OS | Path |
|---|---|
| macOS | ~/Library/Application Support/Claude/claude_desktop_config.json |
| Linux | ~/.config/Claude/claude_desktop_config.json |
| Windows | %APPDATA%\Claude\claude_desktop_config.json |
{
"mcpServers": {
"marimo": {
"transport": "http",
"url": "http://localhost:2718/mcp/server"
},
"context7": {
"transport": "sse",
"url": "https://context7.com/api/v1/mcp/sse"
},
"mlflow": {
"transport": "stdio",
"command": "mlflow",
"args": ["mcp", "run"],
"env": {
"MLFLOW_TRACKING_URI": "http://localhost:5000"
}
}
}
}The same config (with one extra serena entry) lives at
.vscode/mcp.json for Claude Code / VS Code
users — copy that as a starting point.
- Make sure both terminals from Quick Start are still running
- Restart Claude Desktop
- In Claude Desktop, try:
List all active marimo notebooks Search MLflow experiments Get documentation for polars DataFrame
VSCode has built-in Marimo extension support.
.vscode/settings.json (already configured):
{
"marimo.autoStartServer": true,
"marimo.pythonPath": "${workspaceFolder}/.venv/bin/python",
"marimo.port": 2718,
"marimo.serverArgs": ["--mcp"],
"terminal.integrated.env.linux": {
"MLFLOW_TRACKING_URI": "http://localhost:5000",
"PYTHONPATH": "${workspaceFolder}:${workspaceFolder}/src:${workspaceFolder}/snippets"
}
}.vscode/tasks.json provides shortcuts:
| Task | Shortcut | Description |
|---|---|---|
| Start All Services | Ctrl+Shift+B |
Start MLflow + Marimo |
| Start MLflow Server | Task menu | MLflow only |
| Start Marimo with MCP | Task menu | Marimo only |
| Run Tests | Ctrl+Shift+T |
Run pytest |
- Open VSCode in project root
- Run Task:
Ctrl+Shift+P→ "Tasks: Run Task" → "Start All Services" - Open Notebook: Click
.pyfile inexamples/ - Marimo Auto-starts in embedded browser
- Embedded browser for notebooks
- Auto-start server on file open
- MCP enabled by default (
--mcpflag) - Python environment auto-detection
Cursor has advanced AI features with custom rules support.
.cursor/settings.json (already configured):
{
"cursor.chat.model": "claude-sonnet-4.5",
"cursor.rules": [
"Prefer Polars over Pandas",
"Use Altair for visualizations",
"Marimo cells must be idempotent",
"Check MLflow before creating experiments"
]
}.cursorrules (already configured):
- Project-specific AI instructions
- MCP tools usage guidelines
- Code standards and best practices
- Common pitfalls to avoid
- Open Cursor in project root
- Start Services: see Quick Start
- Use Cursor AI (
Cmd+KorCmd+L):@marimo List active notebooks @docs How do I use polars lazy evaluation? @mlflow Show me the best experiment run
- Chat Model: Claude Sonnet 4.5
- Custom Rules: Project-specific guidelines in
.cursorrules - MCP Context: Knows about marimo-flow structure
- Smart Suggestions: Polars > Pandas, Altair charts, MLflow tracking
GitHub Actions has full MCP support via claude-code-action.
.github/workflows/claude-code.yml (already configured)
Triggers:
@claudementions in issues/PRs- New PRs opened
- PR synchronize (new commits)
Services Started:
- MLflow server (port 5000)
- Marimo with MCP (port 2718)
- MLflow MCP server (stdio)
MCP Servers Configured:
mcp_servers: |
[
{
"name": "marimo",
"transport": "http",
"url": "http://localhost:2718/mcp/server"
},
{
"name": "context7",
"transport": "sse",
"url": "https://context7.com/api/v1/mcp/sse"
},
{
"name": "mlflow",
"transport": "stdio",
"command": "mlflow",
"args": ["mcp", "run"],
"env": {
"MLFLOW_TRACKING_URI": "http://localhost:5000"
}
}
]-
Add GitHub Secret:
Repository → Settings → Secrets → Actions Name: ANTHROPIC_API_KEY Value: sk-ant-api03-... -
Test Workflow:
- Create issue:
@claude Analyze the PINA solver notebook - Create PR comment:
@claude Review this change
- Create issue:
Issue Comment:
@claude Analyze notebook 01_pina_poisson_solver.py for performance issuesClaude will:
- Use
get_active_notebooksto find the notebook - Use
get_notebook_errorsto check for errors - Use
get_tables_and_variablesto analyze data - Provide performance recommendations
PR Review:
@claude Review this PR and ensure it follows marimo best practicesClaude will:
- Read changed files
- Check for reactivity issues
- Verify MLflow logging
- Suggest improvements
Returns list of currently open notebooks.
Parameters: None
Returns:
{
"notebooks": [
"01_pina_poisson_solver.py",
"lab.py"
]
}Find runtime errors in notebooks.
Parameters:
notebook_name(optional): Specific notebook to check
Returns:
{
"errors": [
{
"cell_id": "c123",
"error_type": "ValueError",
"message": "Invalid data shape",
"traceback": "..."
}
]
}Inspect cell execution state.
Parameters:
notebook_name: Notebook to inspectcell_id: Cell identifier
Returns:
{
"status": "completed",
"runtime_ms": 250,
"outputs": ["DataFrame with 1000 rows"]
}Analyze DataFrames and variables.
Parameters:
notebook_name: Notebook to inspect
Returns:
{
"tables": [
{
"name": "data_raw",
"type": "polars.DataFrame",
"shape": [1000, 5],
"columns": ["id", "age", "income", "category", "score"]
}
]
}Search documentation for Python libraries.
Parameters:
query: Search query (e.g., "polars window functions")
Returns:
{
"results": [
{
"title": "Window Functions in Polars",
"url": "...",
"snippet": "Use .rolling_mean() for moving averages..."
}
]
}Get comprehensive library reference.
Parameters:
library: Library name (e.g., "polars", "plotly")topic(optional): Specific topic
Returns: Full documentation with code examples
Find ML experiments.
Parameters:
filter_string(optional): MLflow filter expression
Returns:
{
"experiments": [
{
"experiment_id": "1",
"name": "pina-walrus-solver",
"artifact_location": "..."
}
]
}Query training runs.
Parameters:
experiment_ids: List of experiment IDsfilter_string(optional): Filter expressionorder_by(optional): Sort order
Returns:
{
"runs": [
{
"run_id": "abc123",
"metrics": {"accuracy": 0.95},
"params": {"learning_rate": 0.001}
}
]
}Track experiment metric.
Parameters:
run_id: Run identifierkey: Metric namevalue: Metric valuetimestamp(optional): Unix timestamp
Returns: Success confirmation
Symptom: curl http://localhost:2718/mcp/server fails
Solutions:
# 1. Check if marimo is running
ps aux | grep marimo
# 2. Check if marimo has --mcp flag
# Should see: marimo edit examples/ --mcp
# 3. Restart marimo with MCP
pkill -f marimo
marimo edit examples/ --mcp --port 2718
# 4. Check logs
tail -f marimo.logSymptom: curl http://localhost:5000/health fails
Solutions:
# 1. Check if port is in use
lsof -i :5000
# 2. Check database path
ls -la data/mlflow/db/mlflow.db
# 3. Create database if missing
mkdir -p data/mlflow/db
touch data/mlflow/db/mlflow.db
# 4. Restart MLflow (Ctrl+C in its terminal, then re-run)
uv run mlflow server --host 0.0.0.0 --port 5000 \
--backend-store-uri sqlite:///data/mlflow/db/mlflow.db \
--default-artifact-root data/mlflow/artifacts --serve-artifactsSymptom: mlflow mcp run exits immediately
Solutions:
# 1. Check MLFLOW_TRACKING_URI is set
echo $MLFLOW_TRACKING_URI
# Should be: http://localhost:5000
# 2. Export it if missing
export MLFLOW_TRACKING_URI=http://localhost:5000
# 3. Verify MLflow is running
curl http://localhost:5000/health
# 4. Try again
mlflow mcp runSymptom: MCP tools not available in Claude Desktop
Solutions:
# 1. Verify config file location
# macOS:
ls -la ~/Library/Application\ Support/Claude/claude_desktop_config.json
# Linux:
ls -la ~/.config/Claude/claude_desktop_config.json
# 2. Validate JSON syntax
cat ~/.config/Claude/claude_desktop_config.json | jq .
# 3. Check services are running (both MLflow on :5000 and Marimo on :2718)
curl -s http://localhost:5000/health && curl -sI http://localhost:2718
# 4. Restart Claude Desktop completely
# Quit app, then reopen
# 5. Check Claude Desktop logs
# macOS:
tail -f ~/Library/Logs/Claude/main.logSymptom: claude-code.yml workflow fails
Solutions:
-
Check ANTHROPIC_API_KEY secret is set:
- Settings → Secrets → Actions
- Verify
ANTHROPIC_API_KEYexists
-
Check workflow logs:
- Actions tab → Failed workflow → View logs
-
Common issues:
- Timeout waiting for services (increase wait time)
- Port conflicts (use different ports in CI)
- Missing dependencies (check
uv syncstep)
Add your own MCP server to .marimo.toml:
[mcp.mcpServers.custom-server]
command = "npx"
args = ["-y", "@your-org/your-mcp-server"]
env = { API_KEY = "your-key" }MCP servers work in Docker too (see docker/.marimo.toml):
# Start with docker-compose
docker compose -f docker/docker-compose.yaml up
# MCP endpoints:
# Marimo: http://localhost:2718/mcp/server
# MLflow: Configure with MLFLOW_TRACKING_URI=http://localhost:5000Enable verbose logging:
# Marimo MCP
MARIMO_DEBUG=1 marimo edit examples/ --mcp
# MLflow MCP
MLFLOW_MCP_DEBUG=1 mlflow mcp run- Marimo MCP Documentation
- Model Context Protocol Specification
- MLflow MCP Guide
- Context7 Documentation
- Claude Code Action
Quick Commands:
# Terminal A — MLflow
uv run mlflow server --host 0.0.0.0 --port 5000 \
--backend-store-uri sqlite:///data/mlflow/db/mlflow.db \
--default-artifact-root data/mlflow/artifacts --serve-artifacts
# Terminal B — Marimo with MCP
uv run marimo edit examples/ --mcp --no-token --port 2718
# Stop: Ctrl+C in each terminalFor Claude Desktop, copy .vscode/mcp.json into
claude_desktop_config.json (paths above) and restart the app.
MCP Endpoints:
- Marimo:
http://localhost:2718/mcp/server - Context7:
https://context7.com/api/v1/mcp/sse - MLflow: stdio (
mlflow mcp run)
Next Steps:
- Start services
- Configure your IDE
- Try MCP tools with Claude
- Read MCP Tools Reference