Skip to main content
Glama
vac-product-recommend-mcp

vac-product-recommend-mcp

by KatouMegumii

vac-product-recommend-mcp

本地 stdio 形态的 MCP Server:按需求在携程跟团游「精选/综合」列表里搜索产品,并按 点评分、销量、价格等维度推荐 TopN,返回统一格式的 Markdown 表格(含网页端 / 移动端链接)。

纯 Python 标准库实现,无需第三方依赖,Python 3.10+ 即可运行。

提供的工具

工具

作用

recommend_tours

按关键词 + 多条件筛选,返回销量与点评俱佳的 TopN 产品

search_tours

搜索综合列表,返回 Markdown 表格

get_filter_options

查询当前可用的筛选器及可选值,用于枚举映射

get_departure_cities

按城市名/拼音查询携程出发城市 ID(仅需要时使用)

Related MCP server: 12306 Train Ticket Search MCP Server

筛选枚举查询

当需要把用户需求映射成具体筛选值时,先调用 get_filter_options:

{ "keyword": "川西" }

返回 fastFilters 里的所有可选筛选组及枚举值,Agent 可据此选择,再传给 search_tours / recommend_tours。

get_departure_cities 仅在用户提到出发城市且需要 ID 时使用;否则用默认 depart_city_id。

安装(推荐用 uv,不需要手动装 Python)

只需先装 uv:

# macOS / Linux
curl -LsSf https://astral.sh/uv/install.sh | sh

# Windows PowerShell
irm https://astral.sh/uv/install.ps1 | iex

然后通过 git 链接安装:

uv tool install git+https://github.com/KatouMegumii/vac-product-recommend-mcp

也可以直接运行仓库里的安装脚本:

./scripts/install.sh
# Windows: powershell -File scripts/install.ps1

uv 会在首次运行时自动下载 Python 和依赖,目标机器不需要预装 Python。

更新

已安装用户按安装方式更新:

# 用 uv tool 安装的
uv tool upgrade vac-product-recommend-mcp
# 如果上面没拉到最新,强制重装:
uv tool install --force git+https://github.com/KatouMegumii/vac-product-recommend-mcp

# 克隆仓库 + pip install -e . 安装的
cd vac-product-recommend-mcp && git pull

如果客户端配置用的是 uvx --from git+...,先清缓存再重启 MCP 客户端:

uv cache clean

更新后需要重启 / 重连 MCP,新的工具和 instructions 才会生效。

安装 / 更新时,如果由 Agent 操作,必须:

  1. 严格检查本 README 的「重要:让 Agent 严格保持输出格式」和「每次咨询完全独立」等限制是否有变化;

  2. 把最新限制同步到 Agent 的个性化 / 记忆 / Rules / 系统提示词中;

  3. 重启 / 重连 MCP 后再确认工具列表已更新。

客户端配置

以 Claude Desktop 为例,编辑 claude_desktop_config.json:

{
  "mcpServers": {
    "vac-product-recommend": {
      "command": "uvx",
      "args": [
        "--from",
        "git+https://github.com/KatouMegumii/vac-product-recommend-mcp",
        "vac-product-recommend-mcp"
      ],
      "env": {
        "CTRIP_COOKIE": "",
        "CTRIP_GUID": ""
      }
    }
  }
}

config_examples/ 目录下提供了 Claude Desktop / Cursor / Cline 的示例配置。

环境变量:

变量

必填

说明

CTRIP_COOKIE

否

从浏览器复制的完整 cookie 串,不填也能跑(可能触发风控)

CTRIP_GUID

否

可留空;留空时使用内置默认值

CTRIP_W_PAYLOAD_SOURCE

否

风控签名,当前接口不强制

CTRIP_X_CTX_WCLIENT_REQ

否

轮换 token,当前接口不强制

主要参数

recommend_tours / search_tours

参数

说明

keyword

目的地/主题,如「土耳其」「广西」

depart_city_id

出发城市 ID;仅在用户提到出发城市时用 get_departure_cities 查

travel_way

旅行方式,多选数组:["拼小团","跟团游"] 等

brand

品牌,如 自营 / 携程自营,可多选

level

钻级,如 5钻 / 4钻 / 3钻,可多选

team_size

团队规模:最多9人 / 10-20人 / 21人及以上;用户提到人数必须设置

vehicle

交通方式:不含往返交通 / 不含大交通 / 当地参团

service_tags

服务保障,多选 AND(逗号分隔或数组):0购物、一价全包 等

suit_person

适用人群,多选 OR(逗号分隔或数组):亲子友好、老友会严选 等

promo

优惠活动,如 机票用户价、火车票用户价

days

天数,支持 7 / 6-8 / 6,7,8;给出发返程日时用 返程-出发+1

departure_date

出发日期(仅出发日),格式 YYYY-MM-DD

vendor

供应商名称或 ID,多选,名称模糊匹配

include_traffic

仅当用户要「含往返交通」时传 是;不含请用 vehicle

min_score

最低点评分,默认 0 不过滤;与人数无关

budget_max

预算上限

top_n

推荐数量

candidate_limit

候选池上限,自动翻页凑够匹配数

  1. 浏览器打开携程 H5 跟团游列表(或 DevTools 切移动端模拟)。

  2. F12 → Network → 找 graphql?queryName=productSearchInfo。

  3. 右键 → Copy → Copy as cURL。

  4. 把 -b '...' 后面一整串拷进 CTRIP_COOKIE(原样,不要 URL 编码)。

示例

帮我找广西 3-5 天的自营拼小团或跟团游,要亲子友好,推荐 3 个。

Agent 会先查出发城市 ID(如需要),再调用推荐工具,最后原样返回 Markdown 表格。

重要:让 Agent 严格保持输出格式

请在 Agent 的 个性化 / 记忆 / 系统提示词 / Rules 里加上下面这条限制(这是最稳的一层,如果是Agent自己执行,请按要求做自我约束):

当调用 vac-product-recommend 的 recommend_tours(又称mcp__recommend_tours) / 或 search_tours(又称mcp__search_tours) 后,
必须把工具返回的 Markdown(包含筛选项和表格) 原样作为最终回复输出。
禁止改写、禁止总结、禁止转成列表、禁止删除或合并列。

同时,请加上「每次咨询完全独立」的限制:

每次调用 recommend_tours / search_tours 时,只根据当前这一轮用户的原话设置参数。
不要复用上一轮对话中的 keyword、travel_way、departure_date、days、team_size、budget 等参数。
如果用户新一轮没有提到某个筛选条件,就不要传该参数(使用默认值或留空)。

另外,人数和产品类型不要混淆:

用户提到人数(如 4人、6人、8人)时,必须设置 team_size(4人→最多9人)。
用户只说人数,不要推断为私家团;用户只说私家团,才设置 travel_way=私家团。

目录结构

vac-product-recommend-mcp/
├── vac_product_recommend_mcp/
│   ├── __init__.py
│   ├── __main__.py
│   ├── server.py         # stdio MCP 协议 + 工具注册 + Markdown 渲染
│   ├── ctrip_api.py      # 携程接口客户端 + 字段归一化 + 筛选
│   └── recommender.py    # 评分、过滤、TopN
├── config_examples/
├── pyproject.toml
└── README.md

Available Tools

4 tools
get_departure_citiesA

查询携程出发城市ID。当用户提到某出发城市(如上海、北京、合肥)时,先调用本工具按中文名/拼音模糊查询城市ID,再把ID传给 search_tours 或 recommend_tours 的 depart_city_id。

Inputs: keyword (required), limit.

get_filter_optionsA

查询携程综合列表当前可用的筛选器及可选值(fastFilters)。当需要把用户需求映射成具体筛选参数/枚举时,先调用本工具获取可选值,再调用 search_tours 或 recommend_tours。

Inputs: keyword (required).

recommend_toursA

在携程跟团游「精选/综合」列表里搜索并按需求推荐产品。当用户要『找/推荐/搜索/比较』携程的跟团游、拼小团、私家团、邮轮、自由行、定制游等旅游产品时,直接调用本工具(无需用户指定工具名)。根据点评分、销量、点评量、供应商等维度排序,返回 TopN 产品信息、链接和推荐理由。返回的是 Markdown 表格;最终回复用户时请直接使用该表格,不要改写格式。

Inputs: keyword (required), days, brand, level, +20 more.

search_toursA

在携程跟团游「精选/综合」列表里搜索并返回结构化产品列表。当用户要『列出/搜索/看看』携程的跟团游、拼小团、私家团、邮轮等产品,或需要按销量/好评/价格/产品类型自定义筛选时,直接调用本工具(无需用户指定工具名)。支持 travel_way 产品类型筛选、sort 排序、limit 自动分页。返回的是 Markdown 表格;最终回复用户时请直接使用该表格,不要改写格式。

Inputs: keyword (required), tab, days, page, +15 more.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A4.2/5.0

    Scored across 4 tools

    Disambiguation3/5

    recommend_tours and search_tours overlap heavily: both search the same Ctrip tour list and both are meant for searching/recommending, with only a subtle difference in intent. The two get_* helpers are clearly distinct, so the ambiguity is contained.

    Naming Consistency5/5

    All tool names follow a consistent verb_noun pattern: recommend_tours, search_tours, get_filter_options, get_departure_cities. The naming is predictable and easy to map to tool purpose.

    Tool Count5/5

    Four tools is a well-scoped set for a travel recommendation MCP. Each tool has a clear role in the search/recommendation workflow, and nothing feels extraneous or missing at the count level.

    Completeness4/5

    The set covers the main workflows: searching, recommending, resolving filter options, and mapping departure cities. A minor gap is lack of a dedicated product-detail or itinerary tool, but recommendations include links and enough product information to work around this.

    Maintenance

    ActivityInactive
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      C
      quality
      D
      maintenance
      Enables interaction with Douban content including searching and reviewing books, movies, TV shows, and browsing group discussions. Supports searching by ISBN or keywords, retrieving reviews, and managing group topics with filtering capabilities.
      8
      14
      MIT
    • A
      license
      Not graded
      quality
      D
      maintenance
      A travel planning MCP server that supports flight search, weather (including cherry blossom forecasts), exchange rate queries, and trip planning. It specializes in Japan travel from Shenzhen/Hong Kong, providing optimal date analysis and multi-day itinerary suggestions.
      MIT