Data Science Agent MCP Server

Data Science Agent MCP Server

Provides MCP-compatible tools for data analysis, including file reading, Python/SQL execution, and hypothesis testing. Enables autonomous data analysis agents to interact with a sandboxed environment.

Category
Visit Server

README

Data Science Agent

Autonomous AI agent for data analysis — custom ReAct loop, sandboxed Python/SQL execution, hypothesis testing, MCP protocol, skill system, real-time streaming WebUI.

Features

Core Agent

  • Custom ReAct Loop — No LangChain dependency. Full control over planning, tool dispatch, and error recovery
  • Dynamic Tool Registry — Pluggable tools with JSON Schema definitions. Add new tools in one line
  • Planner — Decomposes vague requests into structured analysis plans
  • Streaming WebSocket — Real-time thought → tool → result flow

Analysis Capabilities

  • Python Sandbox — Isolated subprocess execution with auto-imported pandas/numpy/matplotlib/seaborn/scipy
  • SQL Executor — Auto-loads uploaded files into SQLite tables for JOIN/GROUP BY queries
  • Hypothesis Testing Engine — 8 statistical tests (t-test, chi-square, ANOVA, Mann-Whitney U, Pearson/Spearman) with effect sizes (Cohen's d, η², Cramer's V)
  • Multi-file Analysis — Cross-table JOIN and correlation analysis across multiple uploaded files
  • Chart Generation — Auto-captured matplotlib/seaborn charts displayed inline
  • Data Lineage Tracking — Trace any conclusion back to its source data and tool calls

Skill System

  • 5 Pre-built Analysis Templates: Financial Analysis, User Segmentation, Anomaly Detection, Correlation Analysis, Time Series Analysis
  • Multi-select — Combine multiple skills for comprehensive analysis
  • Extensible — Add custom skills as JSON files in skills/

MCP Protocol

  • JSON-RPC 2.0 endpoint at /mcp — tools/list, tools/call, resources/list
  • Compatible with any MCP client
  • 6 tools exposed: file_reader, python_executor, sql_executor, hypothesis_test, skill_loader, finish

Memory & Persistence

  • SQLite-backed sessions — Survives restarts and page refreshes
  • Auto-titling — Sessions named after uploaded files
  • Cleanup on delete — Removing a session deletes its files, reports, and database

Export

  • Markdown / HTML / PDF / Jupyter Notebook (.ipynb) — full analysis pipeline as executable notebook
  • Streaming chat UI with real-time step visualization
  • Configurable LLM — Set API key/base URL/model via UI settings panel

Architecture

User → WebUI (Next.js) → FastAPI
                          ├── ReAct Agent Core
                          ├── Tool Registry (6 tools)
                          ├── MCP Server (/mcp)
                          ├── Skill Registry (5 templates)
                          ├── Python Sandbox (subprocess)
                          ├── SQL Executor (SQLite per session)
                          └── Memory (SQLite persistence)

Quick Start

Prerequisites

  • Python 3.9+
  • Node.js 22+
  • LLM API key (OpenAI, DeepSeek, OpenRouter, etc.)

Setup

git clone <repo-url>
cd data-science-agent

# Backend
cp .env.example .env
# Edit .env with your API key
pip install -r requirements.txt
python -m uvicorn server.main:app --host 0.0.0.0 --port 8000

# Frontend (new terminal)
cd web
npm install
npm run dev

Open http://localhost:3000.

Usage Guide

1. 配置 API 点击右上角齿轮图标 → 填入 DeepSeek / OpenAI / OpenRouter 的 API Key、Base URL、Model → 保存

2. 上传数据 左侧「数据文件」区域拖拽或点击上传 CSV/Excel/JSON 文件。支持多个文件做关联分析。

3. 选择技能(可选) 聊天区顶部选择预置技能模板(财务分析、异常检测、相关性分析等),可多选组合。

4. 提问分析 输入框输入问题,发送。Agent 自动:探查数据 → 写代码 → 出图表 → 统计检验 → 生成报告

5. 查看结果

  • 分析步骤和图表实时展示
  • 完成后点「查看报告」看完整报告
  • 点「数据血缘」追溯数据来源
  • 下载 PDF / Markdown / Jupyter Notebook

Docker

docker compose up --build

CLI Usage

# Single analysis
python cli.py "Analyze sales trends by region" -f data.csv -o report.md

# Interactive mode
python cli.py -i

API

Method Endpoint Description
POST /api/sessions Create session
POST /api/sessions/{id}/upload Upload file
POST /api/sessions/{id}/chat Send message
WS /ws/{id} Streaming chat
GET /api/sessions/{id}/report Download report (md/html/pdf)
POST /mcp MCP JSON-RPC endpoint
GET /api/skills List analysis skills

Project Structure

├── agent/
│   ├── core/          # ReAct loop, planner
│   ├── llm/           # LLM client (OpenAI-compatible)
│   ├── tools/builtin/ # file_reader, python_executor, sql_executor,
│   │                  # hypothesis_test, skill_loader, finish
│   ├── memory/        # Session context + SQLite store
│   ├── sandbox/       # Subprocess & Docker sandbox
│   ├── mcp/           # MCP protocol server
│   ├── skills/        # Skill registry
│   └── reporter/      # Markdown report generator
├── server/            # FastAPI app
├── web/               # Next.js frontend
├── skills/            # Skill template JSON files
├── cli.py             # CLI entry point
└── docker-compose.yml

Key Design Decisions

  1. No LangChain — Full control over agent loop and tool dispatch
  2. MCP-native — Tools exposed via standard protocol, not proprietary API
  3. Hypothesis-driven — Beyond descriptive stats; every conclusion backed by statistical tests
  4. Lineage tracking — Every data point traceable to its source
  5. Skill templates — Reusable, validated analysis workflows

License

MIT

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured