mcpField
F
flight-search

flight-search

github.com/olafs-world生产力6166 次安装37 周前更新
代码仓库

关于 flight-search

flight-search 是一个基于命令行的 Google Flights 搜索工具,供需要查询航班的用户使用。它无需 API 密钥,并可输出结构化 JSON 航班数据。

主要功能

  1. 01按机场代码搜索航班
  2. 02查询单程与往返行程
  3. 03设置乘客人数和舱位
  4. 04输出结构化 JSON 数据

适用场景

  1. 01比较不同航线的航班价格与时间
  2. 02查询指定日期的往返航班
  3. 03将航班结果用于后续数据处理

安装

复制下面的命令,在终端中运行。

$npx skills add https://github.com/olafs-world/flight-search --skill flight-search

安装后在 Claude Code 中输入/flight-search确认已加载。

包含的文件

除 SKILL.md 外,安装时一起下载的参考资料和脚本。

.gitignore
CHANGELOG.md
AGENTS.md
LICENSE
.python-version
README.md
pyproject.toml
pytest.ini
install.sh
uv.lock
.github/workflows/
ci.yml
flight_search/
search.py
__init__.py
cli.py
tests/
test_cli.py
__init__.py
test_search.py

详细介绍

航班搜索

从命令行搜索 Google Flights。获取价格、时间和航空公司信息——无需 API 密钥。

基于 fast-flights 构建。

快速开始

# one-off search (no install needed)
uvx flight-search DEN LAX --date 2026-03-01

# or install globally
uv tool install flight-search
flight-search JFK LHR --date 2026-06-15 --return 2026-06-22

选项

positional arguments:
  origin                Origin airport code (e.g., DEN, LAX, JFK)
  destination           Destination airport code

options:
  --date, -d            Departure date (YYYY-MM-DD) [required]
  --return, -r          Return date for round trips (YYYY-MM-DD)
  --adults, -a          Number of adults (default: 1)
  --children, -c        Number of children (default: 0)
  --class, -C           Seat class: economy, premium-economy, business, first
  --limit, -l           Max results (default: 10)
  --output, -o          Output format: text or json (default: text)

示例

# One-way flight
flight-search DEN LAX --date 2026-03-01

# Round trip with passengers
flight-search JFK LHR --date 2026-06-15 --return 2026-06-22 --adults 2

# Business class
flight-search SFO NRT --date 2026-04-01 --class business

# JSON output for parsing
flight-search ORD CDG --date 2026-05-01 --output json

输出示例

✈️  DEN → LAX
   One way · 2026-03-01
   Prices are currently: typical

──────────────────────────────────────────────────
   Frontier ⭐ BEST
   🕐 10:43 PM → 12:30 AM +1
   ⏱️  2 hr 47 min
   ✅ Nonstop
   💰 $84

──────────────────────────────────────────────────
   United ⭐ BEST
   🕐 5:33 PM → 7:13 PM
   ⏱️  2 hr 40 min
   ✅ Nonstop
   💰 $139

JSON 输出

返回结构化数据:

{
  "origin": "DEN",
  "destination": "LAX",
  "date": "2026-03-01",
  "current_price": "typical",
  "flights": [
    {
      "airline": "Frontier",
      "departure_time": "10:43 PM",
      "arrival_time": "12:30 AM",
      "duration": "2 hr 47 min",
      "stops": 0,
      "price": 84,
      "is_best": true
    }
  ]
}

链接

评论

支持 Markdown