此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)。git clone https://github.com/opspawn/Google-Flights-MCP-Server.git
cd Google-Flights-MCP-Server
python -m venv .venv
source .venv/bin/activate # 在Windows上使用`.venv\Scripts\activate`
pip install -r requirements.txt
fast_flights所需):
playwright install
你可以直接使用Python运行服务器:
python server.py
默认情况下,服务器使用STDIO传输。
在你的MCP客户端配置文件中添加服务器。例如对于cline_mcp_settings.json或claude_desktop_config.json:
{
"mcpServers": {
"google-flights": {
"command": "/path/to/your/.venv/bin/python", // 使用虚拟环境Python可执行文件的绝对路径
"args": [
"/absolute/path/to/flight_mcp_server/server.py" // 使用服务器脚本的绝对路径
],
"env": {},
"disabled": false,
"autoApprove": []
}
// ... 其他服务器
}
}
重要提示: 将command和args中的路径替换为你系统上虚拟环境Python可执行文件和server.py脚本的绝对路径。
fast_flights库(原始来源https://github.com/AWeirdDev/flights),用于其核心航班抓取功能。请参阅包含的LICENSE文件以了解其条款。find_all_flights_in_range工具可能会消耗大量资源,因为它检查了许多日期组合。