Customer-Try

Customer-Try

MCP server for intelligent car sales customer service, providing inventory search, stock checking, and price quoting tools.

Category
Visit Server

README

Customer-Try — Dify 智能汽车销售客服 Demo

基于 Dify Chatflow/Workflow + MCP Server 的智能汽车销售客服系统。支持多轮对话、本地库存查询、知识库检索、实拍照片展示。

架构

┌─────────────────┐     HTTP/SSE      ┌──────────────────┐
│   Dify (Docker) │ ←───────────────→ │  MCP Server      │
│                 │                   │  (9020端口)       │
│  Chatflow/      │                   │  inventory 查询    │
│  Workflow       │                   │  stock 检查        │
│  + 知识库        │                   │  price 报价        │
│  + LLM          │                   └────────┬─────────┘
└────────┬────────┘                            │
         │                                     │ SQLite
         │ Chat API                            ▼
         │                           ┌──────────────────┐
         ▼                           │ company_inventory │
┌─────────────────┐                  │      .db          │
│  FastAPI        │                  │                   │
│  (7860端口)      │                  │  品牌/车型/配置     │
│  代理转发 +      │                  │  价格/库存/颜色     │
│  聊天UI          │                  │  实拍照片路径       │
│  + 图片服务       │                  └──────────────────┘
└────────┬────────┘
         │
         ▼
    用户浏览器
    http://127.0.0.1:7860

快速开始

1. 环境要求

  • Python 3.11+
  • Conda 环境 customer
  • Docker Desktop(运行 Dify)

2. 安装依赖

conda activate customer
pip install fastapi uvicorn httpx mcp

3. 初始化数据库

python init_company_db.py

数据库 company_inventory.db 包含 8 条示例车辆数据,可按需修改。

4. 启动服务

需要两个终端窗口

终端 1 — FastAPI + 聊天 UI(7860 端口)

conda activate customer
python main.py
# → http://127.0.0.1:7860

终端 2 — MCP Server(9020 端口)

conda activate customer
python mcp_server.py
# → http://127.0.0.1:9020/sse

5. 配置 Dify

连接 MCP Server:

  1. Dify → 插件 → MCP SSE/StreamableHTTP → 设置
  2. 填入:{"car-tools":{"url":"http://host.docker.internal:9020/sse","headers":{},"timeout":50,"sse_read_timeout":50}}
  3. 授权

Workflow 中使用 MCP 工具:

在 Workflow 画布添加「调用 MCP 工具」节点:

字段
工具名称 search_inventory / check_stock / get_price
参数 {"query": "{{#sys.query#}}"}

MCP 工具

工具 参数 说明
search_inventory query 关键词搜索公司库存(自动检测品牌/车型)
check_stock brand, model 精确查询某款车库存和价格
get_price brand, model 获取最优报价

返回值带前缀标记:

  • [STOCK:AVAILABLE] — 有库存
  • [STOCK:EMPTY] — 无库存

数据库结构

company_inventory.dbinventory 表:

字段 类型 说明
brand TEXT 品牌
model TEXT 车型
variant TEXT 具体配置款
year INTEGER 年款
price_guide REAL 指导价(万元)
price_sale REAL 实际售价(万元)
stock INTEGER 库存数量
fuel_type TEXT 能源类型(纯电/插混/增程)
color TEXT 可选颜色
description TEXT 车辆简介
photo_path TEXT 实拍照片文件名(放入 photos/ 目录)

添加车辆照片

  1. 将照片放入 photos/ 目录
  2. 更新数据库 photo_path 字段为文件名
  3. 重启 MCP Server

图片通过 FastAPI 静态文件服务访问:http://127.0.0.1:7860/photos/xxx.jpg

知识库

项目包含以下知识库文档,可导入 Dify 知识库:

  • knowledge_base/购车引导话术.md — 销售引导流程
  • knowledge_base/模糊语义情绪处理话术.md — 模糊表达和情绪处理
  • knowledge_base/汽车百科知识库.md — 汽车信息百科
  • scrape/car_data.md — 网易汽车爬取的 2849 款车数据
  • scrape/car_data.json — 结构化车辆数据

项目文件

customer-try/
├── main.py              # FastAPI 后端 + 聊天 UI 代理
├── mcp_server.py         # MCP Server(库存查询工具)
├── init_company_db.py    # 数据库初始化脚本
├── company_inventory.db  # SQLite 数据库
├── templates/
│   └── index.html        # 聊天界面
├── photos/               # 车辆实拍照片
├── knowledge_base/       # 知识库文档
└── scrape/               # 车辆数据爬虫
    ├── scraper.py        # 爬虫脚本
    ├── car_data.json     # 2849 款车数据
    └── car_data.md       # Markdown 格式

License

MIT

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured