集成MCP的实时商业智能副本
一个基于人工智能的生产就绪商业智能系统 模型上下文协议(MCP),实现自然语言数据分析、实时洞察和异常检测——所有这些都可以通过VS Code或Streamlit仪表板进行控制。
┌─────────────────────────────────────────────────────────────────┐
│ Real-Time BI Copilot │
│ │
│ ┌──────────┐ ┌──────────────┐ ┌────────────────────┐ │
│ │ VS Code │◄──►│ MCP Server │◄──►│ DuckDB / Snowflake│ │
│ │ (Agent) │ │ (Python) │ │ (Data Warehouse) │ │
│ └──────────┘ └──────┬───────┘ └────────────────────┘ │
│ │ │
│ ▼ │
│ ┌──────────────┐ │
│ │ Claude AI │ │
│ │ (Analysis) │ │
│ └──────────────┘ │
│ │ │
│ ▼ │
│ ┌──────────────┐ │
│ │ Streamlit │ │
│ │ Dashboard │ │
│ └──────────────┘ │
└─────────────────────────────────────────────────────────────────┘快速开始
# 1. Clone and setup
git clone https://github.com/YOUR_USERNAME/real-time-bi-copilot.git
cd real-time-bi-copilot
chmod +x scripts/setup.sh && ./scripts/setup.sh
# 2. Configure environment
cp .env.example .env
# Edit .env with your ANTHROPIC_API_KEY
# 3. Generate sample data and start
python scripts/generate_data.py
streamlit run streamlit-app/app.py特性
MCP服务器工具
| 工具 | 说明 |
|---|---|
query_database | 对数据仓库执行SQL或自然语言查询 |
analyze_data | 执行统计分析并生成汇总统计数据 |
generate_insights | 使用Claude生成人工智能驱动的商业洞察力 |
detect_anomalies | 具有严重性分类的自动异常检测 |
Streamlit控制中心
- 数据探索器 --浏览表、查看模式、预览数据
- 查询接口 --SQL的自然语言,具有即时结果
- 洞察仪表板 --实时KPI、图表和AI生成的见解
- 系统健康 -监控MCP服务器、数据库和API状态
VS代码集成
- 在VS Code代理模式下使用Claude直接查询数据
- MCP工具可作为代理操作使用
- 编辑器中的自然语言数据分析
技术栈
| 组件 | 技术 |
|---|---|
| MCP服务器 | Python+官方MCP SDK |
| 数据库 | DuckDB(本地)/雪花(云) |
| AI引擎 | 克劳德(Anthropic API) |
| 仪表板 | 流光+绘图 |
| 部署 | Docker+Docker编写 |
项目结构
real-time-bi-copilot/
├── mcp-server/ # MCP server with tools, resources, prompts
├── streamlit-app/ # Multi-page Streamlit dashboard
├── data/ # Sample data and database
├── vscode-config/ # VS Code MCP configuration
├── scripts/ # Setup, test, and demo scripts
├── docs/ # Architecture, API, migration guides
├── tests/ # Unit and integration tests
└── deployment/ # Docker and Kubernetes configs文档
需求
- Python 3.11+
- 无烟煤API键
- Docker(可选,用于容器化部署)
- VS代码(可选,用于代理模式集成)
许可证
麻省理工学院
