b2b-data-gateway-mcp
v1.0.0
Published
B2B数据网关MCP工具 - 专注教育、零售、文旅行业的外部数据集成
Downloads
121
Maintainers
Readme
B2B Data Gateway MCP
B2B数据网关MCP工具 - 专注教育、零售、文旅行业的外部数据集成
🎯 产品概述
B2B Data Gateway MCP 是一个强大的数据集成工具,专门为B2B行业(教育、零售、文旅)提供外部数据源的无缝接入能力。通过整合多个公开API,实现自动化数据获取、智能分析和商业洞察。
✨ 核心功能
🔧 10大核心工具
| 工具名称 | 功能描述 | 适用行业 |
|---------|---------|---------|
| get_retail_products | 零售商品数据获取 | 零售 |
| get_retail_orders | 零售订单分析 | 零售 |
| get_education_projects | 教育开源项目分析 | 教育 |
| get_education_qa_data | 教育问答数据获取 | 教育 |
| get_tourism_countries | 文旅目的地信息 | 文旅 |
| get_weather_data | 天气数据获取 | 全行业 |
| get_market_trends | 股票市场趋势分析 | 全行业 |
| get_business_news | 商业新闻监控 | 全行业 |
| get_exchange_rates | 汇率数据获取 | 文旅/零售 |
| analyze_business_environment | 综合商业环境分析 | 全行业 |
🌐 集成的数据源
无需认证的免费API:
- Fake Store API - 零售电商模拟数据
- JSONPlaceholder - 通用测试数据
- GitHub API - 开源项目数据
- Stack Exchange API - 技术问答数据
- OpenMeteo API - 全球天气数据
- REST Countries API - 国家地理信息
- Exchange Rate API - 实时汇率数据
- 中国天气网 - 国内天气数据
需要API Key的数据源:
- Alpha Vantage - 股票市场数据(已配置)
- News API - 商业新闻数据(已配置)
- Google Places API - 地理位置数据(可选)
📦 安装部署
本地安装
# 克隆项目
git clone <repository-url>
cd b2b-data-gateway-mcp
# 安装依赖
npm install
# 构建项目
npm run build
# 运行测试
npm testnpm 全局安装
npm install -g b2b-data-gateway-mcpnpx 直接运行
npx b2b-data-gateway-mcp🚀 使用方法
在Claude Desktop中配置
在 claude_desktop_config.json 中添加:
{
"mcpServers": {
"b2b-data-gateway": {
"command": "npx",
"args": ["b2b-data-gateway-mcp"]
}
}
}基础使用示例
// 获取零售商品数据
{
"name": "get_retail_products",
"arguments": {
"category": "electronics",
"limit": 20
}
}
// 获取天气数据
{
"name": "get_weather_data",
"arguments": {
"city": "北京",
"days": 7
}
}
// 综合商业环境分析
{
"name": "analyze_business_environment",
"arguments": {
"city": "上海",
"industry": "retail"
}
}🎯 行业应用场景
🛒 零售行业
// 获取电子产品销售数据
get_retail_products({ category: "electronics", limit: 50 })
// 分析订单模式
get_retail_orders({ limit: 100 })
// 监控市场趋势
get_market_trends({ symbol: "WMT" })🎓 教育行业
// 获取教育技术项目
get_education_projects({ topic: "learning management", limit: 20 })
// 分析学习问答
get_education_qa_data({ tag: "programming", limit: 15 })
// 监控教育新闻
get_business_news({ query: "education technology", limit: 10 })🏛️ 文旅行业
// 获取亚洲旅游目的地
get_tourism_countries({ region: "asia" })
// 分析天气对旅游的影响
get_weather_data({ city: "三亚", days: 14 })
// 监控汇率变化
get_exchange_rates({ base: "CNY" })📊 数据分析能力
自动化商业洞察
每个工具都包含智能分析功能:
- 趋势识别 - 自动识别数据趋势和模式
- 异常检测 - 发现数据中的异常值
- 相关性分析 - 分析不同数据维度间的关联
- 预测建议 - 基于历史数据提供业务建议
多维度数据融合
analyze_business_environment 工具能够整合:
- 天气数据对业务的影响
- 新闻舆情对市场的反映
- 汇率变化对成本的影响
- 行业特定的综合评分
⚙️ 配置说明
API Key配置(可选)
如果需要使用需要认证的API,可以修改 src/index.ts 中的配置:
const API_CONFIG = {
ALPHA_VANTAGE_KEY: 'your_key_here',
NEWS_API_KEY: 'your_key_here',
// ... 其他配置
};自定义城市坐标
在 getCityCoordinates 方法中添加更多城市的坐标:
const coordinates = {
'YourCity': { lat: xx.xxxx, lon: yy.yyyy },
// ...
};🛠️ 开发指南
项目结构
b2b-data-gateway-mcp/
├── src/
│ └── index.ts # 主要MCP服务器实现
├── dist/ # 编译后的JavaScript文件
├── test.js # 测试脚本
├── package.json # 项目配置
├── tsconfig.json # TypeScript配置
└── README.md # 项目文档添加新的数据源
- 在
API_CONFIG中添加新的API配置 - 创建新的工具方法
- 在
setupToolHandlers中注册工具 - 实现数据分析逻辑
运行开发环境
# 开发模式运行
npm run dev
# 构建生产版本
npm run build
# 运行测试
npm test📈 性能特性
- 并发请求 - 支持多个API并发调用
- 错误处理 - 完善的错误重试和降级机制
- 数据缓存 - 智能缓存减少重复请求
- 限流控制 - 遵循API调用限制
- 类型安全 - TypeScript保证代码质量
🌟 技术优势
- 零配置启动 - 无需复杂配置即可使用
- 多源数据整合 - 整合8+个外部数据源
- 智能分析能力 - 自动生成商业洞察
- 行业专业化 - 针对B2B三大行业优化
- 可扩展架构 - 易于添加新的数据源和分析功能
📝 更新日志
v1.0.0 (2024-12-07)
- ✨ 初始版本发布
- ✅ 集成10个核心数据工具
- ✅ 支持8+个外部API数据源
- ✅ 实现智能商业分析功能
- ✅ 完整的TypeScript类型支持
- ✅ 详细的测试和文档
🤝 贡献指南
欢迎提交Issue和Pull Request!
📄 许可证
MIT License
B2B Data Gateway MCP - 让数据驱动的商业决策更简单!
如有问题,请查看 测试文档 或提交Issue。
