PF

punitarani/fli

开发工具

本页由 AI 翻译,技术细节请以原文为准。 查看原文

3447 stars 417 forks 质量 82 趋势 60MIT

Google Flights MCP、CLI 和 Python 库

概览

一个强大的Python库,通过优雅的CLI界面,提供对Google Flights数据的程序化访问。搜索航班,找到最佳优惠,轻松筛选结果。 🚀 与其他依赖网页抓取的航班搜索库不同,Fli 通过逆向工程直接与 Google Flights 的 API 交互。这意味着:* :直接访问 API 意味着更快、更可靠的结果 * :无 HTML 解析,无浏览器自动化,纯粹的 API 交互 * :更不易因界面变化而出错 * :可扩展架构,便于定制和集成 :用你的实际用户名替换。你也可以通过在终端里运行哪个fli-mcp来找到通往MCP服务器的路径。

概述(AI 翻译)

一个强大的 Python 库,通过优雅的 CLI 界面,提供对 Google Flights 数据的程序访问。搜索 机票,寻找最佳优惠,轻松筛选结果。

🚀 [T0]]有什么特别之处? 与其他依赖网页抓取的航班搜索库不同,Fli 直接与 Google Flights 的 API 交互 通过逆向工程。 这意味着:

  • 快速:直接访问API意味着更快、更可靠的结果 ** 零抓取**:无HTML解析,无浏览器自动化,纯粹API交互
  • 可靠:界面更改不易出问题
  • 模块化:可扩展架构,便于定制和集成

MCP服务器

连接Claude桌面

注意:请将 替换为你的真实用户名。 你也可以通过在终端中运行which fli-mcp来找到通往MCP服务器的路径。

MCP工具可用

MCP 服务器提供两个主要工具:

工具 描述
search_flights 使用详细筛选器搜索特定日期的航班

本页由 AI 翻译,技术细节请以原文为准。

README

以下为原文 README 节选,完整内容请查看原文。

🛫 Fli - Flight Search MCP Server and Library

A powerful Python library that provides programmatic access to Google Flights data with an elegant CLI interface. Search flights, find the best deals, and filter results with ease.

🚀 What makes fli special? Unlike other flight search libraries that rely on web scraping, Fli directly interacts with Google Flights’ API through reverse engineering. This means:

  • Fast: Direct API access means faster, more reliable results
  • Zero Scraping: No HTML parsing, no browser automation, just pure API interaction
  • Reliable: Less prone to breaking from UI changes
  • Modular: Extensible architecture for easy customization and integration

MCP Server

pipx install flights

# Run the MCP server on STDIO
fli-mcp

# Run the MCP server over HTTP (streamable)
fli-mcp-http  # serves at http://127.0.0.1:8000/mcp/

Connecting to Claude Desktop

{
  "mcpServers": {
    "fli": {
      "command": "/Users//.local/bin/fli-mcp"
    }
  }
}

Note: Replace `` with your actual username. You can also find the path to the MCP server by running which fli-mcp in your terminal.

MCP Tools Available

The MCP server provides two main tools:

Tool Description
search_flights Search for flights on a specific date with detailed filters
search_dates Find the cheapest travel dates across a flexible date range

search_flights Parameters

Parameter Type Description
origin string Departure airport IATA code(s) — comma-separated for multi
destination string Arrival airport IATA code(s) — comma-separated for multi
departure_date string Travel date in YYYY-MM-DD format
return_date string Return date for round trips (optional)
cabin_class string ECONOMY, PREMIUM_ECONOMY, BUSINESS, or FIRST
max_stops string ANY, NON_STOP, ONE_STOP, or TWO_PLUS_STOPS
departure_window string Time window in ‘HH-HH’ format (e.g., ‘6-20’)
airlines list Filter by airline codes (e.g., [‘BA’, ‘AA’])
exclude_airlines list Airline IATA codes to exclude (e.g., [‘DL’, ‘B6’])
alliance list Restrict to alliances: ONEWORLD, SKYTEAM, STAR_ALLIANCE
在 GitHub 查看完整 README

安装

docker run --rm fli-dev make lint test-all
新手?先看 mcpskill.org 教程 →

配置

{ "mcpServers": { "fli": { "command": "/Users/<user>/.local/bin/fli-mcp" } } }