Skip to main content
Glama

AutoML Stat MCP

License Python 3.10+ Docker

AI-powered statistical analysis and AutoML platform using Model Context Protocol (MCP).

AutoML Stat MCP provides 51+ statistical and machine learning tools through the MCP interface, enabling AI agents (Claude, GPT, etc.) to perform comprehensive clinical research analysis. Supports real-time progress notifications via SSE for long-running operations.


โœจ Features

๐Ÿ“Š Statistical Analysis (51+ MCP Tools)

  • Descriptive Statistics: Table One generation, correlation analysis, group comparisons

  • Survival Analysis: Kaplan-Meier curves, Cox proportional hazards, log-rank tests

  • Propensity Score Analysis: PSM matching, IPW weighting, treatment effect estimation

  • ROC Analysis: AUC with CI, threshold optimization, DeLong test for model comparison

  • Power Analysis: T-test, ANOVA, Chi-square, proportion, survival sample size calculation

๐Ÿค– Machine Learning (AutoGluon Backend)

  • AutoML Training: Automatic model selection and hyperparameter tuning

  • Multi-Algorithm Support: XGBoost, LightGBM, CatBoost, Random Forest, Neural Networks

  • Classification & Regression: Binary, multiclass, and regression problems

๐Ÿ”ง Data Preparation

  • Missing Value Analysis: MCAR/MAR/MNAR detection with imputation recommendations

  • Data Cleaning: PII detection, outlier handling, encoding categorical variables

  • Quality Checks: VIF multicollinearity, data validation, integrity checks


Related MCP server: dag-studio-mcp

๐Ÿš€ Quick Start

Prerequisites

  • Docker & Docker Compose

  • 8GB+ RAM recommended

  • (Optional) GPU for accelerated ML training

โšก One-Line Install (ๆŽจ่–ฆ)

# Clone and auto-install
git clone https://github.com/u9401066/automl-stat-mcp.git
cd automl-stat-mcp
./quick-install.sh

๐ŸŽฏ Quick Launch Scripts

# ๆ–นๅผ 1: ไฝฟ็”จๅ•Ÿๅ‹•่…ณๆœฌ (ๆŽจ่–ฆ)
./start.sh           # ้ ่จญๆจกๅผ (็ตฑ่จˆๅˆ†ๆž)
./start.sh ml        # ML ๆจกๅผ (ๅซ่จ“็ทด)
./start.sh full      # ๅฎŒๆ•ดๆจกๅผ (ๅซ MinIO)

# ๆ–นๅผ 2: ไฝฟ็”จ Makefile (ๆœ€ๆ–นไพฟ)
make start           # ๅ•Ÿๅ‹•้ ่จญๆœๅ‹™
make start-ml        # ๅ•Ÿๅ‹• ML ๆœๅ‹™
make start-full      # ๅ•Ÿๅ‹•ๅฎŒๆ•ดๆœๅ‹™
make logs            # ๆŸฅ็œ‹ๆ—ฅ่ชŒ
make health          # ๅฅๅบทๆชขๆŸฅ
make help            # ๆ‰€ๆœ‰ๅฏ็”จๆŒ‡ไปค

# ๆ–นๅผ 3: ไฝฟ็”จ Docker Compose (้€ฒ้šŽ)
docker compose up -d                    # ้ ่จญ
docker compose --profile ml up -d       # ML
docker compose --profile full up -d     # ๅฎŒๆ•ด

๐Ÿ›‘ Stop Services

./stop.sh            # ๆˆ– make stop

Verify Installation

# Check service health
curl http://localhost:8003/health  # Stats service
curl http://localhost:8002/health  # MCP server

# List available sample datasets
curl http://localhost:8003/api/files/list

Connect to AI Agent

VS Code Copilot (ๆŽจ่–ฆ)

ๅœจไฝ ็š„ๅฐˆๆกˆๆ น็›ฎ้Œ„ๅปบ็ซ‹ .vscode/mcp.json๏ผš

{
  "servers": {
    "automl-stat-mcp": {
      "url": "http://localhost:8002/sse",
      "type": "sse"
    }
  }
}

ๆˆ–ไฝฟ็”จๅฟซ้€Ÿ่จญๅฎš่…ณๆœฌ๏ผŒๅœจ็›ฎๆจ™ๅฐˆๆกˆ็›ฎ้Œ„ๅŸท่กŒ๏ผš

/path/to/automl-stat-mcp/scripts/setup-vscode-mcp.sh

Claude Desktop / Cursor

ๅœจ MCP ่จญๅฎšไธญๆ–ฐๅขž๏ผš

{
  "mcpServers": {
    "automl-stat-mcp": {
      "url": "http://localhost:8002/sse"
    }
  }
}

๐Ÿ“Š Deployment Profiles

Profile

Command

Components

Use Case

Default

docker compose up -d

Stats + MCP

Statistical analysis only

ml

docker compose --profile ml up -d

+ AutoML API/Workers

ML training enabled

full

docker compose --profile full up -d

+ MinIO

Full stack with object storage

Storage Modes

Default: Local file storage (no external dependencies)

Mode

Environment Variable

Description

Requirements

Local (Default)

STORAGE_MODE=local

Uses local /data directory for all storage operations

None

MinIO

STORAGE_MODE=minio

S3-compatible object storage for distributed deployment

Profile: full

Volume Mounts:

volumes:
  - ./sample_data:/data/sample_data:ro   # Sample datasets (read-only)
  - ./projects:/data/projects             # User projects
  - local-results:/data/results           # Analysis results

Switching Storage Modes:

# Local storage (default)
docker compose up -d

# MinIO storage (requires full profile)
STORAGE_MODE=minio docker compose --profile full up -d

Path Resolution:

  • User input: iris.csv โ†’ Container path: /data/sample_data/iris.csv

  • User input: projects/study1/data.csv โ†’ /data/projects/study1/data.csv


๐Ÿ› ๏ธ Configuration

Environment Variables

Copy .env.example to .env and customize:

cp .env.example .env

Key settings:

Variable

Default

Description

STORAGE_MODE

local

Storage backend: local or minio

LOG_LEVEL

INFO

Logging level

MINIO_ENDPOINT

minio:9000

MinIO server address

MINIO_ACCESS_KEY

minioadmin

MinIO access key

MINIO_SECRET_KEY

minioadmin

MinIO secret key

Scaling Workers

# Scale stats workers
docker compose up -d --scale stats-worker=4

# Scale ML workers (requires ml profile)
docker compose --profile ml up -d --scale automl-worker=8 --scale stats-worker=4

๐Ÿ“ Sample Datasets

The sample_data/ directory includes test datasets:

Dataset

Type

Target

Records

iris.csv

Classification

species

150

titanic.csv

Binary

survived

891

heart_disease.csv

Binary

target

303

breast_cancer.csv

Binary

diagnosis

569

medical_study_200.csv

RCT

treatment_group

200

rossi_recidivism.csv

Survival

arrest, week

432

stanford_heart.csv

Survival

status, time

103


๐Ÿ”ง MCP Tools Reference

Tool

Description

smart_analyze

One-stop analysis: stats + Table One + correlations

quick_preview

Fast data preview with auto path resolution

compare_treatment_groups

Simplified group comparison

analyze_medical_study

Complete RCT analysis pipeline

Statistical Analysis

Category

Tools

Descriptive

generate_tableone_directly, analyze_correlations, compare_groups, get_quick_stats

Survival

kaplan_meier_survival, cox_proportional_hazards

Propensity

run_propensity_analysis, estimate_treatment_effect

ROC

compute_roc_curve, compare_roc_curves, find_optimal_threshold, full_classifier_evaluation

Power

power_ttest, power_anova, power_chisquare, power_proportion, power_survival

Data Preparation

Category

Tools

Quality

analyze_missing_values, check_multicollinearity, get_column_info

Cleaning

handle_missing_values, encode_categorical, convert_to_binary, filter_rows, remove_columns

Project

create_project_workspace, list_available_files, list_project_workspaces

ML Training (Requires ml profile)

Tool

Description

train_and_wait

One-shot AutoML training

submit_automl_job

Async training submission

get_job_status

Check training progress

get_model_leaderboard

View trained models ranking

predict

Make predictions


๐Ÿ—๏ธ Architecture

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚                     AI Agent (Claude/GPT)                       โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                                โ”‚ MCP Protocol
                                โ–ผ
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚                     automl-mcp (Port 8002)                      โ”‚
โ”‚                   51+ MCP Tools Handlers                        โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                    โ”‚                           โ”‚
                    โ–ผ                           โ–ผ
    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”   โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
    โ”‚   stats-service (8003)    โ”‚   โ”‚   automl-api (8001)       โ”‚
    โ”‚   Statistical Analysis    โ”‚   โ”‚   ML Training API         โ”‚
    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜   โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                    โ”‚                           โ”‚
                    โ–ผ                           โ–ผ
    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”   โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
    โ”‚      stats-worker         โ”‚   โ”‚     automl-worker         โ”‚
    โ”‚   Background Analysis     โ”‚   โ”‚   AutoGluon Training      โ”‚
    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜   โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                    โ”‚                           โ”‚
                    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                                    โ–ผ
                    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
                    โ”‚         Redis             โ”‚
                    โ”‚    Job Queue & Cache      โ”‚
                    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                                    โ”‚
            โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
            โ–ผ                                               โ–ผ
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”                     โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚   Local Storage       โ”‚         OR          โ”‚   MinIO Storage       โ”‚
โ”‚   /data/...           โ”‚                     โ”‚   Object Storage      โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜                     โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

๐Ÿ“š Documentation


๐Ÿค Contributing

We welcome contributions! Please see CONTRIBUTING.md for guidelines.

Development Setup

# Clone your fork or local mirror
git clone --recursive https://github.com/YOUR_USERNAME/automl-stat-mcp.git
cd automl-stat-mcp

# Sync the workspace environment
uv venv
source .venv/bin/activate  # or .venv\Scripts\activate on Windows
uv sync --all-extras

# Install developer hooks
make hooks-install

# Run quality gates
make check

# Run tests (interactive mode)
./run_tests.sh

# Or use focused targets
make test        # smoke tests
make test-all    # full pytest collection

# Or run specific test suites
./run_tests.sh fast        # Fast tests only
./run_tests.sh edge        # Edge case tests
./run_tests.sh e2e         # End-to-end workflow tests
./run_tests.sh performance # Performance & load tests
./run_tests.sh security    # Security tests
./run_tests.sh coverage    # Generate coverage report

Test Suites

Our comprehensive test coverage includes:

  • Edge Cases (50+ tests): Data boundaries, input validation, statistical/ML edge cases

  • E2E Workflows (20+ tests): Complete medical RCT, survival analysis, ML training pipelines

  • Performance (15+ tests): Load benchmarks, concurrent requests, stress tests

  • Security (20+ tests): Injection attacks, path traversal, rate limiting, user isolation

See TESTING_ENHANCEMENT_PLAN.md for details.

# Run all tests
uv run pytest

# Run with coverage
uv run pytest --cov=. --cov-report=html tests/

# Run specific markers
uv run pytest -m "edge_case" tests/
uv run pytest -m "e2e" tests/
uv run pytest -m "performance" tests/
uv run pytest -m "security" tests/

๐Ÿ“„ License

This project is licensed under the Apache License 2.0 - see the LICENSE file for details.


๐Ÿ™ Acknowledgments

Built with these excellent open source projects:


๐Ÿ“ง Contact

  • Use the repository Issues tab for bug reports and regressions.

  • Use the repository Discussions tab for design questions and workflow proposals.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelogโ€ฆ

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      A
      quality
      D
      maintenance
      Enables exploratory data analysis through an MCP server, allowing AI assistants to load datasets, compute summary statistics, generate diagnostic plots, perform correlation analysis, and produce full markdown reports.
      6
      MIT
    • A
      license
      A
      quality
      C
      maintenance
      MCP server for the DAG Studio causal-inference engine, enabling AI agents to construct, analyze, and validate causal directed acyclic graphs (DAGs) through tools for analysis, data simulation, and code generation.
      9
      Apache 2.0
    • A
      license
      Not graded
      quality
      B
      maintenance
      Enables AI-native statistical analysis and reproducible research workflows through MCP, including natural language planning, protocol-based analysis, Python/R cross-validation, and publication-ready figure generation.
      MIT
    • A
      license
      Not graded
      quality
      C
      maintenance
      Enables AI agents to run a full quant research workflow over MCP: pulling data, authoring and backtesting strategies, running statistical validation and risk checks, and recording findings for future sessions.
      1
      MIT