Skip to main content
Glama
luffy666code

meituan-travel

by luffy666code

✈️ Meituan Travel MCP Server

Travel search for AI agents, powered by Fliggy FlyAI — right inside Claude Desktop, Cursor, and any MCP-compatible client.

Search hotels, flights, trains, attractions with natural language. No browser tabs. Just ask.

Python Node MCP License: MIT Version

Homepage · Quick Start · Configuration · Tools · Examples


🤔 Why this project?

Planning a trip inside an AI conversation used to mean switching back and forth between your agent and a dozen travel websites — comparing hotels, checking flights, looking up train schedules, and pasting results back by hand.

This MCP server brings Fliggy FlyAI — Alibaba's official travel AI search — directly into your agent's toolbox. Ask a question, get an answer, without ever leaving the terminal.

  • Natural language in, structured results out — describe your trip in plain Chinese or English; the server returns clean, readable results.

  • Direct to official FlyAI, no third-party proxy — every query calls the official @fly-ai/flyai-cli maintained by Alibaba Fliggy.

  • stdio MCP server, cross-platform — runs on Windows, Linux, and macOS; works with Claude Desktop, Cursor, and any MCP-compatible client.

  • Debuggable by default — set MEITUAN_TRAVEL_DEBUG=0 to silence logs, or leave it on to trace every CLI call.


Related MCP server: China Travel MCP

📋 Requirements

Dependency

Version

Why

Python

3.10+

Runs the MCP server (mcp SDK + pydantic)

Node.js

≥ 18

Executes the FlyAI CLI (@fly-ai/flyai-cli)

npm

bundled with Node

Installs the FlyAI CLI package

FLYAI_API_KEY

Your API key from Fliggy FlyAI Open Platform

Note: This project is open-source server software. The actual travel search capability depends on the Fliggy FlyAI service and your own API key — the repository does not bundle any credentials.


🚀 Quick Start

Step 1 — Install Python dependencies

pip install -r requirements.txt

Step 2 — Install the FlyAI CLI

Important: The server resolves node_modules relative to src/, so you must run npm install inside the src directory.

cd src
npm install @fly-ai/flyai-cli
cd ..

This creates src/node_modules/@fly-ai/flyai-cli/, which server.py locates automatically.

Step 3 — Set your API key

Get your key from the Fliggy FlyAI Open Platform console (log in → click avatar → obtain interface key).

Windows (cmd / PowerShell):

set FLYAI_API_KEY=your_api_key_here

Linux / macOS:

export FLYAI_API_KEY=your_api_key_here

Step 4 — Verify the server starts

python src/__main__.py

The server starts in stdio mode and waits for MCP client connections. No output means it's running correctly (debug logs go to stderr and src/meituan-travel-debug.log by default).

To disable debug logging:

# Windows
set MEITUAN_TRAVEL_DEBUG=0
# Linux / macOS
export MEITUAN_TRAVEL_DEBUG=0

🔧 Tools

Tool

Purpose

Required Params

meituan_travel_query

Travel search with city context — hotels, attractions, flights, trains, and mixed itineraries. Combines city + query into a single FlyAI request.

city (string): Current city or main destination, e.g. 北京, 上海, 东京.query (string): Full natural-language travel request, may include dates, budget, transport, hotel, and attraction preferences.

flyai_ai_search

Direct FlyAI ai-search call. Best for complex multi-city trips, open-ended exploration, or when no specific city anchor is needed.

query (string): Full natural-language travel request, may include origin, destination, dates, budget, companions, and preferences.

Example prompts

  • "北京出发,国庆去成都 5 天,预算 5000,推荐酒店和景点"

  • "上海到东京的机票,10 月 1 日出发,10 月 7 日返回"

  • "杭州周末两日游,带老人小孩,不要太累"

  • "Find me a boutique hotel in Bangkok near the river, under $150/night"


⚙️ How It Works

┌──────────────┐     stdio      ┌──────────────────────┐
│  MCP Client  │ ◄────────────► │  python src/__main__ │
│ (Claude/Cursor│                │      .py (FastMCP)   │
└──────┬───────┘                └──────────┬───────────┘
       │                                     │
       │  tool call                          │  subprocess
       ▼                                     ▼
┌──────────────┐     node       ┌──────────────────────┐
│  Agent asks  │ ─────────────► │  @fly-ai/flyai-cli   │
│  in natural  │                │   (official Fliggy)   │
│   language   │                └──────────┬───────────┘
└──────────────┘                           │
                                           │  HTTPS
                                           ▼
                                  ┌──────────────────────┐
                                  │  Fliggy FlyAI API    │
                                  │  flyai.open.fliggy.  │
                                  │         com           │
                                  └──────────┬───────────┘
                                             │
                                             ▼  JSON
                                  ┌──────────────────────┐
                                  │  Results rendered to │
                                  │      the agent       │
                                  └──────────────────────┘
  1. Your MCP client spawns python src/__main__.py as a stdio subprocess.

  2. __main__.py bootstraps the path (offline bundle or source mode) and imports server.main.

  3. server.py creates a FastMCP("meituan-travel") instance and registers two tools.

  4. When a tool is called, the server resolves the FlyAI CLI entry from src/node_modules/@fly-ai/flyai-cli.

  5. It spawns node <cli> ai-search --query "..." with FLYAI_API_KEY in the environment.

  6. The CLI returns JSON; the server parses, renders, and sends the result back through MCP.


🔌 MCP Client Configuration

Claude Desktop

Edit claude_desktop_config.json (on Windows: %APPDATA%\Claude\claude_desktop_config.json):

{
  "mcpServers": {
    "meituan-travel": {
      "command": "python",
      "args": ["C:\\absolute\\path\\to\\meituan-travel-mcp\\src\\__main__.py"],
      "env": {
        "FLYAI_API_KEY": "your_api_key_here"
      }
    }
  }
}

Replace C:\\absolute\\path\\to\\meituan-travel-mcp with the actual full path to this repository on your machine. Use double backslashes in JSON.

Cursor

Create or edit .cursor/mcp.json in your project root:

{
  "mcpServers": {
    "meituan-travel": {
      "command": "python",
      "args": ["C:\\absolute\\path\\to\\meituan-travel-mcp\\src\\__main__.py"],
      "env": {
        "FLYAI_API_KEY": "your_api_key_here"
      }
    }
  }
}

Generic MCP Client

Any MCP-compatible client that supports stdio servers can use this configuration:

{
  "mcpServers": {
    "meituan-travel": {
      "command": "python",
      "args": ["/absolute/path/to/meituan-travel-mcp/src/__main__.py"],
      "env": {
        "FLYAI_API_KEY": "your_api_key_here"
      }
    }
  }
}

On Linux/macOS, use forward-slash absolute paths. On Windows, use double-backslash escaped paths in JSON.


📝 Examples

Asking about hotels

"我在杭州,想住西湖附近的精品酒店,预算 800 元以内,两晚"

The agent calls meituan_travel_query(city="杭州", query="想住西湖附近的精品酒店,预算 800 元以内,两晚") and returns hotel recommendations with prices and locations.

Multi-city itinerary

"帮我规划一个成都-重庆-西安的 7 天行程,含交通和住宿建议"

The agent calls flyai_ai_search(query="成都-重庆-西安 7 天行程,含交通和住宿建议") and gets a structured itinerary covering transport options, hotel suggestions, and attraction highlights.


🐛 Troubleshooting

未配置 FLYAI_API_KEY。请在环境变量 FLYAI_API_KEY 中填写飞猪 AI 开放平台 API Key。

The FLYAI_API_KEY environment variable is not set. Follow Step 3 above. On Windows, remember that set only affects the current terminal session — if you launch your MCP client from a different terminal or GUI, set the variable system-wide or in the client's env config.

未找到 Node.js;FlyAI CLI 要求 Node.js >= 18。

Node.js is not in your PATH. Install Node.js ≥ 18 and ensure node --version works in your terminal. If Node is installed but not found, you can set FLYAI_NODE to the absolute path of the Node executable:

set FLYAI_NODE=C:\Program Files\nodejs\node.exe

包内缺少 @fly-ai/flyai-cli/package.json

The FlyAI CLI is not installed, or it was installed in the wrong directory. Make sure you ran npm install @fly-ai/flyai-cli inside the src/ directory (see Step 2). The server looks for src/node_modules/@fly-ai/flyai-cli/ specifically.

Server exits immediately with 启动失败

When running from source (not an offline bundle), __main__.py no longer requires a site-packages/<platform> directory — it falls back to using your system Python environment. If you still see this error, ensure pip install -r requirements.txt completed successfully and that python -c "import mcp" works.

Debug logs are too noisy

Set MEITUAN_TRAVEL_DEBUG=0 to disable debug output to stderr and the log file.


📄 License

This project is licensed under the MIT License.


🙏 Acknowledgements

Related MCP Connectors

Related MCP Servers