Built on FastAPI framework to provide RESTful API endpoints for data analysis tools with automatic API documentation and MCP integration capabilities
Uses NumPy for numerical computations in statistical analysis, correlation calculations, and time series data processing
Leverages pandas for data manipulation and analysis operations across various statistical and time series analysis functions
Uses Pydantic for data validation and serialization of API requests and responses in the data analysis workflows
Implemented in Python to provide comprehensive data analysis capabilities including time series analysis, statistical testing, and predictive modeling
Integrates SciPy for advanced statistical computations including correlation analysis, outlier detection, and time series statistical tests
Provides Swagger UI documentation for interactive API exploration and testing of data analysis endpoints
数据分析MCP工具集
专业的工业数据分析工具集,基于FastAPI-MCP架构,提供多种统计分析方法,适用于时间序列分析、数据质量检查和统计建模等场景。
🚀 功能特性
核心分析工具
- 相关性分析: 支持Pearson、Spearman、Kendall相关系数计算
- 平稳性检验: 提供ADF、PP、KPSS时间序列平稳性检验
- 分布分析: 数据分布特征和趋势模式分析
- 异常值检测: 多种异常值检测方法和综合评估
- 因果关系分析: 格兰杰因果检验、互相关分析等(支持两变量和多变量分析)
- 时序相似度分析: DTW动态时间规整、滑动窗口分析等
- 时间序列预测: 多项式趋势预测、指数平滑预测(专为分钟级数据优化)
技术特点
- 基于FastAPI-MCP架构,支持AI工具调用
- RESTful API接口,易于集成
- 完整的数据验证和错误处理
- 详细的分析结果和建议
- 支持多种数据格式和参数配置
📁 项目结构
🛠️ 安装和使用
环境要求
- Python 3.8+
- FastAPI
- NumPy, SciPy, Pandas
- Statsmodels
安装依赖
启动服务
服务将在 http://localhost:6003
启动。
API文档
启动服务后,访问以下地址查看API文档:
- Swagger UI:
http://localhost:6003/docs
- ReDoc:
http://localhost:6003/redoc
MCP客户端配置
选择可流式传输的 HTTP (streamableHttp):
- URL:
http://127.0.0.1:6003/mcp
📊 API接口说明
1. 两变量相关性分析 (/api/correlation
)
计算两组数据间的相关系数,支持Pearson、Spearman、Kendall相关性度量方法。
请求示例:
2. 单变量平稳性检验 (/api/statistic_calculate
)
执行时间序列平稳性检验,支持ADF、PP、KPSS检验方法。
请求示例:
3. 单变量分布分析 (/api/distribution_analysis
)
分析单个变量的分布特征和趋势模式。
请求示例:
4. 单变量异常值检测 (/api/outlier_detection
)
使用多种方法检测单个变量数据中的异常值。
请求示例:
5. 两变量因果关系分析 (/api/causal_analysis
)
分析两个变量间的因果关系,支持格兰杰因果检验等方法。
请求示例:
6. 多变量因果关系分析 (/api/multi_causal_analysis
)
分析多个测点之间的因果关系网络,识别影响关系。
请求示例:
7. 两变量时序相似度分析 (/api/similarity_analysis
)
分析两个时间序列的相似度和最佳匹配区间。
请求示例:
8. 单变量时间序列预测 (/api/time_series_forecast
)
对单个指标的历史数据进行未来预测,专为分钟级数据优化。
请求示例:
🔧 配置说明
配置文件 (config/config.json
)
📝 开发说明
添加新的分析工具
- 在
routers/
目录下创建新的路由文件 - 定义请求和响应模型
- 实现分析逻辑
- 在
main.py
中注册路由 - 更新MCP配置中的
include_operations
代码规范
- 使用Pydantic进行数据验证
- 添加详细的API文档字符串
- 实现完整的错误处理
- 添加日志记录
- 编写单元测试
📈 应用场景
工业应用
- 设备状态监控和异常检测
- 过程参数相关性分析
- 生产数据质量评估
- 预测模型特征工程
数据科学
- 探索性数据分析(EDA)
- 时间序列分析
- 统计建模预处理
- 数据质量评估
🤝 贡献指南
- Fork 项目
- 创建特性分支 (
git checkout -b feature/AmazingFeature
) - 提交更改 (
git commit -m 'Add some AmazingFeature'
) - 推送到分支 (
git push origin feature/AmazingFeature
) - 打开 Pull Request
📄 许可证
本项目采用 MIT 许可证 - 查看 LICENSE 文件了解详情。
📞 联系方式
如有问题或建议,请通过以下方式联系:
- 提交 Issue
- 发送邮件
- 项目讨论区
版本: v1.0.0
最后更新: 2025年9月
This server cannot be installed
remote-capable server
The server can be hosted and run remotely because it primarily relies on remote services or has no dependency on the local environment.
Provides comprehensive statistical analysis tools for industrial data including time series analysis, correlation calculations, stationarity tests, outlier detection, causal analysis, and forecasting capabilities. Enables data quality assessment and statistical modeling through a FastAPI-based MCP architecture.