💻 DataBro:销售数据分析和可视化服务器(FastMCP)📈
此存储库托管了一个数据分析服务器,该服务器由 FastMCP 框架。它旨在处理和可视化销售交易数据,专门为在支持 模型上下文协议(MCP)例如Claude的桌面应用程序。
它提供了强大、易于使用的工具,用于总结CSV数据集并生成可视化见解。
https://claude.ai/public/artifacts/1602c219-c9c3-4bca-9311-982147ad74b2?fullscreen=false
🌟 特性
- CSV数据摄入: 使用Pandas从原始CSV文本格式安全读取和处理销售数据。
- 数据汇总: 提供全面的统计摘要(
df.describe)以及结构柱信息(df.info). - 条形图可视化: 生成并返回Base64编码的PNG图像,用于快速直观地分析关键指标(例如产品性能、销售代表输出)。
- 模型上下文协议(MCP)就绪: 服务器配置为通过MCP进行通信,使其易于集成,并可由支持平台中的模型作为工具调用。
______________________________________________________________________
⚙️ 安装
要运行此项目,您需要Python和所需的库。
先决条件
- Python 3.8+
pip(Python包安装程序)
步骤
- 克隆存储库:
git clone
cd DataBro_using-MCP- 安装依赖项:
pip install pandas matplotlib fastmcp______________________________________________________________________
🚀 用法
服务器首先运行主Python文件。然后,它将监听工具调用(例如,来自像Claude这样的集成AI模型),以执行定义的分析功能。
运行服务器
python data_server.py
🧱 Core Technology Stack
FastMCP — framework for creating the tool server and exposing functions via the Model Context Protocol (MCP).
Model Context Protocol (MCP) — standard used by tools and AI clients (e.g., Claude) to communicate with the server.
Claude Desktop Context — developed and tested within the Claude desktop environment for seamless tool integration.
Pandas — data manipulation, cleaning, and summarization.
Matplotlib — data visualization engine for chart generation.
Python Standard Library:
base64 — encodes generated charts into Base64 strings for transport and embedding.
io (StringIO, BytesIO) — handles in-memory CSV parsing and image buffering without writing to disk.k.
