航班搜索MCP服务

一款通过 SerpApi 搜索 Google Flights 的 MCP 服务,支持按 IATA 机场代码查询单程和往返航班,返回价格、时长、经停和时刻等信息,适用于 Claude、Cursor 等 MCP 客户端中的机票查询与旅行规划。

  • by arjunprabhulal
  • Python
  • 本地部署
  • 44 星标
  • 更新于
在 GitHub 查看 arjunprabhulal/mcp-flight-search

使用说明

MCP Flight Search

An MCP server that searches Google Flights through SerpApi, for Claude, Cursor and other MCP clients. One-way and round-trip searches by IATA airport code, with prices, durations, stops and times.

Requirements

  • Python 3.10 or later (or uv)
  • A SerpApi key in SERP_API_KEY (serpapi.com has a free tier)

Use it from an MCP client

Add it to your client's MCP configuration (Claude Desktop, Claude Code, Cursor, ...):

{
  "mcpServers": {
    "flight-search": {
      "command": "uvx",
      "args": ["mcp-flight-search"],
      "env": { "SERP_API_KEY": "your-serpapi-key" }
    }
  }
}

Or install it with pip install mcp-flight-search and use "command": "mcp-flight-search".

Run it yourself

export SERP_API_KEY="your-serpapi-key"
mcp-flight-search                                    # stdio (default)
mcp-flight-search --connection_type http --port 3001 # Streamable HTTP at http://127.0.0.1:3001/mcp

LOG_LEVEL=DEBUG shows more detail on stderr. The API key is never logged.

With Docker:

docker build -t mcp-flight-search .
docker run -i --rm -e SERP_API_KEY=your-serpapi-key mcp-flight-search

Tools

Tool What it does
search_flights_tool Flights between two airports. origin, destination: IATA codes such as ATL, LAX. outbound_date: YYYY-MM-DD. return_date (optional): YYYY-MM-DD for a round trip. Returns structured results: airline, price (USD), duration, stops, departure, arrival, cabin class.
server_status Checks the server is running and reports its version.

Development

uv sync
uv run pytest
uv run ruff check .

License

MIT