MCP Data Analysis Agent
An MCP server that answers natural-language questions over CSV, Excel, and SQL data by providing deterministic tools for loading, profiling, querying, cleaning, statistical analysis, visualization, and reporting. It enables LLMs to plan and interpret while all computation is done exactly through MCP tools.
README
📊 Autonomous Data Analysis System (MCP)
An AI data analyst that answers natural-language questions over CSV / Excel / SQL data. The language model plans and interprets — all computation (SQL, stats, cleaning, charts) runs in deterministic MCP tools, so results are exact, reproducible, and auditable.
Core principle: the LLM never does arithmetic. It reads schemas, chooses which tool to call with which arguments, and turns the returned numbers into business insight.
Architecture
┌──────────────────────────────────────────────────────────┐
│ Streamlit UI (upload · chat · charts · report · switch) │
└───────────────┬──────────────────────────────────────────┘
│
┌───────────────▼──────────────────────────────────────────┐
│ Agent host │
│ • Provider switch (LiteLLM): Ollama · Groq · Gemini │
│ • MCP client: MCP tool schemas ⇆ OpenAI function calls │
│ • Loop: plan → call tool → observe → answer │
└───────────────┬──────────────────────────────────────────┘
│ MCP protocol (stdio)
┌───────────────▼──────────────────────────────────────────┐
│ MCP analysis server │
│ load · profile · sql · eda · clean · stats · viz · report│
│ Dataset registry · Pandas · DuckDB · SciPy · matplotlib │
└──────────────────────────────────────────────────────────┘
See DESIGN.md for the full design and milestone tracker.
Features
- Upload CSV / Excel; DuckDB SQL over your files with no database server.
- Automated profiling & EDA — schema, nulls, cardinality, correlations, group aggregates.
- Non-destructive cleaning — missing values, duplicates, type casts, outliers (each returns a new versioned dataset).
- Statistics — t-test / ANOVA / chi-square, correlation tests, trend analysis, distribution/normality.
- Charts — bar, line, scatter, histogram, box, correlation heatmap (PNG).
- Self-contained HTML reports with embedded charts.
- Pluggable LLM — local Ollama by default, switch to Groq or Gemini free tiers.
Setup
python3 -m venv .venv
source .venv/bin/activate # fish: source .venv/bin/activate.fish
pip install -r requirements.txt
cp .env.example .env # then fill in the provider you want
Choosing a provider (edit .env)
| Provider | Setup | Notes |
|---|---|---|
| Ollama (default, local) | ollama pull qwen2.5:3b and run the Ollama daemon |
Free & private; smaller models plan tools less reliably |
| Groq (free tier) | GROQ_API_KEY=... from https://console.groq.com/keys |
Fast, strong tool-calling — best for reliable planning |
| Gemini (free tier) | GEMINI_API_KEY=... from https://aistudio.google.com/app/apikey |
Large context, strong function-calling |
You can also switch provider live from the sidebar dropdown in the UI.
Run the app
streamlit run ui/streamlit_app.py
Then upload one of the samples in data/ (e.g. sample_sales.csv) and ask
things like "Which region sells the most units, and is the trend rising?" or
"Which plan has the highest churn — build me a report."
Use the MCP server directly (e.g. Claude Desktop)
The server speaks stdio and works with any MCP client:
python -m mcp_server.server
Claude Desktop config:
{ "mcpServers": {
"data-analysis": { "command": "python", "args": ["-m", "mcp_server.server"] }
} }
MCP tool catalog
| Group | Tools |
|---|---|
| Load | load_csv, load_excel, list_datasets |
| Profile | profile_dataset |
| SQL | run_sql (DuckDB) |
| EDA | value_counts, correlations, groupby_aggregate |
| Clean | drop_duplicates, handle_missing, cast_types, handle_outliers, rename_columns |
| Stats | hypothesis_test, correlation_test, trend_analysis, distribution_fit |
| Viz | make_chart |
| Report | export_report |
Testing
PYTHONPATH="$PWD" pytest -q
15 tests spawn the real MCP server over stdio and exercise every tool group; the agent loop is tested with a scripted fake LLM (deterministic, no network).
Project structure
mcp_server/ FastMCP server + registry + tools/
agent/ provider switch (config, providers) + mcp_client + agent loop
ui/ streamlit_app.py
data/ sample datasets + uploads/
reports/ generated charts and HTML reports
tests/ per-milestone test suites
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。