Skip to main content
Glama

mcp-flight-search

MCP 航班搜索

使用模型上下文协议 (MCP) 构建的航班搜索服务。此服务演示了如何实现 MCP 工具以实现航班搜索功能。

什么是模型上下文协议?

模型上下文协议 (MCP) 是由 Anthropic 开发的一项标准,它通过定义工具描述、调用和响应的结构化格式,使 AI 模型能够使用工具。该项目实现了可供 Claude 和其他兼容 MCP 的模型使用的 MCP 工具。

安装

# Install from PyPI pip install mcp-flight-search # Or install from the project directory (development mode) pip install -e .

用法

启动 MCP 服务器:

# Using the command-line entry point mcp-flight-search --connection_type http # Or run directly python main.py --connection_type http

您还可以指定自定义端口:

python main.py --connection_type http --port 5000

环境变量

将 SerpAPI 键设置为环境变量:

export SERP_API_KEY="your-api-key-here"

特征

  • 符合 MCP 的航班搜索功能工具
  • 与 SerpAPI Google Flights 集成
  • 支持单程和往返航班
  • 具有结构化输出的丰富日志记录
  • 模块化、可维护的代码结构

MCP 工具

该包提供了以下模型上下文协议工具:

  • search_flights_tool :使用以下参数搜索机场之间的航班:
    • origin :出发机场代码(例如,ATL、JFK)
    • destination :到达机场代码(例如,LAX,ORD)
    • outbound_date :出发日期(YYYY-MM-DD)
    • return_date :往返行程的可选返回日期 (YYYY-MM-DD)
  • server_status :检查 MCP 服务器是否正在运行

项目结构

mcp-flight-search/ ├── mcp_flight_search/ │ ├── __init__.py # Package initialization and exports │ ├── config.py # Configuration variables (API keys) │ ├── models/ │ │ ├── __init__.py # Models package init │ │ └── schemas.py # Pydantic models (FlightInfo) │ ├── services/ │ │ ├── __init__.py # Services package init │ │ ├── search_service.py # Main flight search logic │ │ └── serpapi_client.py # SerpAPI client wrapper │ ├── utils/ │ │ ├── __init__.py # Utils package init │ │ └── logging.py # Logging configuration │ └── server.py # MCP server setup and tool registration ├── main.py # Main entry point ├── pyproject.toml # Python packaging configuration ├── LICENSE # MIT License └── README.md # Project documentation

作者

有关 AI/ML 和生成式 AI 的更多文章,请在 Medium 上关注我: https://medium.com/@arjun-prabhulal

执照

该项目根据 MIT 许可证获得许可 - 有关详细信息,请参阅 LICENSE 文件。

-
security - not tested
A
license - permissive license
-
quality - not tested

remote-capable server

The server can be hosted and run remotely because it primarily relies on remote services or has no dependency on the local environment.

模型上下文协议服务器使用简单的提示搜索任意给定日期的多个航班承运商、价格、经停点、持续时间的实时航班详情

  1. 什么是模型上下文协议?
    1. 安装
      1. 用法
        1. 环境变量
          1. 特征
            1. MCP 工具
              1. 项目结构
                1. 作者
                  1. 执照

                    Related MCP Servers

                    • A
                      security
                      A
                      license
                      A
                      quality
                      A Model Context Protocol server enabling product searches across e-commerce platforms, price history tracking, and product specification-based searches using natural language prompts.
                      Last updated -
                      8
                      10
                      Python
                      MIT License
                    • -
                      security
                      F
                      license
                      -
                      quality
                      A Model Context Protocol server that integrates with Brave Search API to provide real-time search capabilities through Server-Sent Events (SSE).
                      Last updated -
                      TypeScript
                    • A
                      security
                      A
                      license
                      A
                      quality
                      A Model Context Protocol (MCP) server that provides real-time flight tracking and status information using the AviationStack API.
                      Last updated -
                      3
                      0
                      2
                      JavaScript
                      MIT License
                      • Apple
                    • -
                      security
                      A
                      license
                      -
                      quality
                      A Model Context Protocol server that provides real-time access to Hong Kong's KMB and Long Win Bus route information and arrival times, enabling Language Models to answer user questions about bus routes, stops, and ETAs.
                      Last updated -
                      3
                      Python
                      Apache 2.0
                      • Linux
                      • Apple

                    View all related MCP servers

                    MCP directory API

                    We provide all the information about MCP servers via our MCP API.

                    curl -X GET 'https://glama.ai/api/mcp/v1/servers/arjunprabhulal/mcp-flight-search'

                    If you have feedback or need assistance with the MCP directory API, please join our Discord server