Content
# DataMaster MCP Server
## Project Introduction
**DataMaster MCP Server** is a powerful data analysis management server built on **Model Context Protocol (MCP)**. This project stems from several core pain points encountered in modern data analysis work:
- **Data source fragmentation**: Enterprise data is scattered across different systems such as databases, APIs, and files, making integration difficult.
- **Complex analysis process**: Switching between multiple tools is required from data acquisition to analysis results, resulting in low efficiency.
- **Difficult collaboration**: Lack of a unified interaction interface between data analysts, developers, and business personnel.
- **Repetitive labor**: Repeatedly writing code for data connection, cleaning, and transformation for each analysis.
To solve these problems, we developed this **one-stop data management and analysis platform** that integrates database operations, API integration, data processing, and analysis calculations into a unified MCP server. Users can complete complex data analysis tasks with simple natural language instructions.
### Core Features
🔍 **Multi-Data Source Integration**
- Supports mainstream databases such as SQLite, MySQL, and PostgreSQL
- Integrates RESTful API data acquisition
- Unified data source management interface
📊 **Intelligent Data Processing**
- Data cleaning (deduplication, missing value handling, type conversion)
- Data transformation (column renaming, standardization, calculating new columns)
- Data filtering (conditional filtering, sampling, column selection)
📈 **Advanced Analysis Capabilities**
- Descriptive statistical analysis
- Trend analysis and prediction
- Data visualization preview
💾 **Flexible Data Export**
- Supports multiple formats such as Excel, CSV, and JSON
- Automatically generates standardized reports
- One-click sharing of analysis results
## Deployment Guide
### Environment Requirements
- **Python**: 3.8 or higher
- **Operating System**: Windows 10/11, macOS 10.15+, Ubuntu 18.04+
- **Memory**: Minimum 4GB RAM (8GB or more recommended)
- **Storage**: At least 1GB of available space
#### 2. Install Dependencies
```bash
pip install datamaster-mcp
```
#### 3. Configuration File Settings
Create a configuration file `config/mcp_config.json`:
```json
{
"mcpServers": {
"datamaster-mcp": {
"command": "uvx",
"args": [
"datamaster-mcp"
]
}
}
}
```
## Usage Examples
### Example 1: Connect to Database and Query Data
**User Input:**
```
连接到本地的sales数据库,查询2024年的销售数据
```
**System Response:**
```
✅ 数据库连接成功!
📊 查询结果:找到15,847条2024年销售记录
数据概览:
├─ 总销售额:¥2,847,392.50
├─ 订单数量:15,847笔
├─ 平均订单金额:¥179.68
└─ 数据时间范围:2024-01-01 至 2024-12-31
数据已保存到表:sales_2024_analysis
```
### Example 2: API Data Acquisition and Analysis
**User Input:**
```
从天气API获取北京最近7天的天气数据,分析温度趋势
```
**System Response:**
```
🌤️ 天气数据获取成功!
📈 温度趋势分析完成
7天温度统计:
├─ 最高温度:28.5°C (10月15日)
├─ 最低温度:12.3°C (10月12日)
├─ 平均温度:20.8°C
└─ 温度变化:整体呈下降趋势 (-3.2°C)
📊 数据可视化已生成:exports/weather_trend_20241015_143022.png
```
### Example 3: Data Cleaning and Export
**User Input:**
```
清洗用户数据表,去除重复邮箱,填充缺失的手机号码
```
**System Response:**
```
🧹 数据清洗完成!
清洗结果统计:
├─ 原始记录:8,432条
├─ 重复邮箱:127条(已删除)
├─ 缺失手机:2,156条(已填充默认值)
├─ 数据类型转换:3列
└─ 清洗后记录:8,305条
📤 清洗结果已导出:exports/cleaned_users_20241015_144512.xlsx
```
### Example 4: Complex SQL Query and Visualization
**User Input:**
```
查询每个产品类别的月度销售额,按销售额降序排列
```
**System Response:**
```
📊 查询执行成功!
月度销售排行榜:
├─ 电子产品:¥847,392.00 (占比29.7%)
├─ 服装配饰:¥624,193.50 (占比21.9%)
├─ 家居用品:¥518,472.30 (占比18.2%)
├─ 图书文具:¥392,847.20 (占比13.8%)
└─ 运动户外:¥347,392.00 (占比12.2%)
📈 可视化图表已生成:
├─ 柱状图:exports/category_sales_bar_20241015_145533.png
├─ 饼图:exports/category_sales_pie_20241015_145533.png
└─ 数据表:exports/category_monthly_sales.xlsx
```
### Actual Usage Screenshot Display
#### Main Interface Display
```
┌─────────────────────────────────────────────────────────────┐
│ DataMaster MCP Server │
│ ┌─────────────────────────────────────────────────────┐ │
│ │ 🔍 数据源管理 📊 数据分析 ⚙️ 数据处理 🌐 API │ │
│ └─────────────────────────────────────────────────────┘ │
│ ┌─────────────────────────────────────────────────────┐ │
│ │ 已连接数据源: │ │
│ │ 📊 SQLite数据库: analysis.db (已连接) │ │
│ │ 🌐 天气API: api.weather.com (已配置) │ │
│ │ 📈 股票API: api.stocks.com (已配置) │ │
│ └─────────────────────────────────────────────────────┘ │
│ [输入指令] > 连接到sales数据库,查询2024年销售数据... │
└─────────────────────────────────────────────────────────────┘
```
#### Database Connection Configuration
```
┌─────────────────────────────────────────┐
│ 数据库连接配置 │
├─────────────────────────────────────────┤
│ 数据库类型: SQLite │
│ 数据库路径: ./data/sales.db │
│ 连接状态: ✅ 已连接 │
│ 表数量: 12张 │
│ 总记录数: 125,847条 │
├─────────────────────────────────────────┤
│ 可用表: │
│ • customers (8,432条) │
│ • orders (15,847条) │
│ • products (342条) │
│ • sales_records (45,293条) │
└─────────────────────────────────────────┘
```
#### Data Query Results
```
┌─────────────────────────────────────────────┐
│ SQL查询结果 │
├─────────────────────────────────────────────┤
│ 查询: SELECT * FROM sales WHERE year=2024 │
│ 执行时间: 0.23秒 │
│ 返回记录: 15,847条 │
├─────────────────────────────────────────────┤
│ 数据概览: │
│ ├─ 总销售额: ¥2,847,392.50 │
│ ├─ 平均订单: ¥179.68 │
│ ├─ 最高单笔: ¥12,450.00 │
│ └─ 数据范围: 2024-01-01 ~ 2024-12-31 │
└─────────────────────────────────────────────┘
```
#### API Data Acquisition
```
┌─────────────────────────────────────────────┐
│ API数据获取 │
├─────────────────────────────────────────────┤
│ API名称: 天气数据API │
│ 请求URL: api.weather.com/v1/forecast │
│ 响应状态: ✅ 200 OK │
│ 数据大小: 45.2 KB │
├─────────────────────────────────────────────┤
│ 数据预览: │
│ 日期 温度 湿度 天气 │
│ 2024-10-15 28.5°C 65% 晴 │
│ 2024-10-14 26.2°C 70% 多云 │
│ 2024-10-13 24.8°C 72% 阴 │
└─────────────────────────────────────────────┘
```
#### Data Cleaning Tools
```
┌─────────────────────────────────────────────┐
│ 数据清洗结果 │
├─────────────────────────────────────────────┤
│ 清洗前记录: 8,432条 │
│ 清洗后记录: 8,305条 │
│ 删除重复: 127条 │
│ 填充缺失: 2,156条 │
├─────────────────────────────────────────────┤
│ 清洗操作: │
│ ✓ 去除重复邮箱地址 │
│ ✓ 填充缺失手机号码 │
│ ✓ 标准化日期格式 │
│ ✓ 验证邮箱格式 │
└─────────────────────────────────────────────┘
```
#### Analysis Result Export
```
┌─────────────────────────────────────────────┐
│ 导出结果 │
├─────────────────────────────────────────────┤
│ 导出格式: Excel (.xlsx) │
│ 文件路径: exports/sales_analysis.xlsx │
│ 文件大小: 2.34 MB │
│ 包含工作表: 3个 │
├─────────────────────────────────────────────┤
│ 工作表内容: │
│ • 销售概览 │
│ • 月度趋势 │
│ • 产品分析 │
└─────────────────────────────────────────────┘
```
### Advanced Usage Tips
#### Batch Processing
```bash
# 批量处理多个数据表
python -m datamaster_mcp.main --batch-process tables.txt --config batch_config.json
```
#### Scheduled Tasks
```bash
# 设置定时数据更新
python -m datamaster_mcp.main --schedule "0 9 * * *" --task daily_report
```
#### Custom Analysis Templates
```json
{
"template_name": "monthly_sales_analysis",
"steps": [
{"action": "query", "sql": "SELECT * FROM sales WHERE date >= ?"},
{"action": "clean", "config": {"remove_duplicates": true}},
{"action": "analyze", "type": "trend"},
{"action": "export", "format": "excel"}
]
}
```
## Troubleshooting
### Common Issues
**Q: Failed to connect to the database**
A: Check the database configuration and network connection to ensure the database service is running
**Q: API request timed out**
A: Increase the API timeout setting and check the stability of the network connection
**Q: Out of memory error**
A: Reduce the amount of data processed at one time, or increase system memory
### Log Viewing
```bash
# 查看实时日志
tail -f logs/datamaster.log
# 查看错误日志
grep ERROR logs/datamaster.log
```
## Technical Support
- **GitHub Issues**: [Submit Issue](https://github.com/your-username/DataMaster-MCP/issues)
- **Documentation**: [Complete Documentation](https://datamaster-mcp.readthedocs.io)
- **Community**: [Discussion Forum](https://github.com/your-username/DataMaster-MCP/discussions)
---
**DataMaster MCP Server** - Making Data Analysis Simple and Powerful!
Connection Info
You Might Also Like
markitdown
MarkItDown-MCP is a lightweight server for converting URIs to Markdown.
markitdown
Python tool for converting files and office documents to Markdown.
Filesystem
Node.js MCP Server for filesystem operations with dynamic access control.
Sequential Thinking
A structured MCP server for dynamic problem-solving and reflective thinking.
Fetch
Retrieve and process content from web pages by converting HTML into markdown format.
TrendRadar
TrendRadar: Your hotspot assistant for real news in just 30 seconds.