内容
# 八爪鱼航班 MCP 服务器
免费、无需登录的 MCP 服务器,用于搜索和比较来自全球多个航空公司和预订平台的航班,价格实时更新。
**端点:**
```
https://mcp.octotrip.app/flights/mcp
```

## 相关链接
- [八爪鱼租车](https://github.com/octotrip/rental-cars) — 租车搜索 MCP 服务器
## 免责声明
八爪鱼免费使用。预订链接包含联盟属性 — 八爪鱼可能会在您无需额外支付的情况下赚取佣金。搜索结果按每个中转次数分组内的价格排序,而不是按联盟收益。
## 快速开始
将以下内容添加到您的 MCP 客户端配置中:
```json
{
"mcpServers": {
"octotrip-flights": {
"url": "https://mcp.octotrip.app/flights/mcp"
}
}
}
```
无需 API 密钥或登录。
## 工具:`search`
搜索给定旅行日期的起始地和目的地之间的实时航班优惠。支持单程和往返搜索,灵活的乘客人数和舱位等级。返回按价格排序的结果,按中转次数分组,显示来自多个航空公司和预订平台的最便宜选项。该工具实时查询外部航班聚合器 API,并包含联盟预订链接。它不预订航班、修改预订、向用户收费或存储用户数据。
### 参数
| 参数 | 类型 | 必需 | 默认值 | 描述 |
|---|---|---|---|---|
| `origin` | 字符串 | 是 | - | 出发城市、机场名称或 IATA 代码(例如“法兰克福”,“JFK”) |
| `destination` | 字符串 | 是 | - | 到达城市、机场名称或 IATA 代码 |
| `departure_date` | 字符串 | 是 | - | 出发日期(YYYY-MM-DD,DD.MM.YYYY 或自然语言) |
| `return_date` | 字符串 | 否 | - | 往返的返回日期。单程时省略 |
| `adults` | 整数 | 否 | `1` | 成年乘客人数(1-9) |
| `children` | 整数 | 否 | `0` | 2-11 岁儿童人数(0-9) |
| `infants` | 整数 | 否 | `0` | 2 岁以下婴儿人数(0-9) |
| `trip_class` | 字符串 | 否 | `"Y"` | 舱位等级:Y 为经济舱,C 为商务舱 |
| `currency` | 字符串 | 否 | `"EUR"` | ISO 4217 货币代码(EUR,USD,GBP 等) |
| `locale` | 字符串 | 否 | `"zh"` | 返回语言代码(zh,en 等) |
### 响应格式
结果按中转次数分组,每组显示最便宜的选项:
```json
{
"results": [
{
"airline": "汉莎航空",
"airline_code": "LH",
"alliance": "星空联盟",
"flight_numbers": ["LH120", "LH121"],
"is_direct": true,
"stops": 0,
"total_duration_minutes": 110,
"outbound": {
"departure": "FRA",
"arrival": "MUC",
"departure_time": "18:15",
"arrival_time": "19:10",
"departure_date": "2026-07-15",
"arrival_date": "2026-07-15",
"duration_minutes": 55,
"stops": 0,
"legs": [
{
"flight_number": "LH120",
"carrier": "汉莎航空",
"aircraft": "空客 A319",
"departure": "FRA",
"arrival": "MUC",
"departure_time": "18:15",
"arrival_time": "19:10",
"departure_date": "2026-07-15",
"arrival_date": "2026-07-15",
"duration_minutes": 55
}
]
},
"return": { ... },
"price": 292.39,
"currency": "EUR",
"baggage": "无托运行李,客舱行李:1 件",
"gate": "城市旅行",
"booking_url": "https://...",
"link_type": "affiliate",
"affiliate_disclosure": "此链接包含联盟属性。八爪鱼可能会在您无需额外支付的情况下赚取佣金。",
"tags": ["方便票", "直飞"]
}
],
"total": 6,
"total_available": 876,
"origin_resolved": { "iata": "FRA", "name": "法兰克福机场", "city": "法兰克福", "country_code": "DE" },
"destination_resolved": { "iata": "MUC", "name": "慕尼黑机场", "city": "慕尼黑", "country_code": "DE" },
"validity": "搜索结果和预订链接有效期约为 15 分钟。",
"query": { ... }
}
```
### 结果有效性
搜索结果和预订链接有效期约为 **15 分钟**。航班价格通过实时竞价过程确定,在此时间窗口后不保证价格。 如果用户想要预订,应尽快进行。对于过时的结果,请运行新的搜索。
### 错误响应
服务器返回带有建议的结构化错误:
- **`airport_not_found`** -- 机场无法解析。尝试使用 IATA 代码、城市名称或机场名称。
- **`disambiguation_needed`** -- 找到多个机场(例如“纽约”返回 JFK、LGA)。选择一个并重试。
- **`invalid_date`** -- 日期格式无法识别。使用 YYYY-MM-DD、DD.MM.YYYY 或类似格式。
- **`no_results`** -- 给定条件下无航班可用。尝试更改日期或附近的机场。
## 示例提示
- 帮我找到八月从纽约到伦敦的最便宜直飞航班
- 比较 7 月 15 日从法兰克福到慕尼黑的往返航班,返回日期为 7 月 22 日
- 我需要从 LAX 到东京的单程航班,下周五出发,经济舱
- 搜索 2 名成人和 1 名儿童 9 月 1 日从巴塞罗那到巴黎的航班
- 这个月从迪拜到新加坡的最便宜的商务舱航班是什么?
## 与 Claude Desktop 结合使用
添加到 `claude_desktop_config.json`:
```json
{
"mcpServers": {
"octotrip-flights": {
"url": "https://mcp.octotrip.app/flights/mcp"
}
}
}
```
## 与 Cursor / Windsurf 结合使用
添加到您的 MCP 设置:
```json
{
"mcpServers": {
"octotrip-flights": {
"url": "https://mcp.octotrip.app/flights/mcp"
}
}
}
```
## 与 Cline 结合使用
添加到您的 Cline MCP 设置:
```json
{
"mcpServers": {
"octotrip-flights": {
"url": "https://mcp.octotrip.app/flights/mcp"
}
}
}
```
## 与 Smithery 结合使用
通过 [Smithery](https://smithery.ai/servers/xltnapps/octotrip-flights) 安装:
```bash
npx -y @smithery/cli install xltnapps/octotrip-flights --client claude
```
## 协议示例
使用 curl 的完整 MCP 会话(初始化、列出工具、调用搜索):
```bash
# 1. 初始化
curl -s -X POST https://mcp.octotrip.app/flights/mcp \
-H "Content-Type: application/json" \
-H "Accept: application/json, text/event-stream" \
-d '{
"jsonrpc": "2.0", "id": 1, "method": "initialize",
"params": {
"protocolVersion": "2025-03-26",
"capabilities": {},
"clientInfo": {"name": "example", "version": "1.0"}
}
}'
# 2. 列出工具
curl -s -X POST https://mcp.octotrip.app/flights/mcp \
-H "Content-Type: application/json" \
-H "Accept: application/json, text/event-stream" \
-d '{"jsonrpc": "2.0", "id": 2, "method": "tools/list"}'
# 3. 搜索
curl -s -X POST https://mcp.octotrip.app/flights/mcp \
-H "Content-Type: application/json" \
-H "Accept: application/json, text/event-stream" \
-d '{
"jsonrpc": "2.0", "id": 3, "method": "tools/call",
"params": {
"name": "search",
"arguments": {
"origin": "FRA",
"destination": "BCN",
"departure_date": "2026-08-01"
}
}
}'
```
传输:无状态的可流式 HTTP。响应使用 `text/event-stream`(SSE)。无会话持久性或可恢复性。速率限制:1 次请求/秒,突发容量为 5。
## 隐私
此服务器不记录 IP 地址、搜索查询或任何用户可识别的数据。有关详细信息,请参阅 [PRIVACY.md](PRIVACY.md),其中包括示例日志条目。
## 安全
要报告漏洞,请参阅 [SECURITY.md](SECURITY.md)。
## 许可证
MIT