Skip to main content
Glama

MCP Data Science

Python MCP scikit--learn pandas License

MCP server (Model Context Protocol) that gives an LLM 102 tools for complete data science pipelines. Load, inspect, clean, transform, encode, visualize, analyze datasets, train ML models, select features, handle datetime operations, run statistical tests, interpret models, perform clustering, and reduce dimensionality — all through natural language. Built-in agent workflow guide with a 13-phase pipeline, decision frameworks, and common pitfall warnings. Zero configuration — point any MCP-compatible client at the server and start analyzing data.


Motivation

Data science workflows require dozens of repetitive steps: loading CSVs, checking for missing values, encoding categoricals, training models, evaluating results. MCP Data Science wraps the entire pipeline into a single server that any LLM agent can drive end-to-end — no notebooks, no boilerplate, no context switching.

Phase

Tools

What it covers

Loading

11

CSV, Excel, Parquet, merge, pivot, melt, concat

Inspection

9

Head, tail, info, stats, quality report, profiling

Cleaning

9

Duplicates, missing values, outliers, filtering, binning

Transformation

9

Computed columns, log transform, normalization, string cleaning

Encoding

4

One-hot, target, label, frequency encoding

Visualization

14

Histogram, scatter, box, violin, QQ, correlation matrix, heatmap…

Analysis

8

Correlation, outliers, group aggregation, crosstab

Modeling

8

Train/test split, train, predict, evaluate, cross-validate, grid search

Feature Selection

4

Variance filter, correlation filter, importance ranking

Datetime

4

Extract parts, diff, filter, set index

Statistical Tests

6

t-test, ANOVA, chi-square, normality, Mann-Whitney, Kruskal-Wallis

Interpretation

7

Feature importance, residuals, confusion matrix, ROC, learning curve

Clustering

5

K-Means, DBSCAN, elbow plot, silhouette score, cluster profiling

Dimensionality

2

PCA, t-SNE

Reporting

2

Markdown report, self-contained HTML report

All 102 tools follow the same pattern: accept a DataFrame name (or use the current one), perform the operation, return a concise text summary (or a PNG image for visualizations).


Related MCP server: Quilt MCP Server

Features

  • 102 data science tools — complete pipeline from raw CSV to trained model with interpretability

  • Stateful DataStore — named DataFrames, trained models, and plot images persist across tool calls

  • 13-phase agent workflow — built-in instructions guide the LLM through EDA → cleaning → feature engineering → modeling → reporting

  • Decision frameworks — when to use parametric vs. non-parametric tests, how to handle missing data, which encoding to pick

  • Visualization as images — matplotlib figures converted to PNG and returned as MCP Image objects

  • ML model management — train, evaluate, compare, and tune scikit-learn models (linear/logistic regression, random forest, gradient boosting, decision tree)

  • Statistical testing — t-test, ANOVA, chi-square, normality, Mann-Whitney, Kruskal-Wallis with effect sizes

  • Clustering — K-Means, DBSCAN, elbow method, silhouette analysis, cluster profiling

  • Dimensionality reduction — PCA (with variance explained) and t-SNE (with auto-sampling for large datasets)

  • Report generation — Markdown (.md + PNG plots) or self-contained HTML with embedded base64 images

  • Pitfall prevention — 12 documented common mistakes the agent is warned about (e.g., target encoding before split = data leakage)


Architecture Overview

┌─────────────────────────────────────────────────────┐
│              MCP Client (Claude, etc.)              │
│                                                     │
│   "Load sales.csv, show a quality report,           │
│    clean missing values, train a random forest"     │
└──────────────────────┬──────────────────────────────┘
                       │  stdio (JSON-RPC)
          ┌────────────┴────────────┐
          │   FastMCP Server        │
          │   (server.py)           │
          │                         │
          │   ┌───────────────┐     │
          │   │  DataStore    │     │
          │   │  · DataFrames │     │
          │   │  · ML Models  │     │
          │   │  · Plot cache │     │
          │   └───────────────┘     │
          │                         │
          │   15 tool modules       │
          │   (102 tools total)     │
          │                         │
          │   · pandas              │
          │   · scikit-learn        │
          │   · matplotlib/seaborn  │
          │   · category-encoders   │
          │   · scipy               │
          └─────────────────────────┘

No external services required — all computation happens in-process. The server communicates via stdio (standard MCP transport).


Tech Stack

Layer

Technology

Details

Protocol

MCP (FastMCP)

stdio transport, JSON-RPC

Data

pandas 2.0+, numpy 1.24+

DataFrame manipulation, numerical computing

ML

scikit-learn 1.3+

Regression, classification, clustering, preprocessing

Visualization

matplotlib 3.7+, seaborn 0.13+

14 plot types, Agg backend → PNG export

Encoding

category-encoders 2.6+

Target encoding, frequency encoding

Statistics

scipy

t-test, ANOVA, chi-square, normality, non-parametric tests

Images

Pillow 10+

PNG encoding for MCP Image responses

Build

hatchling

PEP 517 build system

Testing

pytest 7+

200+ test functions across 13 test files

Formats

openpyxl (Excel), pyarrow (Parquet)

Optional dependencies for additional file formats


Project Structure

mcp-data-science/
├── pyproject.toml                       # Build config + dependencies
├── CLAUDE.md                            # Architecture reference
│
├── src/mcp_data_science/
│   ├── __init__.py                      # main() entry point → mcp.run(transport="stdio")
│   ├── __main__.py                      # python -m support
│   ├── server.py                        # FastMCP instance + registers all 15 tool modules
│   ├── state.py                         # DataStore: named DataFrames, ML models, plot cache
│   ├── instructions.md                  # 13-phase agent workflow guide (loaded as MCP instructions)
│   └── tools/
│       ├── _plot_helpers.py             # fig_to_image() — matplotlib Agg → PNG → MCP Image
│       ├── loading.py                   # 11 tools: load/save CSV/Excel/Parquet, merge, pivot, melt, concat
│       ├── inspection.py                # 9 tools: head, tail, info, stats, shape, quality_report, profile
│       ├── cleaning.py                  # 9 tools: duplicates, missing, filter, rename, clip, sort, bin
│       ├── transformation.py            # 9 tools: create_column, log, normalize, mapping, dtype, string_clean
│       ├── encoding.py                  # 4 tools: one-hot, target, label, frequency encoding
│       ├── visualization.py             # 14 tools: histogram, bar, scatter, box, violin, QQ, heatmap…
│       ├── analysis.py                  # 8 tools: correlation, outliers, group_aggregate, crosstab
│       ├── modeling.py                  # 8 tools: train/test split, train, predict, evaluate, grid_search
│       ├── feature_selection.py         # 4 tools: correlation_filter, variance_filter, importance
│       ├── datetime_tools.py            # 4 tools: extract_parts, diff, filter, set_index
│       ├── statistical_tests.py         # 6 tools: ttest, anova, chi_square, normality, mann_whitney, kruskal
│       ├── interpretation.py            # 7 tools: feature_importance, residuals, confusion_matrix, ROC, PR
│       ├── clustering.py                # 5 tools: kmeans, dbscan, elbow, silhouette, cluster_profile
│       ├── dimensionality.py            # 2 tools: pca_transform, tsne_plot
│       └── reporting.py                 # 2 tools: save_report (md), save_report_html
│
└── tests/
    ├── conftest.py                      # Fixtures: sample_df, numeric_df, datetime_df, classification_df
    ├── sample_data.csv                  # Test fixture data
    ├── test_server.py                   # Server bootstrap, tool count verification
    ├── test_state.py                    # DataStore management (25 tests)
    ├── test_loading.py                  # CSV/Excel/Parquet loading (18 tests)
    ├── test_inspection.py               # Inspection tools (15 tests)
    ├── test_cleaning.py                 # Cleaning tools (23 tests)
    ├── test_transformation.py           # Transformation tools (22 tests)
    ├── test_encoding.py                 # Encoding tools (9 tests)
    ├── test_visualization.py            # Visualization tools (26 tests)
    ├── test_analysis.py                 # Analysis tools (18 tests)
    ├── test_modeling.py                 # Modeling tools (14 tests)
    ├── test_feature_selection.py        # Feature selection tools (9 tests)
    ├── test_datetime_tools.py           # Datetime tools (11 tests)
    └── test_reporting.py                # Reporting tools (8 tests)

Prerequisites

Requirement

Version

Install

Python

3.10+

python.org

uv (recommended)

latest

pip install uv or docs.astral.sh

Note: No GPU needed. All computation runs on CPU. Optional dependencies (openpyxl for Excel, pyarrow for Parquet) are installed automatically.


Installation

git clone https://github.com/AstyanM/mcp-data-science.git
cd mcp-data-science
pip install -e .

With test dependencies

pip install -e ".[test]"

Using uv

uv venv --python 3.13
uv pip install -e ".[test]"

Usage

As an MCP server

Add to your MCP client configuration (e.g., .mcp.json, Claude Desktop config):

{
  "mcpServers": {
    "mcp-data-science": {
      "command": "python",
      "args": ["-m", "mcp_data_science"]
    }
  }
}

The server starts on stdio and exposes all 102 tools to your MCP client.

With MCP Inspector (interactive testing)

mcp dev src/mcp_data_science/server.py

Opens a web UI at http://localhost:6274:

  1. Set Command = python, Arguments = -m mcp_data_science, then click Connect

  2. Go to the Tools tab — all 102 tools are listed

  3. Call load_csv first with a CSV path, then call any other tool

Direct execution

python -m mcp_data_science

Run tests

pytest tests/

Agent Workflow

The server includes a built-in 13-phase workflow guide that instructs the LLM how to approach data science tasks systematically:

Phase 1:  Loading & First Look      →  load_csv, get_shape, get_head, get_info
Phase 2:  Exploratory Data Analysis  →  quality_report, get_statistics, plot_histogram, plot_bar
Phase 3:  Statistical Testing        →  normality_test, ttest, anova, chi_square
Phase 4:  Data Cleaning              →  drop_duplicates, fill_missing, string_clean, clip_outliers
Phase 5:  Feature Engineering        →  create_column, extract_datetime_parts, log_transform
Phase 6:  Categorical Encoding       →  one_hot_encode, target_encode, label_encode
Phase 7:  Feature Selection          →  variance_filter, correlation_filter, feature_importance
Phase 8:  Dimensionality Reduction   →  pca_transform, tsne_plot
Phase 9:  Normalization              →  normalize (only for distance-based models)
Phase 10: Modeling                   →  train_test_split, train_model, evaluate_model
Phase 11: Model Interpretation       →  plot_residuals, plot_confusion_matrix, plot_roc_curve
Phase 12: Clustering                 →  elbow_plot, kmeans_cluster, silhouette_score
Phase 13: Reporting                  →  save_report, save_report_html

Decision frameworks

The workflow includes decision trees for common choices:

Decision

Framework

Missing data

<5% → fill with median/mode · 5–30% → investigate · >50% → consider dropping

Group comparison test

2 groups + normal → t-test · 2 groups + non-normal → Mann-Whitney · 3+ groups → ANOVA or Kruskal-Wallis

Categorical encoding

2–10 unique → one-hot · >10 unique → target encode · ordinal → label encode

Normalization

Linear/logistic models → yes · Tree-based models → no


Key Patterns

  • Tool registration: each module exports register_tools(mcp, store), called in server.py

  • State: DataStore holds dict[str, pd.DataFrame] + dict[str, dict] for ML models. All tools accept df_name: str = "" (empty = current)

  • Mutations: tools modify the DataFrame in the store via store.set(name, df) and return a concise text summary

  • Visualization: tools create matplotlib figures, convert via fig_to_image() → Image(data=png_bytes, format="png"), always plt.close(fig) after

  • Modeling: models stored as {"model": sklearn_obj, "type": str, "features": list, "target": str} in DataStore._models

  • Errors: tools return readable error strings, never raw exceptions


Supported Models

Task

Models

Regression

Linear Regression, Random Forest, Gradient Boosting, Decision Tree

Classification

Logistic Regression, Random Forest, Gradient Boosting, Decision Tree

Clustering

K-Means, DBSCAN

Dimensionality Reduction

PCA, t-SNE


Contributing

Contributions are welcome! Please open an issue first to discuss what you would like to change.

  1. Fork the repository

  2. Create your feature branch (git checkout -b feature/amazing-feature)

  3. Commit your changes (git commit -m 'Add amazing feature')

  4. Push to the branch (git push origin feature/amazing-feature)

  5. Open a Pull Request

Rules for new tools

  • Follow the register_tools(mcp, store) pattern

  • Never print to stdout — it's reserved for MCP stdio protocol (use logging → stderr)

  • Visualization tools must always close figures (plt.close(fig)) to prevent memory leaks

  • Tool docstrings are LLM-facing — keep them clear and include parameter examples

  • create_column uses df.eval() (safe pandas expressions), never Python eval()


Author


License

This project is licensed under the MIT License — see the LICENSE file for details.

Available Tools

102 tools
add_row_indexA

Add or reset a numeric row index as a column. Add a numeric identifier column. Useful after filtering to create unique IDs or reset row numbering. Example: add_row_index(column_name="row_id", start=1)

Inputs: start, df_name, column_name. Returns: result

anova_testA

One-way ANOVA test. Compares means of a numeric column across 3+ groups. Use to determine if at least one group mean differs significantly from the others. For exactly 2 groups, ttest_independent is more appropriate. Example: anova_test(column="Revenue", group_column="FlownMonth")

Inputs: column (required), group_column (required), df_name. Returns: result

apply_mappingA

Map values in a column using a dictionary. Unmapped values stay as-is. Values are auto-converted to match the column's type. Map categorical values to new values. Useful for translating codes, merging similar categories, or creating ordinal mappings. Example: apply_mapping(column="FlownMonth", mapping={"SEPTEMBER":"9","OCTOBER":"10"})

Inputs: column (required), mapping (required), df_name. Returns: result

bin_columnB

Discretize a numeric column into bins/categories. Methods: 'quantile' (equal-frequency bins), 'uniform' (equal-width bins), 'custom' (provide bin edges as list). For custom bins, pass bins as a list of edges, e.g. [0, 100, 1000, float('inf')]. Example: bin_column(column="Revenue", bins=3, method="quantile", labels=["low","medium","high"]) Example: bin_column(column="Revenue", bins=[0,500,5000,1e9], method="custom", labels=["small","medium","large"])

Inputs: column (required), bins, labels, method, +2 more. Returns: result

chi_square_testA

Chi-square test of independence between two categorical columns. Tests whether two categorical variables are statistically associated or independent. Example: chi_square_test(col_a="CargoType", col_b="ProductCode")

Inputs: col_a (required), col_b (required), df_name. Returns: result

clip_outliersA

Clip outlier values in a numeric column. Methods: 'iqr' (Q1 - multiplierIQR, Q3 + multiplierIQR) or 'quantile' (lower/upper quantile). Use AFTER detect_outliers confirms outliers exist. Only clip if outliers are errors; genuine extreme values should be kept. Example: clip_outliers(column="Revenue", method="iqr", iqr_multiplier=1.5)

Inputs: column (required), method, df_name, iqr_multiplier, +2 more. Returns: result

cluster_profileA

Descriptive statistics per cluster: mean of each feature for each cluster. Use to understand what characterizes each cluster. If feature_columns is empty, uses all numeric columns. Example: cluster_profile(cluster_column="cluster", feature_columns=["Revenue","Weight","Pieces"])

Inputs: cluster_column (required), df_name, feature_columns. Returns: result

compare_modelsA

Compare multiple model types using cross-validation. Returns a ranked table. Quick way to find the best model type before fine-tuning hyperparameters. Default models: linear_regression, random_forest, gradient_boosting (or classifiers if target is categorical). Example: compare_models(target_column="Revenue", model_types=["linear_regression","random_forest","gradient_boosting"])

Inputs: target_column (required), df_name, n_folds, model_types. Returns: result

concat_dataframesA

Concatenate multiple dataframes along rows (axis=0) or columns (axis=1). Combine train and test sets back together, or append new data. Example: concat_dataframes(names=["data_train", "data_test"], axis=0)

Inputs: names (required), axis, result_name. Returns: result

convert_dtypeA

Convert column types. Dtypes: 'int', 'float', 'str', 'category', 'datetime', 'bool'. Fix incorrect types (numeric stored as string). Do this BEFORE statistical analysis or encoding. Example: convert_dtype(columns=["age","score"], dtype="float")

Inputs: dtype (required), columns (required), df_name. Returns: result

copy_dataframeA

Create a deep copy of a dataframe under a new name. Use BEFORE any destructive operation (dropping, filtering, encoding) if you may need the original data later.

Inputs: new_name (required), source_name (required). Returns: result

correlation_filterA

Identify features with correlation to target below threshold. Returns list of low-importance columns with their correlation values. Does NOT auto-drop. Non-destructive: identifies low-correlation features but does NOT drop them. Review results before using drop_low_importance. Example: correlation_filter(target_column="Revenue", threshold=0.05, method="pearson")

Inputs: target_column (required), method, df_name, threshold. Returns: result

create_columnA

Create a new column using a pandas eval expression. Columns are referenced by name. For domain-relevant feature engineering: ratios, differences, interactions. Always add epsilon (1e-5) to denominators to avoid division by zero. Example: create_column(new_column="Yield", expression="Revenue / (ChargeableWeight + 1e-5)") Example: create_column(new_column="WeightPerPiece", expression="ChargeableWeight / (Pieces + 1e-5)")

Inputs: expression (required), new_column (required), df_name. Returns: result

crosstabA

Cross-tabulation of two categorical columns. Optional normalization (percentages). Understand relationships between two categorical variables. Set normalize=True to see percentages instead of raw counts. Example: crosstab(index_col="City", columns_col="Category", normalize=True)

Inputs: index_col (required), columns_col (required), df_name, normalize. Returns: result

cross_validateA

K-fold cross-validation. Returns mean and std of scores across folds. More reliable than a single train/test split. Detects overfitting when train >> test scores. Example: cross_validate(target_column="Revenue", model_type="random_forest", n_folds=5)

Inputs: target_column (required), df_name, n_folds, model_type, +1 more. Returns: result

datetime_diffA

Compute time difference between two datetime columns (column_a - column_b). Units: days, hours, minutes, seconds. Creates a new numeric column. Create duration features between two dates (e.g., delivery time, age, tenure). Result is a numeric column ready for modeling. Example: datetime_diff(column_a="end_date", column_b="start_date", new_column="duration_days", unit="days")

Inputs: column_a (required), column_b (required), new_column (required), unit, +1 more. Returns: result

datetime_filterA

Filter rows by datetime range. Start/end as ISO strings (e.g., '2024-01-01'). Leave start or end empty for open-ended range. Subset data to a specific time period. WARNING: modifies in-place. Use copy_dataframe first if you need the full date range later. Example: datetime_filter(column="date", start="2024-01-01", end="2024-06-30")

Inputs: column (required), end, start, df_name. Returns: result

dbscan_clusterA

DBSCAN clustering. Density-based clustering that finds arbitrarily shaped clusters. Does not require specifying n_clusters. Labels outliers as -1. Features are auto-standardized. Use when clusters have irregular shapes or when you need outlier detection. Example: dbscan_cluster(columns=["Revenue","Weight"], eps=0.5, min_samples=5)

Inputs: columns (required), eps, df_name, min_samples, +1 more. Returns: result

describe_by_groupA

Descriptive statistics per group: mean, median, std, min, max for each numeric column within each group. One call replaces many separate group_aggregate calls. If numeric_columns is empty, uses all numeric columns. Example: describe_by_group(group_column="CargoType", numeric_columns=["Revenue","ChargeableWeight"])

Inputs: group_column (required), df_name, numeric_columns. Returns: result

detect_outliersA

Detect outliers in a numeric column. Methods: 'iqr' (threshold=IQR multiplier) or 'zscore' (threshold=z-score cutoff). Returns count, %, and boundary values. Run BEFORE clip_outliers to quantify outliers and determine if they are errors or genuine. Do not automatically clip without this check. Example: detect_outliers(column="Revenue", method="iqr", threshold=1.5)

Inputs: column (required), method, df_name, threshold. Returns: result

drop_columnsA

Drop specified columns from the dataframe. Remove useless columns (constants, IDs, leaked features). Always understand a column before dropping it. Example: drop_columns(columns=["col1","col2"])

Inputs: columns (required), df_name. Returns: result

drop_duplicatesA

Remove duplicate rows. subset: columns to check (None = all). keep: 'first', 'last', or 'none' (drop all duplicates). Run early in pipeline, right after EDA. Duplicates inflate statistics and bias models. Example: drop_duplicates(subset=["col1","col2"], keep="first")

Inputs: keep, subset, df_name. Returns: result

drop_low_importanceA

Drop columns below a computed importance threshold. Methods: 'variance' (drop cols with variance <= threshold), 'correlation' (drop cols with abs correlation to target <= threshold). Destructive: actually drops columns. Use AFTER reviewing results from correlation_filter or variance_filter. Example: drop_low_importance(target_column="Revenue", method="correlation", threshold=0.05)

Inputs: target_column (required), method, df_name, threshold. Returns: result

drop_missingA

Drop rows with missing values. how: 'any' (any null) or 'all' (all null). subset: limit check to specific columns (None = all). Use when entire rows are invalid. For partial missingness, prefer fill_missing instead. Example: drop_missing(subset=["col1"], how="any")

Inputs: how, subset, df_name. Returns: result

elbow_plotA

Elbow plot to find optimal number of clusters for K-Means. Plots inertia (within-cluster sum of squares) vs number of clusters. The 'elbow' point where the curve bends is the optimal K. Example: elbow_plot(columns=["Revenue","Weight"], max_k=10)

Inputs: columns (required), max_k, df_name, save_path, +1 more.

evaluate_modelA

Evaluate a model on test data. Returns classification metrics (accuracy, precision, recall, F1, confusion matrix) or regression metrics (MAE, MSE, RMSE, R²). Always evaluate on TEST set, never training set. Compare metrics against baseline. Test score much worse than training = overfitting. Example: evaluate_model(model_name="random_forest_data_train", test_df_name="data_test")

Inputs: model_name, test_df_name, target_column. Returns: result

extract_datetime_partsA

Extract datetime components as new columns ({column}_year, {column}_month, etc.). Parts: year, month, day, dayofweek, hour, minute, weekofyear, quarter, is_weekend. Use early in feature engineering when datetime columns exist. year, month, dayofweek, is_weekend are often highly predictive. Original column is preserved. Example: extract_datetime_parts(column="date", parts=["year", "month", "dayofweek", "is_weekend"])

Inputs: column (required), parts, df_name. Returns: result

feature_importanceA

Compute feature importance using tree-based model or mutual information. Methods: 'random_forest', 'mutual_info_classif', 'mutual_info_regression'. Returns ranked list of features with importance scores. Run after all encoding and feature engineering. Ranks features by predictive power. Helps focus modeling on most important features. Example: feature_importance(target_column="Revenue", method="random_forest", top_n=20)

Inputs: target_column (required), top_n, method, df_name. Returns: result

fill_missingA

Fill missing values. Strategies: 'value' (literal), 'mean', 'median', 'mode', 'ffill', 'bfill'. columns: which columns to fill (None = all columns with nulls). Choose strategy based on distribution: 'median' for skewed numeric, 'mean' for normal, 'mode' for categorical. 'ffill'/'bfill' only for time-series. Example: fill_missing(columns=["Revenue"], strategy="median")

Inputs: value, columns, df_name, strategy. Returns: result

filter_rowsA

Filter rows by condition. Operators: ==, !=, >, <, >=, <=, contains, isin. For isin: provide comma-separated values. Value is auto-cast for numeric columns. Use to subset data or remove invalid rows. WARNING: modifies in-place. Use copy_dataframe first if you need the full dataset later. Example: filter_rows(column="Revenue", operator=">", value="1000") Example: filter_rows(column="CargoType", operator="isin", value="GCR,SCR")

Inputs: value (required), column (required), operator (required), df_name. Returns: result

frequency_encodeA

Replace each category with its frequency (count / total rows). Quick encoding that preserves frequency information. Useful for initial exploration or when no clear target variable exists. Example: frequency_encode(columns=["City","Category"])

Inputs: columns (required), df_name. Returns: result

get_column_profileA

Detailed single-column analysis: dtype, nulls, unique count, statistics (if numeric: min/max/mean/median/std/skew/kurtosis), and top 10 value frequencies. Deep-dive into one column. Use when quality_report flags something. Provides skewness for deciding if log_transform is needed. Example: get_column_profile(column="Revenue")

Inputs: column (required), df_name. Returns: result

get_correlationA

Compute pairwise correlation between two numeric columns. Methods: pearson, spearman, kendall. Returns value and interpretation. Measure relationship between two numeric columns. Use for targeted investigation after plot_correlation_matrix reveals interesting pairs. Example: get_correlation(col_a="Revenue", col_b="Weight", method="pearson")

Inputs: col_a (required), col_b (required), method, df_name. Returns: result

get_headA

Return the first N rows of the dataframe as a formatted table. Quick first look after loading. Verify data loaded correctly and understand structure. Example: get_head(n=10)

Inputs: n, df_name. Returns: result

get_infoA

Get column dtypes, non-null counts, and memory usage for the dataframe. Similar to pandas df.info() output. Check column types and non-null counts. Run when a tool reports 'column not found' to verify names.

Inputs: df_name. Returns: result

get_shapeA

Get the number of rows and columns in the dataframe. Quick dimension check. Always run after filtering or dropping to verify not too many rows lost.

Inputs: df_name. Returns: result

get_statisticsA

Get descriptive statistics for all columns (numeric and categorical). Returns count, mean, std, min, quartiles, max for numeric; count, unique, top, freq for categorical. Understand distributions. Run after quality_report to decide cleaning strategies.

Inputs: df_name. Returns: result

get_tailA

Return the last N rows of the dataframe as a formatted table. Check the last rows. Useful for time-series to see the most recent data. Example: get_tail(n=10)

Inputs: n, df_name. Returns: result

get_unique_valuesA

List unique values with their frequencies for a column, sorted by count descending. Understand categorical columns before encoding. Reveals rare categories that may need grouping. Example: get_unique_values(column="CargoType", top_n=20)

Inputs: column (required), top_n, df_name. Returns: result

get_value_countsA

Value counts with percentages, sorted descending. Shows top_n values. Detailed frequency analysis with percentages and cumulative percentages. More detailed than plot_bar. Example: get_value_counts(column="City", top_n=10)

Inputs: column (required), top_n, df_name. Returns: result

group_aggregateA

GroupBy aggregation. Functions: mean, sum, count, min, max, median, std. For segmented analysis: understanding how metrics differ across groups. Useful for business questions like 'average revenue by city'. Example: group_aggregate(group_by=["City"], agg_column="Revenue", agg_func="mean")

Inputs: group_by (required), agg_column (required), df_name, agg_func. Returns: result

group_aggregate_multiA

GroupBy with multiple columns and multiple aggregation functions in one call. Much more efficient than calling group_aggregate repeatedly. Functions: mean, sum, count, min, max, median, std. Example: group_aggregate_multi(group_by=["CargoType"], aggregations={"Revenue": ["mean","sum","count"], "Weight": ["mean","median"]})

Inputs: group_by (required), aggregations (required), df_name. Returns: result

kmeans_clusterA

K-Means clustering. Assigns each row to one of n_clusters groups based on numeric columns. Features are auto-standardized before clustering. Result is stored as a new column. Use for customer segmentation, anomaly grouping, or discovering natural data groups. Example: kmeans_cluster(columns=["Revenue","ChargeableWeight","Pieces"], n_clusters=4)

Inputs: columns (required), df_name, n_clusters, random_state, +1 more. Returns: result

kruskal_wallis_testA

Kruskal-Wallis H test (non-parametric alternative to ANOVA). Compares distributions of a numeric column across 3+ groups without assuming normality. Use when normality_test indicates non-normal data. For 2 groups, use mann_whitney_test. Example: kruskal_wallis_test(column="Revenue", group_column="FlownMonth")

Inputs: column (required), group_column (required), df_name. Returns: result

label_encodeA

Label-encode categorical columns: map each unique value to an integer (0, 1, 2, ...). Use ONLY for ordinal data with natural order (e.g., low/medium/high, small/large). For nominal categories without order, use one_hot_encode or target_encode. Example: label_encode(columns=["City","Category"])

Inputs: columns (required), df_name. Returns: result

list_dataframesA

List all loaded dataframes with their shapes. Check what datasets are available before switching or merging.

Inputs: no named parameters. Returns: result

list_modelsA

List all trained models with their type and training metadata. Check which models have been trained and their training scores before deciding next steps.

Inputs: no named parameters. Returns: result

load_csvA

Load a CSV file into memory. The name defaults to the filename. This becomes the current active dataframe. Always the first step in any pipeline. After loading, immediately run quality_report to understand the data.

Inputs: file_path (required), name, separator. Returns: result

load_excelA

Load an Excel file (.xlsx, .xls) into memory. If sheet_name is empty, loads the first sheet. The name defaults to the filename. Requires openpyxl package for .xlsx files. Example: load_excel(file_path="data.xlsx", sheet_name="Sheet1")

Inputs: file_path (required), name, sheet_name. Returns: result

load_parquetA

Load a Parquet file into memory. Parquet is columnar and much faster than CSV for large files. The name defaults to the filename. Example: load_parquet(file_path="data.parquet")

Inputs: file_path (required), name. Returns: result

log_transformA

Apply log transform to columns. Creates new columns named Log_{column}. Methods: 'log1p' (recommended, handles zeros), 'log' (natural log), 'log10'. Use on right-skewed distributions (|skewness| > 1). 'log1p' is safest (handles zeros). Check result with plot_histogram. Example: log_transform(columns=["Revenue","ChargeableWeight"], method="log1p")

Inputs: columns (required), method, df_name. Returns: result

mann_whitney_testA

Mann-Whitney U test (non-parametric alternative to t-test). Compares distributions of a numeric column across two groups without assuming normality. Use when normality_test indicates non-normal data. Requires exactly 2 groups. Example: mann_whitney_test(column="Revenue", group_column="CargoType")

Inputs: column (required), group_column (required), df_name. Returns: result

melt_dataframeA

Unpivot (wide to long format). id_vars are columns to keep, value_vars are columns to melt. Reverse of pivot. Use when data is in wide format but tools expect long format. Example: melt_dataframe(id_vars=["Name","City"], value_vars=["Score","Revenue"])

Inputs: id_vars (required), df_name, var_name, value_name, +1 more. Returns: result

merge_dataframesA

Merge two dataframes (like SQL JOIN). How: 'inner', 'left', 'right', 'outer'. Result is stored as a new dataframe. Use when data is split across files. Always verify join keys exist in both dataframes with get_info first.

Inputs: on (required), left_name (required), right_name (required), how, +1 more. Returns: result

normality_testA

Test if a numeric column follows a normal distribution. Methods: 'shapiro' (best for n < 5000), 'ks' (Kolmogorov-Smirnov, any sample size), 'dagostino' (D'Agostino-Pearson, n >= 20). Use before deciding on parametric vs non-parametric tests. If p < 0.05, data is NOT normal. Example: normality_test(column="Revenue", method="shapiro")

Inputs: column (required), method, df_name. Returns: result

normalizeA

Scale numeric columns in-place. Methods: 'minmax' (0-1), 'standard' (z-score), 'robust' (IQR-based). Only needed for distance-based models (linear, logistic). Tree-based models do NOT need normalization. Use 'standard' by default, 'robust' if outliers remain. Example: normalize(columns=["Revenue","Weight"], method="standard")

Inputs: columns (required), method, df_name. Returns: result

one_hot_encodeA

One-hot encode categorical columns (creates binary columns). drop_first=True avoids multicollinearity (recommended for modeling). Best for low-cardinality (2-10 categories). Always drop_first=True for modeling. WARNING: high-cardinality columns create too many columns — use target_encode instead. Example: one_hot_encode(columns=["CargoType"], drop_first=True)

Inputs: columns (required), df_name, drop_first. Returns: result

pca_transformA

PCA dimensionality reduction. Projects numeric columns onto principal components. New columns PC1, PC2, ... are added to the dataframe. Features are auto-standardized. If plot=True and n_components>=2, also stores a 2D scatter plot (viewable via save_report). Use to visualize high-dimensional data, reduce multicollinearity, or compress features. Example: pca_transform(columns=["Revenue","Weight","Pieces"], n_components=2, hue="CargoType")

Inputs: columns (required), hue, plot, df_name, +2 more. Returns: result

permutation_importanceA

Permutation importance: model-agnostic feature importance measured on test data. More reliable than built-in feature_importances_ because it measures actual impact on predictions. Shows importance with error bars from multiple random shuffles. Example: permutation_importance(model_name="rf_model", test_df_name="data_test")

Inputs: top_n, n_repeats, save_path, model_name, +2 more.

pivot_tableA

Create a pivot table. Stores result as a new dataframe. Creates summary tables. Use for reporting or reshaping data from long to wide format. Example: pivot_table(index=["City"], columns="Category", values="Revenue", agg_func="mean")

Inputs: index (required), values (required), columns (required), df_name, +2 more. Returns: result

plot_barA

Bar plot of value counts (top N categories). Vertical or horizontal. Understand categorical distributions during EDA. Reveals rare categories for potential grouping and dominant categories for stratified sampling. Example: plot_bar(column="CargoType", top_n=10, orientation="horizontal")

Inputs: column (required), top_n, df_name, save_path, +1 more.

plot_boxC

Box plot for outlier visualization. Optional grouping by a categorical column. Visualize outliers and compare distributions across groups. Complements detect_outliers with a visual perspective. Example: plot_box(column="Revenue", by="CargoType")

Inputs: column (required), by, df_name, save_path.

plot_confusion_matrixA

Visual confusion matrix heatmap for classification models. Shows true vs predicted labels with counts. Use after evaluate_model for deeper diagnosis. Example: plot_confusion_matrix(model_name="rf_classifier", test_df_name="data_test")

Inputs: save_path, model_name, test_df_name, target_column.

plot_correlation_matrixA

Correlation heatmap with lower triangle mask and annotations. Methods: pearson, spearman, kendall. Empty columns = all numeric. Run after all numeric features are prepared. Identifies multicollinearity (features correlated with each other) and features correlated with the target. Example: plot_correlation_matrix(method="pearson")

Inputs: method, columns, df_name, save_path.

plot_cumulativeA

Cumulative distribution function (CDF) plot. Shows what percentage of data falls below each value. Useful for understanding thresholds. Example: plot_cumulative(column="Revenue")

Inputs: column (required), df_name, save_path.

plot_distribution_comparisonA

Overlay KDE distributions of a numeric column for different groups. Better than separate histograms for comparing distribution shapes across categories. Example: plot_distribution_comparison(column="Revenue", by="CargoType")

Inputs: by (required), column (required), df_name, save_path, +1 more.

plot_feature_importance_modelB

Bar plot of feature importance from a trained model. Works with tree-based models (random_forest, gradient_boosting, decision_tree). Use after train_model to understand which features drive predictions. Example: plot_feature_importance_model(model_name="random_forest_data_train")

Inputs: top_n, save_path, model_name.

plot_heatmapA

Heatmap of aggregated values in a pivot table format. Shows a color-coded matrix of one metric across two categorical dimensions. Example: plot_heatmap(index_col="OriginCode", columns_col="FlownMonth", values_col="Revenue", agg_func="sum")

Inputs: index_col (required), values_col (required), columns_col (required), df_name, +2 more.

plot_histogramA

Plot a histogram for a numeric column with optional KDE overlay and log-scaled x-axis. Use during EDA to understand numeric distributions. Set log_scale=True for skewed data (revenue, prices) — otherwise histogram is unreadable. Check for bimodality indicating subgroups. Example: plot_histogram(column="Revenue", bins=50, kde=True, log_scale=True)

Inputs: column (required), kde, bins, df_name, +2 more.

plot_learning_curveA

Learning curve: training and validation scores vs training set size. Diagnoses overfitting (gap between train/val) and underfitting (both scores low). Example: plot_learning_curve(model_name="rf_model", train_df_name="data_train")

Inputs: n_splits, save_path, model_name, target_column, +1 more.

plot_lineA

Line plot. Supports multiple y columns overlaid. Essential for time-series and trends. For time-series data and trends. Sort data by x-axis column first for meaningful results. Supports multiple y columns overlaid. Example: plot_line(x="date", y="Revenue") Example: plot_line(x="month", y=["Revenue", "Cost"], hue="Category")

Inputs: x (required), y (required), hue, df_name, +1 more.

plot_missing_valuesA

Heatmap showing missing value patterns across all columns. White = present, colored = missing. Use when quality_report shows significant missingness. Patterns in the heatmap reveal if data is missing randomly or systematically. Example: plot_missing_values()

Inputs: df_name, save_path.

plot_pairplotA

Seaborn pairplot for up to 6 columns. Shows distributions on diagonal and scatter plots on off-diagonal. Limit to 6 columns for readability. Expensive computation. Use after feature_importance to focus on top features. Example: plot_pairplot(columns=["Revenue","Weight","Score"], hue="Category")

Inputs: columns (required), hue, df_name, save_path.

plot_precision_recall_curveA

Precision-Recall curve for binary classification models. Better than ROC for imbalanced datasets. Shows trade-off between precision and recall. Example: plot_precision_recall_curve(model_name="logistic_data_train", test_df_name="data_test")

Inputs: save_path, model_name, test_df_name, target_column.

plot_qqA

Q-Q plot to visually assess if a column follows a normal distribution. Points on the diagonal = normal. Deviations show skewness or heavy tails. Use alongside normality_test for visual confirmation. Example: plot_qq(column="Revenue")

Inputs: column (required), df_name, save_path.

plot_residualsA

Residuals vs predicted values plot for regression models. Use to diagnose model quality: random scatter = good, patterns = systematic error. Also shows a histogram of residuals to check normality. Example: plot_residuals(model_name="linear_regression_data_train", test_df_name="data_test")

Inputs: save_path, model_name, test_df_name, target_column.

plot_roc_curveB

ROC curve with AUC score for binary classification models. Plots the trade-off between true positive rate and false positive rate. AUC = 0.5 means random, AUC = 1.0 means perfect. Example: plot_roc_curve(model_name="logistic_data_train", test_df_name="data_test")

Inputs: save_path, model_name, test_df_name, target_column.

plot_scatterA

Scatter plot between two numeric columns. Optional color grouping by hue column. Explore relationships between two numeric variables. Add hue for categorical grouping to reveal subgroup patterns. Example: plot_scatter(x="Revenue", y="Weight", hue="CargoType")

Inputs: x (required), y (required), hue, df_name, +1 more.

plot_stacked_barA

Stacked bar chart showing composition of one categorical within another. normalize=True shows percentages (100% stacked), False shows raw counts. Example: plot_stacked_bar(column="ProductCode", by="CargoType", normalize=True)

Inputs: by (required), column (required), top_n, df_name, +2 more.

plot_violinA

Violin plot: combines box plot with KDE to show full distribution shape. Better than boxplot for skewed or multimodal distributions. Optional grouping. Example: plot_violin(column="Revenue", by="CargoType")

Inputs: column (required), by, df_name, save_path.

polynomial_featuresA

Create polynomial and interaction features from numeric columns. degree=2 creates x^2 and x1*x2 terms. interaction_only=True skips powers (x^2). Use when linear models underfit: polynomial features capture non-linear relationships. Example: polynomial_features(columns=["Revenue","Weight"], degree=2)

Inputs: columns (required), degree, df_name, interaction_only. Returns: result

predictA

Generate predictions on a dataframe using a stored model. Stores predictions as a new column. Generate predictions on new data. The dataframe must contain the same feature columns used during training. Example: predict(model_name="random_forest_data_train", df_name="data_test")

Inputs: df_name, model_name, prediction_column. Returns: result

quality_reportA

Comprehensive data quality report: dtype per column, missing value count and %, unique value count, and total duplicate rows. ESSENTIAL FIRST STEP after loading data. Run before any cleaning or transformation. Reveals the full data quality landscape in one call.

Inputs: df_name. Returns: result

rename_columnsA

Rename columns using an old->new mapping. Standardize column names early in the pipeline (snake_case, no spaces, explicit names). Prevents reference errors throughout the pipeline. Example: rename_columns(mapping={"old_name": "new_name"})

Inputs: mapping (required), df_name. Returns: result

replace_valuesA

Replace a specific value with another in a column. Types are auto-cast. Fix known data entry errors or standardize values. Use after identifying issues with get_unique_values. Example: replace_values(column="Status", old_value="N/A", new_value="Unknown")

Inputs: column (required), new_value (required), old_value (required), df_name. Returns: result

sample_dataA

Return a random sample of N rows. Use when head/tail are not representative. Random sampling reveals data variety better. Example: sample_data(n=5)

Inputs: n, df_name, random_state. Returns: result

save_csvA

Save a dataframe to a CSV file (without row index). Use at the end of a pipeline to export cleaned/processed data.

Inputs: file_path (required), df_name. Returns: result

save_reportA

Save a data science report as a markdown file with associated plot images. Use this as the FINAL STEP of an analysis to export a structured, presentable report. The report and plots are saved to a 'reports/' folder next to the original CSV file. If output_dir is empty, defaults to 'reports/' in the directory of the first loaded CSV. If include_plots is provided, saves those named plots as PNG files in the same folder and you can reference them in the markdown content as . Example: save_report(content="# Analysis Report\n...", include_plots=["histogram_Revenue", "correlation_matrix"])

Inputs: content (required), output_dir, include_plots. Returns: result

save_report_htmlA

Save a data science report as an HTML file with embedded plot images (base64). Unlike save_report (markdown + separate PNGs), this produces a single self-contained HTML file. Plots are embedded inline using base64 encoding — no separate image files needed. Reference plots in content as — they'll be auto-replaced with embedded images. Example: save_report_html(content="# Analysis\n", include_plots=["histogram_Revenue"])

Inputs: content (required), output_dir, include_plots. Returns: result

select_dtypesA

Keep only columns matching specified dtypes. Drops non-matching columns. Filter columns by type. Use include=['number'] before modeling to keep only numeric features. Example: select_dtypes(include=["number"]) — keeps only numeric columns. Example: select_dtypes(exclude=["object"]) — drops string columns.

Inputs: df_name, exclude, include. Returns: result

set_current_dataframeB

Switch the current active dataframe. Switch active dataset when working with multiple dataframes.

Inputs: name (required). Returns: result

set_datetime_indexA

Set a datetime column as the DataFrame index. Set datetime column as DataFrame index. Required for time-series resampling. Sorts by index automatically. Example: set_datetime_index(column="date")

Inputs: column (required), df_name. Returns: result

silhouette_scoreA

Compute silhouette score to evaluate clustering quality. Score ranges from -1 to 1: higher is better. >0.5 = good, >0.7 = excellent, <0.25 = poor. Run after kmeans_cluster or dbscan_cluster. Example: silhouette_score(cluster_column="cluster", feature_columns=["Revenue","Weight"])

Inputs: cluster_column (required), feature_columns (required), df_name. Returns: result

sort_valuesA

Sort the dataframe by one or more columns. Sort before visual inspection or time-series analysis. Useful before plot_line. Example: sort_values(columns=["Revenue"], ascending=False)

Inputs: columns (required), df_name, ascending. Returns: result

string_cleanA

Clean a string column. Operations applied in order: 'strip', 'lower', 'upper', 'title', 'replace'. For 'replace': uses replace_old and replace_new parameters. Run on text columns BEFORE any encoding. Inconsistent casing or whitespace creates spurious categories. Example: string_clean(column="Name", operations=["strip","lower"])

Inputs: column (required), df_name, operations, replace_new, +1 more. Returns: result

target_encodeA

Target-encode high-cardinality categorical columns. Each category is replaced by the smoothed mean of the target variable. Good for columns with many unique values. Best for high-cardinality (>10 categories). IMPORTANT: to avoid data leakage, split data first with train_test_split, then encode training set only. Example: target_encode(columns=["AgentCode","OriginCode"], target_column="Log_Revenue", smoothing=10.0)

Inputs: columns (required), target_column (required), df_name, smoothing. Returns: result

train_modelA

Train a model. Types: 'linear_regression', 'logistic_regression', 'random_forest', 'gradient_boosting', 'decision_tree'. The model is stored for later predict/evaluate. Start with simple model (linear/logistic) as baseline. Only move to complex models (random_forest, gradient_boosting) if baseline is insufficient. Uses ALL numeric columns as features. Example: train_model(target_column="Revenue", model_type="random_forest")

Inputs: target_column (required), model_name, model_type, hyperparams, +1 more. Returns: result

train_test_splitA

Split dataframe into train/test sets. Stores them as '{name}_train' and '{name}_test'. stratify=True preserves target class proportions (classification only). Run BEFORE training any model. Always use fixed random_state for reproducibility. Use stratify=True for imbalanced classification datasets. Example: train_test_split(target_column="Revenue", test_size=0.2)

Inputs: target_column (required), df_name, stratify, test_size, +1 more. Returns: result

tsne_plotA

t-SNE visualization. Non-linear dimensionality reduction for 2D visualization. Better than PCA for revealing clusters and local structure. Features are auto-standardized. Slower than PCA — best on datasets < 10,000 rows or use sample_data first. Example: tsne_plot(columns=["Revenue","Weight","Pieces"], perplexity=30, hue="CargoType")

Inputs: columns (required), hue, df_name, save_path, +3 more.

ttest_independentA

Independent two-sample t-test. Compares means of a numeric column across two groups. Use to determine if the difference between two group means is statistically significant. Requires exactly 2 groups in group_column. For 3+ groups, use anova_test instead. Example: ttest_independent(column="Revenue", group_column="CargoType")

Inputs: column (required), group_column (required), df_name. Returns: result

variance_filterA

Identify columns with variance at or below threshold (constant/near-constant). Returns list of low-variance columns. Does NOT auto-drop. Non-destructive: identifies constant/near-constant columns. These provide no useful information for modeling. Example: variance_filter(threshold=0.01)

Inputs: df_name, threshold. Returns: result

Tool Schema Changelog

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

Loading tool schema changelog…

    TDQS

    A3.5/5.0

    Scored across 102 tools

    Disambiguation3/5

    Most tools have distinct purposes, but several families overlap: group_aggregate, group_aggregate_multi, and describe_by_group; variance_filter, correlation_filter, and drop_low_importance; and multiple encoding tools. With 102 tools, an agent has a real risk of selecting the wrong one despite helpful descriptions.

    Naming Consistency4/5

    The overwhelming majority follow a clear verb_noun snake_case pattern (load_csv, drop_duplicates, train_model, plot_histogram). A few outliers like crosstab, predict, and group_aggregate_multi break the pattern slightly, but the convention is highly predictable overall.

    Tool Count1/5

    102 tools is far beyond any reasonable scope for a coherent toolset, even for a broad data science domain. This dramatically increases cognitive load and selection difficulty, making the server feel more like a sprawling library than a focused MCP tool surface.

    Completeness5/5

    The toolset covers the entire data science lifecycle: loading, cleaning, EDA, visualization, feature engineering, encoding, modeling, evaluation, clustering, statistical testing, and reporting. Minor gaps exist (e.g., no model deletion or explicit model persistence), but there are no meaningful dead ends for the intended workflows.

    Related MCP Connectors

    Related MCP Servers

    • F
      license
      Not graded
      quality
      D
      maintenance
      Enables AI-powered business intelligence and data analysis using pandas and LLM code generation. Supports automated data processing, statistical analysis, and visualization creation through natural language interactions.
      15
      -
    • A
      license
      Not graded
      quality
      C
      maintenance
      Enables searching, analyzing, and managing data packages in a Quilt data catalog through natural language, with 84+ tools including package CRUD operations.
      3
      Apache 2.0
    • A
      license
      Not graded
      quality
      D
      maintenance
      Gives LLM agents access to local and remote data via databases, files, graphs, and structured documents, along with a full data science toolkit for analysis and modeling.
      15
      Apache 2.0