Amadeus MCP 服务器是社区开发的基于模型上下文协议(MCP)的服务器,集成了 Amadeus Flight Offers Search API。它通过自然语言接口提供航班搜索功能,适用于与 MCP 兼容的客户端,如 Claude Desktop。用户能借助此项目,利用大型语言模型(LLMs)和 Amadeus API 的能力,轻松搜索特定日期和地点间的航班选项。
pip install mcp-amadeus
from mcp_amadeus import AmadeusMCP
# 初始化 MCP 代理
mcp = AmadeusMCP()
# 搜索航班
response = mcp.search_flights(
origin="JFK",
destination="LHR",
departure_date="2025-06-15",
adults=1,
children=1
)
print(response)
[
{
"airline": "AA",
"departure_time": "2025-06-15T10:00:00",
"arrival_time": "2025-06-15T14:30:00",
"duration": "04:30",
"price": 500,
"currency": "USD"
},
...
]
可检索两个地点之间指定日期的航班选项。例如:"我正在寻找 2025 年 6 月 15 日从 JFK 到 LHR 的航班,带有一位成人和一位儿童。"
MCP 代理提供以下接口:
search_flights(origin, destination, departure_date, **options)calculate_price(flight_id, passengers)| 参数名 | 类型 | 是否必须 | 描述 | 示例值 |
|---|---|---|---|---|
| origin | string | 是 | 出发地 IATA 代码 | JFK |
| destination | string | 是 | 目的地 IATA 代码 | LHR |
| departure_date | string | 是 | 出发日期(YYYY - MM - DD) | 2025 - 06 - 15 |
| return_date | string | 否 | 回程日期(YYYY - MM - DD)。单程若未指定则视为往返。 | 2025 - 06 - 20 |
| adults | integer | 是 | 成人数(1 - 9)。默认值为 1 | 2 |
| children | integer | 否 | 儿童数(2 - 11)。最多总计 9 | 1 |
| infants | integer | 否 | 婴儿数(≤2)。最大数量与成人相同。 | 1 |
| travel_class | string | 否 | 舱位等级:ECONOMY, BUSINESS 等 | ECONOMY |
| non_stop | boolean | 否 | 如果为真,则仅显示直达航班,默认为 false | true |
| currency_code | string | 否 | 币种(ISO 4217,例如 USD) | EUR |
| max_price | integer | 否 | 每位旅客的最高价格 | 500 |
| max | integer | 否 | 最大航班数,默认值为 250 | 10 |
返回从 Amadeus 获取的 JSON 格式航班报价,包含航空公司、时间、持续时间和价格信息。
MIT License © 2025 donghyun-chae
⚠️ 重要提示
该项目是开源的,与 Amadeus IT Group 且未获得其认可。Amadeus® 是 Amadeus IT Group 的注册商标。