Skip to main content
Glama

πŸ”¬ DriftScope β€” Autonomous MLOps & Statistical Diagnostics MCP Server

Python Protocol Deployment Engine

An open-source, cloud-deployed Model Context Protocol (MCP) server that equips Large Language Models (LLMs) with deterministic statistical computing engines to audit data drift and model degradation in production tabular pipelines.


πŸ’‘ The Problem

LLMs are exceptional at high-level reasoning, code generation, and root-cause analysis, but notoriously unreliable at precise statistical math. When monitoring machine learning pipelines, asking an LLM to evaluate distribution shift directly leads to severe numerical hallucinations.

DriftScope solves this by bridging the LLM to a dedicated Python analytical engine via the open Model Context Protocol:

  • The LLM handles orchestration, triage, hypothesis generation, and incident reporting.

  • DriftScope executes deterministic, vector-accelerated hypothesis testing (Two-sample Kolmogorov-Smirnov) and Population Stability Index (PSI) calculations using Polars and SciPy.


Related MCP server: MCP Stats Tools Server

πŸ—οΈ Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                      LLM Host                          β”‚
β”‚         (Claude Desktop / Cursor / Custom Agent)       β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                            β”‚ JSON-RPC 2.0
                            β–Ό (mcp-remote bridge)
               β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
               β”‚    Internet / HTTPS    β”‚
               β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                            β”‚ Server-Sent Events (SSE)
                            β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚             DriftScope MCP Server (Render)             β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”‚
β”‚  β”‚                  FastMCP Router                  β”‚  β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”˜  β”‚
β”‚           β”‚                       β”‚               β”‚    β”‚
β”‚           β–Ό                       β–Ό               β–Ό    β”‚
β”‚    [ Tools Engine ]      [ Resources Hub ]   [ Prompts ]β”‚
β”‚    β€’ check_drift         β€’ standards://      β€’ audit_   β”‚
β”‚    β€’ compute_psi           drift-policy        feature β”‚
β”‚    β€’ generate_mock                                     β”‚
β”‚           β”‚                                            β”‚
β”‚           β–Ό                                            β”‚
β”‚    [ Data Layer: Polars + SciPy + NumPy ]              β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

✨ Features & MCP Primitives

1. πŸ› οΈ Tools (Callable Actions)

  • check_feature_drift(baseline_csv, current_csv, feature_column, significance_level): Executes two-sample Kolmogorov-Smirnov (KS) tests to detect continuous covariate shift with rigorous $p$-values.

  • compute_psi(baseline_csv, current_csv, feature_column, bins): Computes the Population Stability Index (PSI) with equal-frequency baseline binning and Laplace smoothing to classify shift severity (Stable, Moderate, or Critical).

  • generate_mock_datasets(): Synthesizes baseline and drifted production samples on the fly for pipeline verification.

Supports both local cloud file paths and remote public HTTP/HTTPS URLs (AWS S3, GitHub raw, etc.).

2. πŸ“‚ Resources (Passive Knowledge)

  • standards://drift-policy: Exposes organization-wide MLOps threshold standards (e.g., $p < 0.05$ rejection criteria, PSI warning zones) directly into the agent's context.

3. πŸ“ Prompts (Reusable Workflows)

  • audit_feature: Pre-engineered diagnostic prompt guiding the model through end-to-end drift triage, impact evaluation, and retraining recommendations.


πŸš€ Live Cloud Deployment

DriftScope is deployed as a live cloud service on Render utilizing the Server-Sent Events (SSE) transport.

  • Live SSE Endpoint: https://driftscope-mcp.onrender.com/sse


πŸ”Œ Quickstart: Connect to Claude Desktop

You can connect your local Claude Desktop to the live cloud deployment in seconds:

  1. Open your Claude Desktop configuration file:

    • Windows: %APPDATA%\Claude\claude_desktop_config.json

    • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json

  2. Add driftscope-cloud to your mcpServers object:

{
  "mcpServers": {
    "driftscope-cloud": {
      "command": "npx",
      "args": [
        "-y",
        "mcp-remote",
        "https://driftscope-mcp.onrender.com/sse"
      ]
    }
  }
}
  1. Restart Claude Desktop. The πŸ”¨ hammer icon will appear in the chat interface showing your active tools!


πŸ“Š Sample Interaction & Output

Prompt:

"Audit both the 'income' and 'age' features for drift using DriftScope and give me an MLOps summary."

Output:

## MLOps Drift Summary

| Feature | KS Stat | p-value | PSI Score | Verdict |
|---|---|---|---|---|
| income  | 0.3960  | 0.00000 | 0.7060    | πŸ”΄ Critical shift |
| age     | 0.0840  | 0.05910 | 0.0230    | 🟒 Stable |

Attention needed: income
- Both the KS test and PSI confirm income has drifted severely (p-value β‰ˆ 0, PSI = 0.706 > 0.20 threshold).
- Recommendation: Upstream investigation required; trigger model retraining fallback pipeline.

πŸ’» Local Development

Clone the repository and run locally using uv:

git clone https://github.com/Aymenrahmanii/driftscope-mcp.git
cd driftscope-mcp

# Install dependencies
uv sync

# Launch the interactive MCP Inspector UI
uv run mcp dev server.py

πŸ“¦ Tech Stack

  • Protocol: Model Context Protocol (MCP) Python SDK

  • Framework: FastMCP (Starlette, Uvicorn, SSE)

  • Data & Math: Polars, NumPy, SciPy, Scikit-learn, HTTPX

  • Infrastructure: Render Web Services, GitHub

Available Tools

4 tools
check_feature_driftB

Evaluates covariate shift for a continuous feature between baseline and production datasets using the Kolmogorov-Smirnov (KS) test. Accepts both local file paths and public HTTP/HTTPS URLs.

Inputs: current_csv (required), baseline_csv (required), feature_column (required), significance_level.

compute_psiB

Computes Population Stability Index (PSI) to evaluate feature shift severity. Accepts both local file paths and public HTTP/HTTPS URLs.

Inputs: current_csv (required), baseline_csv (required), feature_column (required), bins.

generate_mock_datasetsB

Generates synthetic baseline and production CSVs in the local cloud storage.

Inputs: no named parameters.

get_monitoring_policyA

Returns organizational reference guidelines for drift and model monitoring thresholds.

Inputs: no named parameters. 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 4 tools

    Disambiguation4/5

    check_feature_drift and compute_psi both assess feature drift but with distinct statistical methods (KS test vs. PSI) and different outputs (shift detection vs. severity). This is a clear enough separation, though an agent might still pause to choose between them for a generic drift-check request. generate_mock_datasets and get_monitoring_policy are unambiguous.

    Naming Consistency5/5

    All tools use a consistent verb_noun snake_case pattern: generate_mock_datasets, check_feature_drift, get_monitoring_policy, compute_psi. Minor abbreviation in compute_psi doesn't break the convention. The set is highly predictable.

    Tool Count5/5

    Four tools are well-scoped for a focused drift analysis server: one data generator, two drift metrics, and one reference tool. Each tool clearly earns its place without redundancy. The count fits comfortably within the ideal 3-15 range.

    Completeness3/5

    The surface covers continuous feature drift via KS and PSI, plus data generation and policy guidelines. However, it lacks categorical drift tests, batch/multi-feature analysis, and any policy update or model drift tools. These are notable gaps for a server named DriftScope.

    Maintenance

    ActivityStale
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • F
      license
      Not graded
      quality
      B
      maintenance
      Enables statistical analysis through three toolsβ€”survival analysis, paired significance testing, and distribution drift detectionβ€”plus a harness to evaluate quality, latency, and cost.
      1
      -
    • F
      license
      Not graded
      quality
      A
      maintenance
      Enables AI assistants to audit dbt project quality, profile warehouse data, detect schema drift, and auto-generate or update documentation and tests through natural language.
      -
    • F
      license
      Not graded
      quality
      A
      maintenance
      Enables AI assistants to audit dbt project health, profile warehouse data, detect schema drift, suggest tests, and auto-generate non-destructive schema documentation through natural language.
      -