Skip to main content

MCP server exposing stats-compass-core tools to LLMs like ChatGPT, Claude, and Gemini

Project description

Stats Compass Logo

stats-compass-mcp

A stateful, MCP-compatible toolkit of pandas-based data tools for AI-powered data analysis.

stats-compass-mcp

MCP server that exposes stats-compass-core tools to LLMs like ChatGPT, Claude, and Gemini.

What is this?

This package turns the stats-compass-core toolkit into an MCP (Model Context Protocol) server. Once running, any MCP-compatible client (ChatGPT, Claude, Cursor, VS Code, etc.) can use your data analysis tools directly.

Installation

pip install stats-compass-mcp

⚠️ Important Note on Data Loading

Drag-and-drop file uploads are NOT supported. To load data, you must provide the absolute file path to the file on your local machine.

  • ✅ "Load the file at /Users/me/data.csv"
  • ❌ Dragging data.csv into the chat window

Quick Start

Start the server

stats-compass-mcp serve

Configure your MCP client

1. Claude Desktop (Recommended)

You can configure Claude Desktop automatically:

# Install the package
pip install stats-compass-mcp

# Run the auto-configuration
stats-compass-mcp install

Or manually add this to your claude_desktop_config.json:

{
  "mcpServers": {
    "stats-compass": {
      "command": "uvx",
      "args": ["stats-compass-mcp", "serve"]
    }
  }
}

2. VS Code (GitHub Copilot)

VS Code has native MCP support via GitHub Copilot:

# Install the package
pip install stats-compass-mcp

# Run the auto-configuration
stats-compass-mcp install-vscode

Or manually add this to your VS Code mcp.json (located at ~/Library/Application Support/Code/User/mcp.json on macOS):

{
  "servers": {
    "stats-compass": {
      "command": "uvx",
      "args": ["stats-compass-mcp", "serve"]
    }
  }
}

3. Claude Code (CLI)

To use Stats Compass with the Claude CLI:

claude mcp add stats-compass -- uvx stats-compass-mcp serve

Available Tools

Once connected, the following tools are available to LLMs:

Data Loading & Management

  • load_csv - Load CSV files into state
  • load_dataset - Load built-in sample datasets
  • list_dataframes - List all DataFrames in state
  • get_schema - Get column types and info
  • get_sample - Preview rows from a DataFrame

Data Cleaning

  • dropna - Remove missing values
  • apply_imputation - Fill missing values
  • dedupe - Remove duplicate rows
  • handle_outliers - Detect and handle outliers

Transforms

  • filter_dataframe - Filter rows by condition
  • groupby_aggregate - Group and aggregate data
  • pivot - Pivot tables
  • add_column - Add calculated columns
  • rename_columns - Rename columns
  • drop_columns - Remove columns

EDA & Statistics

  • describe - Summary statistics
  • correlations - Correlation matrix
  • hypothesis_tests - T-tests, chi-square, etc.
  • data_quality - Data quality report

Visualization

  • histogram - Distribution plots
  • scatter_plot - Scatter plots
  • bar_chart - Bar charts
  • lineplot - Line plots
  • confusion_matrix_plot - Confusion matrix heatmap
  • roc_curve_plot - ROC curves for classification
  • precision_recall_curve_plot - Precision-recall curves
  • feature_importance - Feature importance bar charts

Machine Learning

  • train_linear_regression - Linear regression
  • train_logistic_regression - Logistic regression
  • train_random_forest_classifier - Random forest classification
  • train_random_forest_regressor - Random forest regression
  • train_gradient_boosting_classifier - Gradient boosting classification
  • train_gradient_boosting_regressor - Gradient boosting regression
  • evaluate_classification_model - Classification metrics (accuracy, precision, recall, F1)
  • evaluate_regression_model - Regression metrics (R², MAE, RMSE)

New in v0.1.13: Training tools now automatically create a predictions DataFrame with predictions and probability columns for easy evaluation and plotting.

Time Series (ARIMA)

  • check_stationarity - ADF/KPSS tests
  • fit_arima - Fit ARIMA models
  • forecast_arima - Generate forecasts
  • find_optimal_arima - Auto parameter search

How It Works

┌─────────────────────────────────────────────────────────────┐
│                    MCP Client                               │
│         (ChatGPT, Claude, Cursor, VS Code)                  │
└─────────────────────────┬───────────────────────────────────┘
                          │ MCP Protocol
                          ▼
┌─────────────────────────────────────────────────────────────┐
│                stats-compass-mcp                            │
│  ┌─────────────────────────────────────────────────────┐    │
│  │              MCP Server (this package)              │    │
│  │  • Registers tools from stats-compass-core          │    │
│  │  • Manages DataFrameState per session               │    │
│  │  • Converts tool results to MCP responses           │    │
│  └─────────────────────────────────────────────────────┘    │
│                          │                                  │
│                          ▼                                  │
│  ┌─────────────────────────────────────────────────────┐    │
│  │           stats-compass-core (PyPI)                 │    │
│  │  • DataFrameState (server-side state)               │    │
│  │  • 40+ deterministic tools                          │    │
│  │  • Pydantic schemas for all inputs/outputs          │    │
│  └─────────────────────────────────────────────────────┘    │
└─────────────────────────────────────────────────────────────┘

Contributing

Architecture Overview

If you want to contribute to stats-compass-mcp, it helps to understand how the pieces fit together:

  1. Entry Point: The pyproject.toml defines the script stats-compass-mcp = "stats_compass_mcp.cli:main". This is what runs when you execute the command.
  2. CLI (cli.py): Parses command-line arguments and launches the server.
  3. Server (server.py):
    • Initializes a DataFrameState (from stats-compass-core) to hold data in memory during the session.
    • Discovers tools dynamically using registry.auto_discover() and get_all_tools().
    • Registers list_tools and call_tool handlers to communicate with the MCP client.
    • Executes tools by injecting the session state into the function calls.
  4. Communication: Uses stdio transport to exchange JSON-RPC messages with the client (Claude, etc.).

Local Development

  1. Clone and Install:

    git clone https://github.com/oogunbiyi21/stats-compass-mcp.git
    cd stats-compass-mcp
    poetry install
    
  2. Configure for Development: You can automatically configure your MCP clients to use your local development version (instead of the published PyPI version):

    # For Claude Desktop
    poetry run stats-compass-mcp install --dev
    
    # For VS Code (GitHub Copilot)
    poetry run stats-compass-mcp install-vscode --dev
    
  3. Run the Server:

    poetry run stats-compass-mcp serve
    
  4. Test with MCP Inspector: You can use the MCP Inspector to test the server interactively:

    npx @modelcontextprotocol/inspector poetry run stats-compass-mcp serve
    

Related Projects

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

stats_compass_mcp-0.1.9.tar.gz (12.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

stats_compass_mcp-0.1.9-py3-none-any.whl (12.5 kB view details)

Uploaded Python 3

File details

Details for the file stats_compass_mcp-0.1.9.tar.gz.

File metadata

  • Download URL: stats_compass_mcp-0.1.9.tar.gz
  • Upload date:
  • Size: 12.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.3 CPython/3.12.5 Darwin/24.6.0

File hashes

Hashes for stats_compass_mcp-0.1.9.tar.gz
Algorithm Hash digest
SHA256 777ea2a8dc911341b17562f3cab7cba21ef2f979f2fae207a970132cc0ee53d2
MD5 b70ce427b954073f1cefbb0525c5a389
BLAKE2b-256 8cbedb4efd96b69dc38e8dba4bd6c3eee05a8c990c18c0a9d554dded3d01ad69

See more details on using hashes here.

File details

Details for the file stats_compass_mcp-0.1.9-py3-none-any.whl.

File metadata

  • Download URL: stats_compass_mcp-0.1.9-py3-none-any.whl
  • Upload date:
  • Size: 12.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.3 CPython/3.12.5 Darwin/24.6.0

File hashes

Hashes for stats_compass_mcp-0.1.9-py3-none-any.whl
Algorithm Hash digest
SHA256 24ac794aac8a2028b4b674c0e89e91943879a58cf3ee45c419891c0287e13acb
MD5 f51dd03fdab41526ec77796d60828579
BLAKE2b-256 ee1c00ec9f270d924ad696ab0d521ea51131524d2fd57079c81c0ca4cd90c45c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page