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

vac-product-recommend-mcp

by KatouMegumii

vac-product-recommend-mcp

ローカル stdio 形式の MCP Server:ニーズに応じて携程のパッケージツアー「厳選/総合」リストで商品を検索し、レビュー評価・販売数・価格などの観点で TopN を推薦し、統一形式の Markdown テーブル(Web版 / モバイル版リンク含む)を返します。

純 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

いいえ

リスク管理署名。現在の API では必須ではありません

CTRIP_X_CTX_WCLIENT_REQ

いいえ

ローテーショントークン。現在の API では必須ではありません

主要パラメータ

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