Google-Flights-MCP-Server

by opspawn
Verified

Google 航班 MCP 服务器

该 MCP 服务器提供了使用捆绑的fast_flights库与 Google Flights 数据交互的工具。

特征

提供以下 MCP 工具:

  • get_flights_on_date :获取两个机场之间特定日期的可用单程航班。
    • 参数: origin (str)、 destination (str)、 date (str,YYYY-MM-DD)、 adults (int,可选)、 seat_type (str,可选)、 return_cheapest_only (bool,可选,默认False )。
  • get_round_trip_flights :获取特定出发和返回日期的可用往返航班。
    • 参数: origin (str)、 destination (str)、 departure_date (str,YYYY-MM-DD)、 return_date (str,YYYY-MM-DD)、 adults (int,可选)、 seat_type (str,可选)、 return_cheapest_only (bool,可选,默认False )。
  • find_all_flights_in_range :查找指定日期范围内的往返航班。可以选择仅返回每个日期范围内找到的最便宜航班。
    • 参数: origin (str)、 destination (str)、 start_date_str (str,YYYY-MM-DD)、 end_date_str (str,YYYY-MM-DD)、 min_stay_days (int,可选)、 max_stay_days (int,可选)、 adults (int,可选)、 seat_type (str,可选)、 return_cheapest_only (bool,可选,默认False )。

设置

  1. 克隆存储库:
    git clone https://github.com/opspawn/Google-Flights-MCP-Server.git cd Google-Flights-MCP-Server
  2. 创建虚拟环境(推荐):
    python -m venv .venv source .venv/bin/activate # On Windows use `.venv\Scripts\activate`
  3. 安装依赖项:
    pip install -r requirements.txt
  4. 安装 Playwright 浏览器( fast_flights需要):
    playwright install

运行服务器

您可以直接使用 Python 运行服务器:

python server.py

服务器默认使用 STDIO 传输。

与 MCP 客户端集成(例如 Cline、Claude Desktop)

将服务器添加到 MCP 客户端的配置文件中。例如, cline_mcp_settings.jsonclaude_desktop_config.json

{ "mcpServers": { "google-flights": { "command": "/path/to/your/.venv/bin/python", // Use absolute path to venv python "args": [ "/absolute/path/to/flight_mcp_server/server.py" // Use absolute path to server script ], "env": {}, "disabled": false, "autoApprove": [] } // ... other servers } }

**重要提示:**commandargs中的路径替换为虚拟环境的 Python 可执行文件和系统上的server.py脚本的绝对路径。

笔记

  • 此服务器捆绑了fast_flights库(最初来自https://github.com/AWeirdDev/flights ),用于其核心航班数据抓取功能。请参阅随附的LICENSE文件了解其条款。
  • 根据 Google 航班信息的变化和网络状况,航班数据抓取有时会不可靠或缓慢。这些工具包含基本的错误处理功能。
  • find_all_flights_in_range工具可能会占用大量资源,因为它会检查许多日期组合。
-
security - not tested
-
license - not tested
-
quality - not tested

该 MCP 服务器允许 AI 助手使用 Google Flights 在线搜索航班信息。它可以查找特定日期的航班,也可以搜索一定范围内的日期以查找所有选项或仅查找最便宜的选项。

  1. Features
    1. Setup
      1. Running the Server
        1. Integrating with MCP Clients (e.g., Cline, Claude Desktop)
          1. Notes
            ID: 2gtyt12ucq