MikkoParkkola/trvl

GitHub: MikkoParkkola/trvl

一个免费的AI旅行助手MCP服务器,整合Google航班酒店与欧洲陆路交通,让AI助手直接帮你规划行程、比价和监控价格。

Stars: 0 | Forks: 0

[![Go Report Card](https://goreportcard.com/badge/github.com/MikkoParkkola/trvl)](https://goreportcard.com/report/github.com/MikkoParkkola/trvl) [![CI](https://static.pigsec.cn/wp-content/uploads/repos/2026/04/9ca8186da8004102.svg)](https://github.com/MikkoParkkola/trvl/actions/workflows/ci.yaml) [![Release](https://img.shields.io/github/v/release/MikkoParkkola/trvl)](https://github.com/MikkoParkkola/trvl/releases) [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) [![Go Reference](https://pkg.go.dev/badge/github.com/MikkoParkkola/trvl.svg)](https://pkg.go.dev/github.com/MikkoParkkola/trvl) [![MCP](https://img.shields.io/badge/MCP-2025--11--25-blue)](https://modelcontextprotocol.io) # trvl — 面向 AI 助手的旅行 MCP Server ![trvl demo](https://static.pigsec.cn/wp-content/uploads/repos/2026/04/356bf9b2a5004105.gif) ### 界面预览 trvl 是一个 [MCP server](https://modelcontextprotocol.io/) + CLI,它为 Claude、Cursor、Windsurf 以及任何兼容 MCP 的 AI 助手提供对 Google Flights、Google Hotels 和欧洲地面交通数据的直接访问。它能自动搜索、优化并应用旅行技巧 —— 无需 API 密钥,无需月费,无需爬虫。 ## 快速设置 (30 秒) ### 1. 安装 ``` # macOS / Linux curl -fsSL https://github.com/MikkoParkkola/trvl/releases/latest/download/trvl_$(uname -s | tr '[:upper:]' '[:lower:]')_$(uname -m | sed 's/x86_64/amd64/;s/aarch64/arm64/').tar.gz | tar xz -C /usr/local/bin trvl ```
更多安装选项 ``` # Homebrew brew install MikkoParkkola/tap/trvl # Go go install github.com/MikkoParkkola/trvl/cmd/trvl@latest # Docker docker run --rm ghcr.io/mikkoparkkola/trvl flights HEL NRT 2026-06-15 # 从源代码构建 git clone https://github.com/MikkoParkkola/trvl.git && cd trvl && make build ```
### 2. 连接到您的 AI 助手 **Claude Code:** ``` claude mcp add trvl --transport stdio -- trvl mcp ``` **Claude Desktop** — 添加到 `claude_desktop_config.json`: ``` { "mcpServers": { "trvl": { "command": "trvl", "args": ["mcp"] } } } ``` **Cursor / Windsurf / 其他 MCP 客户端** — 添加到您的 MCP 配置中: ``` { "mcpServers": { "trvl": { "command": "trvl", "args": ["mcp"] } } } ``` ### 3. (可选) 安装 Claude Code skills 该仓库包含 4 个技能文件,用于教导 Claude 如何最佳地使用 trvl。全局安装方法: ``` mkdir -p ~/.claude/skills for s in trvl; do curl -fsSL "https://raw.githubusercontent.com/MikkoParkkola/trvl/main/.claude/skills/$s.md" -o "$HOME/.claude/skills/$s.md" done ``` 现在 Claude 在每个项目中都知道 trvl —— 只需说“搜索航班”或“计划旅行”。 ### 4. 让您的 AI 进行搜索 就这样。您的 AI 助手现在拥有 15 个旅行工具可用。只需自然提问: - *“搜索 7 月 1 日从 JFK 到东京的航班,商务舱”* - *“查找巴黎 7 月 1 日至 5 日的酒店,至少 4 星”* - *“8 月份从赫尔辛基飞巴塞罗那,哪天最便宜?”* - *“这个周末从赫尔辛基可以廉价飞往哪里?”* - *“在巴塞罗那待一周需要多少钱 —— 包括机票和酒店?”* - *“我该什么时候飞往伦敦?查查 7 月 15 日前后的日期”* - *“计划一次旅行:赫尔辛基 -> 巴塞罗那 -> 罗马 -> 巴黎,最便宜路线”* - *“搜索 5 月 3 日从布拉格到克拉科夫的巴士”* - *“比较布拉格到维也纳的火车和巴士价格”* ## MCP 工具 | 工具 | 功能 | 示例 | |------|-------------|---------| | **search_flights** | 搜索特定日期的航班 | HEL -> NRT, 2026-06-15, 商务舱, 直飞 | | **search_dates** | 查找日期范围内最便宜的飞行日期 | HEL -> BCN, 2026 年 6 月至 8 月 | | **search_hotels** | 搜索任何城市的酒店 | 东京, 6 月 15-18 日, 4 星以上 | | **hotel_prices** | 比较来自 Google 的酒店价格(聚合自多个提供商) | | **hotel_reviews** | 获取特定酒店的评论 | 热门评论,按评分或时间排序 | | **destination_info** | 任何城市的旅行情报 | 东京:天气、安全、假期、货币 | | **calculate_trip_cost** | 估算总旅行成本(航班 + 酒店) | HEL -> BCN, 7 月 1-8 日, 2 位客人 | | **weekend_getaway** | 寻找便宜的周末目的地 | 7 月从 HEL 出发,预算 500 欧元 | | **suggest_dates** | 围绕目标日期的智能日期建议 | HEL -> BCN,7 月 15 日左右,+/- 7 天 | | **optimize_multi_city** | 寻找多城市旅行的最便宜路线 | HEL -> BCN, ROM, PAR -> HEL | | **nearby_places** | 寻找位置附近的兴趣点 | 酒店附近的餐厅、景点 | | **travel_guide** | 城市的 Wikivoyage 旅行指南 | 社区、交通方式、安全 | | **local_events** | 寻找您旅行日期期间的活动 | 音乐会、节日、展览 | | **search_ground** | 搜索巴士和火车(6 个提供商) | 布拉格 -> 维也纳, 5 月 3 日, 仅火车 | | **search_restaurants** | 查找位置附近的餐厅 (Google Maps) | 巴塞罗那,意大利菜 | ### MCP 协议功能 (v2025-11-25) | 功能 | 详情 | |---------|---------| | **结构化内容** | 类型化 JSON (`structuredContent`) 伴随人类可读的摘要 | | **内容注解** | `audience: ["user"]` 用于摘要,`audience: ["assistant"]` 用于数据 | | **输出模式** | 所有 15 个工具响应的完整 JSON Schema 验证 | | **提示词** | `plan-trip`, `find-cheapest-dates`, `compare-hotels`, `where-should-i-go` | | **资源** | 机场代码(50 个主要枢纽),航班/酒店使用指南 | | **引导** | 日期缺失时的交互式参数收集 | | **渐进式披露** | 每个响应中的后续搜索建议 | | **预订链接** | 结果中的直接 Google Flights/Hotels 链接 | ## trvl 对比 | 功能 | trvl | fli | Google Flights | Skyscanner | Kiwi | |---------|------|-----|---------------|------------|------| | 航班搜索 | ✅ | ✅ | ✅ | ✅ | ✅ | | 巴士/火车搜索 | ✅ (6 个提供商: FlixBus, RegioJet, Eurostar, DB, SNCF, Transitous) | ❌ | ❌ | ❌ | ❌ | | 价格追踪 | ✅ (监控并提醒) | ❌ | ❌ | ❌ | ❌ | | 酒店搜索 | ✅ | ❌ | ❌ | ❌ | ❌ | | 酒店评论 | ✅ | ❌ | ❌ | ❌ | ❌ | | 旅行成本计算器 | ✅ | ❌ | ❌ | ❌ | ❌ | | 探索目的地 | ✅ | ❌ | ✅ (仅网页) | ✅ (网页) | ✅ | | 多城市优化器 | ✅ | ❌ | ❌ | ❌ | ⚠️ (1.7★) | | 目地情报 | ✅ | ❌ | ❌ | ❌ | ❌ | | 旅行技巧 (自动应用) | ✅ | ❌ | ❌ | ❌ | ❌ | | MCP server | ✅ | ✅ | ❌ | ❌ | ❌ | | 个人资料 | ✅ | ❌ | ❌ | ❌ | ❌ | | CLI | ✅ | ✅ | ❌ | ❌ | ❌ | | 无需 API 密钥 | ✅ | ✅ | N/A | N/A | N/A | | 单一二进制文件 | ✅ (Go) | ❌ (Python) | N/A | N/A | N/A | ### mcp-gateway 集成 ``` backends: trvl: transport: stdio command: trvl mcp ``` ## 面向 AI 助手 将您的 AI 指向此 URL 以进行自动设置: ``` https://raw.githubusercontent.com/MikkoParkkola/trvl/main/AGENTS.md ``` 或快速参考: ``` https://raw.githubusercontent.com/MikkoParkkola/trvl/main/llms.txt ``` ## CLI 用法 trvl 也可作为具有 19 个命令的独立 CLI 工具使用: ### 航班 ``` $ trvl flights HEL NRT 2026-06-15 Found 86 flights (one_way) | Price | Duration | Stops | Route | Airline | Departs | +----------+----------+---------+--------------------------+-----------------------+------------------+ | EUR 603 | 24h 20m | 2 stops | HEL -> CPH -> AUH -> NRT | Scandinavian Airlines | 2026-06-15T06:10 | | EUR 656 | 24h 10m | 2 stops | HEL -> CPH -> AUH -> NRT | Finnair | 2026-06-15T06:20 | | EUR 875 | 31h 20m | 1 stop | HEL -> IST -> NRT | Turkish Airlines | 2026-06-15T19:35 | ``` ``` trvl flights JFK LHR 2026-07-01 --cabin business --stops nonstop trvl flights HEL BCN 2026-07-01 --return 2026-07-08 trvl flights HEL NRT 2026-06-15 --format json # JSON output ``` ### 最便宜日期 ``` trvl dates HEL NRT --from 2026-06-01 --to 2026-06-30 trvl dates HEL BCN --from 2026-07-01 --to 2026-08-31 --duration 7 --round-trip ``` ### 酒店 ``` $ trvl hotels "Tokyo" --checkin 2026-06-15 --checkout 2026-06-18 Found 20 hotels: | Name | Stars | Rating | Reviews | Price | +-----------------------------------+-------+--------+---------+---------+ | HOTEL MYSTAYS PREMIER Omori | 4 | 4.1 | 2059 | 150 EUR | | Hotel JAL City Tokyo Toyosu | 4 | 4.2 | 1080 | 89 EUR | ``` ``` trvl hotels "Paris" --checkin 2026-07-01 --checkout 2026-07-05 --stars 4 --sort rating trvl prices "" --checkin 2026-06-15 --checkout 2026-06-18 ``` ### 探索目的地 ``` trvl explore HEL # Cheapest destinations from Helsinki trvl explore JFK --from 2026-07-01 --to 2026-07-14 # With dates ``` ### 价格网格 ``` trvl grid HEL NRT --depart-from 2026-07-01 --depart-to 2026-07-07 \ --return-from 2026-07-08 --return-to 2026-07-14 ``` ### 目的地信息 ``` trvl destination "Tokyo" # Weather, safety, holidays, currency trvl destination "Barcelona" --dates 2026-07-01,2026-07-08 ``` ### 旅行成本 ``` trvl trip-cost HEL BCN --depart 2026-07-01 --return 2026-07-08 --guests 2 ``` ### 周末度假 ``` trvl weekend HEL --month july-2026 # Top 10 cheapest weekends trvl weekend HEL --month july-2026 --budget 500 # Under EUR 500 total ``` ### 智能日期建议 ``` trvl suggest HEL BCN --around 2026-07-15 --flex 7 # Best dates +/- 7 days ``` ### 多城市优化器 ``` trvl multi-city HEL --visit BCN,ROM,PAR --dates 2026-07-01,2026-07-21 ``` ### 巴士和火车 并行搜索 6 个提供商:FlixBus (巴士,泛欧), RegioJet (巴士+火车, CZ/SK/AT/HU/DE/PL), Eurostar/Snap (火车, 伦敦↔巴黎/布鲁塞尔/阿姆斯特丹/科隆), Deutsche Bahn (火车, 所有欧洲铁路), SNCF (火车, 法国 TGV/TER), 和 Transitous.org ( transit routing, 泛欧)。 ``` trvl ground Prague Vienna 2026-07-01 # All 6 providers trvl ground London Paris 2026-07-01 # Eurostar + FlixBus + DB trvl bus Prague Krakow 2026-07-01 # Same command, bus alias trvl train Prague Vienna 2026-07-01 --type train # Trains only trvl ground Prague Vienna 2026-07-01 --provider regiojet # RegioJet only trvl ground Paris Lyon 2026-07-01 --provider sncf # SNCF TGV only trvl ground Prague Vienna 2026-07-01 --max-price 20 # Under EUR 20 ``` ### 价格监控 随时间追踪航班和酒店价格。当价格降至阈值以下时获取提醒。 ``` trvl watch add HEL BCN --depart 2026-07-01 --return 2026-07-08 --below 200 trvl watch list # Show all active watches trvl watch check # Check current prices trvl watch history # Price history for a watch trvl watch remove # Remove a watch ``` ## 工作原理 Google 的旅行前端使用一种称为 **batchexecute** 的内部 gRPC-over-HTTP 协议。`trvl` 原生使用此协议: 1. **Chrome TLS 指纹** — [utls](https://github.com/refraction-networking/utls) 模拟 Chrome 的精确 TLS ClientHello 2. **航班** — `FlightsFrontendService/GetShoppingResults` 带有编码的过滤数组 3. **酒店** — 从 `AF_initDataCallback` 块解析嵌入的 `TravelFrontendUi` JSON 4. **酒店价格** — `TravelFrontendUi/data/batchexecute`,rpcid 为 `yY52ce` 5. **探索** — `GetExploreDestinations` 用于目的地发现 6. **目的地信息** — 并行聚合 5 个免费 API (Open-Meteo, REST Countries, Nager.Date, travel-advisory.info, ExchangeRate-API) 7. **巴士** — FlixBus 公共 API (`global.api.flixbus.com`),带城市自动完成 + 搜索 8. **火车** — RegioJet 公共 API (`brn-ybus-pubapi.sa.cz`),带路线搜索 + 定价 9. **火车** — `site-api.eurostar.com/gateway` GraphQL,用于伦敦↔巴黎/布鲁塞尔/阿姆斯特丹/科隆 10. **火车** — DB Vendo API (`int.bahn.de/web/api`),用于所有欧洲铁路连接 11. **火车** — SNCF Connect API,用于法国 TGV、TER 和 Intercity 路线 12. **Transit (Transitous)** — `routing.spicebus.org` MOTIS2 API,用于泛欧 transit routing 13. **速率限制** — 10 请求/秒令牌桶,在 429/5xx 时指数退避 无 Selenium。无 Puppeteer。无浏览器。仅 HTTP。 ## 每个结果均可预订 每个航班和酒店结果都包含一个 `booking_url` —— 指向 Google Flights 或 Google Hotels 的直接链接,您可以在那里完成预订: ``` { "price": 113, "currency": "EUR", "airline": "Norwegian", "flight_number": "D8 2900", "booking_url": "https://www.google.com/travel/flights?q=Flights+to+BCN+from+HEL+on+2026-07-01" } ``` AI 使用这些链接为您提供可操作的建议:“在此预订:[链接]”。无需将航班号复制到另一个搜索引擎中。 ## 一览 | | | |---|---| | **二进制文件** | 单一静态 ~15MB 文件。零运行时依赖。 | | **数据** | 实时来自 7 个 Google 端点 + FlixBus + RegioJet + Eurostar + Deutsche Bahn + SNCF + Transitous + 11 个免费 API + Google Maps | | **认证** | 无需。可选的免费 API 密钥用于活动/餐厅评分。 | | **MCP** | 完整 v2025-11-25 — 15 个工具,4 个提示词,资源,结构化内容,采样 | | **CLI** | 19 个命令 (+ 5 个监控子命令),支持表格/JSON 输出,颜色,shell 补全 | | **预订链接** | 每个航班和酒店结果都包含直接的 Google 预订链接 | | **旅行技巧** | 自动应用 30 多种技巧:附近机场、弃程返程、酒店拆分 | | **个人资料** | 记住您的 FF 状态、行李需求、喜爱的酒店、出发偏好 | | **输出** | 彩色漂亮表格(默认)或 JSON (`--format json`) | | **平台** | Linux, macOS (amd64, arm64)。Windows CI 进行中。 | | **代码** | 128 个 Go 文件,约 37K 行代码,15 个包,980+ 测试 | | **许可证** | MIT | ## 致谢 建立在以下基础之上: - **[fli](https://github.com/punitarani/fli)** 作者 Punit Arani —— 原始的 Google Flights 逆向工程库 - **[utls](https://github.com/refraction-networking/utls)** —— Chrome TLS 指纹模拟 - **[icecreamsoft](https://icecreamsoft.hashnode.dev/building-a-web-app-for-travel-search)** —— Google Hotels batchexecute 文档 - **[SerpAPI](https://serpapi.com/google-hotels-api)** —— 酒店参数 ## 法律声明 `trvl` 访问 Google 面向公众的内部 API。它不会绕过身份验证、访问受保护的内容或规避速率限制。与 [fli](https://github.com/punitarani/fli) (1K+ stars, MIT 许可证) 的方法相同。 ## 许可证 [MIT](LICENSE)
标签:AI助手, Claude, CLI, Cursor, CVE检测, EVTX分析, Golang, Google Flights, Google Hotels, Go语言, MCP服务器, WiFi技术, Windsurf, 人工智能代理, 免费, 单文件二进制, 地面交通, 安全编程, 开源, 旅行攻略, 旅行规划, 旅行预定, 无需API密钥, 日志审计, 模型上下文协议, 欧洲交通, 程序破解, 自动化搜索, 行程优化, 谷歌航班, 谷歌酒店