Skip to main content
Glama
Data Analytics MCP Toolkit

Data Analytics MCP Toolkit

by ChenJellay

Data Analytics MCP Toolkit

An MCP (Model Context Protocol) server that exposes data visualization and simple machine learning tools. When an external LLM calls the toolkit, it can use the high-level run_analytics tool to describe intent and data; the server selects and runs the appropriate pipeline (visualization or ML) and returns charts or metrics.

Features

  • Data: load_data (CSV/JSON string or URL), clean_data (drop NA, optional normalize)

  • Visualization: plot_bar, plot_line, plot_scatter, plot_histogram, plot_box, plot_heatmap (return base64 PNG)

  • ML: train_test_split, train_linear_regression, train_logistic_regression, train_kmeans, plus evaluate_regression, evaluate_classification, evaluate_clustering

  • Pipeline: run_analytics(intent, data_source) — intent-based routing to the right pipeline

Related MCP server: MCP CSV Analysis with Gemini AI

Install

cd /path/to/trying_IBM_MCP
pip install -e .
# or
pip install -r requirements.txt

From the project root, ensure src is on PYTHONPATH when running the server (or install in editable mode).

Run the MCP server

stdio (for Cursor / IDE):

# From project root, with src on path
PYTHONPATH=src python -m data_analytics_mcp.server

Or with uv:

uv run --project . python -m data_analytics_mcp.server

(If using a pyproject.toml that sets packages under src, install first with pip install -e . then run python -m data_analytics_mcp.server from the repo root.)

Cursor MCP configuration

Add the server to Cursor (e.g. in Cursor Settings → MCP, or project .cursor/mcp.json):

{
  "mcpServers": {
    "data-analytics": {
      "command": "python",
      "args": ["-m", "data_analytics_mcp.server"],
      "cwd": "/path/to/trying_IBM_MCP",
      "env": { "PYTHONPATH": "src" }
    }
  }
}

Use the full path for cwd. If you installed the package (pip install -e .), you can use:

{
  "mcpServers": {
    "data-analytics": {
      "command": "python",
      "args": ["-m", "data_analytics_mcp.server"],
      "cwd": "/Users/jerrychen/projects/trying_IBM_MCP"
    }
  }
}

Usage

  • One-shot: Call run_analytics with a natural-language intent (e.g. "show distribution of sales", "predict price from square_feet", "cluster into 4 groups") and the data as CSV/JSON string or URL. The server returns either a chart (base64 image) or ML metrics and a short model summary.

  • Step-by-step: Use load_data → get data_id → then call clean_data, plot_*, or train_test_split → train_* → evaluate_* as needed. Use resources analytics://pipelines and analytics://pipelines/visualization (etc.) to see pipeline descriptions.

Project layout

src/data_analytics_mcp/
  server.py   # MCP app, tools, resources
  pipeline.py # Intent → pipeline; execute_pipeline
  data.py     # load_data, clean_data
  viz.py      # Plot functions → base64 PNG
  ml.py       # Train/evaluate regression, classification, clustering
  store.py    # In-memory session store

Available Tools

16 tools
clean_dataB
Clean dataset: optionally drop NA rows and z-score normalize numeric columns.
Updates the dataset in place; returns data_id and row count.

Inputs: data_id (required), session_id, drop_na, normalize.

evaluate_classificationC

Compute accuracy for a classification model on test data.

Inputs: model_id (required), test_data_id (required), session_id.

evaluate_clusteringC

Compute silhouette score for a clustering model on test data.

Inputs: model_id (required), test_data_id (required), session_id.

evaluate_regressionC

Compute MSE and R² for a regression model on test data.

Inputs: model_id (required), test_data_id (required), session_id.

load_dataA
Ingest data from CSV or JSON (inline string or URL). Returns data_id and schema summary.
Use the returned data_id in subsequent tools (clean_data, plot_*, train_*, etc.).

Inputs: source (required), format, session_id, delimiter.

plot_barC

Bar chart: x_column as categories, y_column as values (or count of x if y_column omitted).

Inputs: data_id (required), x_column (required), y_column, title, +1 more.

plot_boxC

Box plot: single numeric column, or all numeric columns if column is omitted.

Inputs: data_id (required), column, title, session_id.

plot_heatmapC

Heatmap of correlation matrix. If columns omitted, uses all numeric columns.

Inputs: data_id (required), columns, title, session_id.

plot_histogramC

Histogram of a numeric column (distribution).

Inputs: data_id (required), column (required), bins, title, +1 more.

plot_lineC

Line chart: x_column on x-axis, one or more y_columns as lines.

Inputs: data_id (required), x_column (required), y_columns, title, +1 more.

plot_scatterC

Scatter plot of x_column vs y_column.

Inputs: data_id (required), x_column (required), y_column (required), title, +1 more.

run_analyticsB
High-level tool: describe what you want (e.g. "show distribution of sales",
"predict price from square_feet", "cluster into 4 groups") and provide the data
(CSV/JSON string or URL). The server picks the right pipeline and returns
either a chart (chart_base64, chart_type) or ML metrics and model summary.

Inputs: intent (required), data_source (required), format, session_id, +8 more.

train_kmeansC

Fit K-means clustering. Returns model_id for evaluate_clustering.

Inputs: data_id (required), n_clusters, feature_columns, session_id.

train_linear_regressionC

Fit a linear regression model. Returns model_id for evaluate_regression.

Inputs: train_data_id (required), target_column (required), feature_columns, session_id.

train_logistic_regressionB

Fit a logistic regression classifier. Returns model_id for evaluate_classification.

Inputs: train_data_id (required), target_column (required), feature_columns, session_id.

train_test_splitB
Split dataset into train and test. Returns train_data_id and test_data_id
for use in train_* and evaluate_* tools.

Inputs: data_id (required), target_column (required), test_ratio, session_id, +1 more.

Tool Schema Changelog

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

Loading tool schema changelog…

    TDQS

    B3.3/5.0

    Scored across 16 tools

    Disambiguation4/5

    Most tools have distinct purposes, with clear separation between data loading/cleaning, plotting, model training, and evaluation functions. However, 'run_analytics' overlaps significantly with the specialized tools, as it can perform many of the same functions through a single interface, which could cause confusion about when to use it versus the specific tools.

    Naming Consistency5/5

    Tool names follow a consistent verb_noun pattern throughout, with clear and predictable naming conventions. All tools use snake_case, and verbs like 'clean', 'evaluate', 'load', 'plot', 'run', 'train', and 'train_test_split' are applied consistently to their respective nouns, making the set highly readable and predictable.

    Tool Count4/5

    With 16 tools, the count is slightly high but reasonable for a comprehensive data analytics toolkit. It covers a broad range of functions from data ingestion to visualization and machine learning, though it might be borderline heavy for some use cases. Each tool appears to earn its place without obvious redundancy, except for the overlap with 'run_analytics'.

    Completeness5/5

    The tool set provides complete coverage for a data analytics workflow, including data loading, cleaning, splitting, multiple types of plots, training for classification, regression, and clustering models, and corresponding evaluation metrics. The inclusion of 'run_analytics' as a high-level tool further ensures no gaps, offering a flexible alternative for common tasks.

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      A
      quality
      D
      maintenance
      An open-source MCP server that connects to various data sources (SQL databases, CSV, Parquet files), allowing AI models to execute SQL queries and generate data visualizations for analytics and business intelligence.
      12
      75
      MIT
    • F
      license
      Not graded
      quality
      D
      maintenance
      An MCP server for data analysis and visualization supporting CSV and Excel files. It enables users to generate statistical summaries and create multi-dimensional charts like heatmaps and bar plots through natural language.
      -
    • F
      license
      A
      quality
      D
      maintenance
      An MCP server for dataset exploration and analysis, enabling LLM clients to perform summary, correlation, distribution, missing value analysis, data cleaning, and statistical tests directly on CSV files.
      3
      -