Files
mcp-auth/mcp-for-crm/README.md
T
2026-08-10 20:57:49 +08:00

50 lines
1.6 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# MCP for CRM — 汽车零部件智能报价 CRM 数据服务
## 概述
为汽车零部件(小型阀体外壳)智能报价智能体提供 CRM 数据访问能力,通过 MCP 协议暴露 10 个工具(6 个业务 + 4 个验证/管理)。
## 技术栈
- **框架**: MCPServer(mcp 2.0.0 内置高级框架)
- **语言**: Python 3.11+
- **数据库**: PostgreSQL 15+
- **传输协议**: Streamable HTTP(远程调用)
## 工具清单
| 工具名 | 功能 |
|---|---|
| `get_customer_info` | 查询客户信息(OEM/Tier、信用、折扣率) |
| `create_inquiry` | 创建询价记录(关联图纸号、零件号、年用量) |
| `save_quotation` | 保存报价单(含模具费、单价、成本明细、版本管理) |
| `get_quotation_history` | 查询历史报价(按客户/零件号/日期) |
| `update_opportunity` | 商机状态管理(lead→quoted→won/lost) |
| `save_quotation_mock` | 报价写入 CRM(Mock 模拟,独立 mock 表,与其他工具无关联) |
## 快速开始
```bash
pip install -r requirements.txt
cd src
python seed.py # 初始化数据库(可选,数据已在共享数据库中)
python server.py # 启动 MCP Server(端口 8002)
```
## 服务地址
- **HTTP 端点**: `http://0.0.0.0:8002/mcp`
- **传输协议**: Streamable HTTP
## 数据库配置
通过环境变量配置:
| 变量 | 默认值 | 说明 |
|---|---|---|
| `CRM_DB_HOST` | 192.168.1.206 | PostgreSQL 主机 |
| `CRM_DB_PORT` | 5432 | 端口 |
| `CRM_DB_USER` | postgres | 用户名 |
| `CRM_DB_PASSWORD` | digiwin | 密码 |
| `CRM_DB_NAME` | smart_quotation_auto | 数据库名 |