Cover image
Try Now
2025-04-07

模型上下文协议(MCP)启用AI工具使用的MCP服务器实现 - 实时飞行搜索

3 years

Works with Finder

1

Github Watches

0

Github Forks

4

Github Stars

MCP Flight Search

A flight search service built with Model Context Protocol (MCP). This service demonstrates how to implement MCP tools for flight search capabilities.

What is Model Context Protocol?

The Model Context Protocol (MCP) is a standard developed by Anthropic that enables AI models to use tools by defining a structured format for tool descriptions, calls, and responses. This project implements MCP tools that can be used by Claude and other MCP-compatible models.

Installation

# Install from PyPI
pip install mcp-flight-search

# Or install from the project directory (development mode)
pip install -e .

Usage

Start the MCP server:

# Using the command-line entry point
mcp-flight-search --connection_type http

# Or run directly
python main.py --connection_type http

You can also specify a custom port:

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

Environment Variables

Set the SerpAPI key as an environment variable:

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

Features

  • MCP-compliant tools for flight search functionality
  • Integration with SerpAPI Google Flights
  • Support for one-way and round-trip flights
  • Rich logging with structured output
  • Modular, maintainable code structure

MCP Tools

This package provides the following Model Context Protocol tools:

  • search_flights_tool: Search for flights between airports with parameters:

    • origin: Departure airport code (e.g., ATL, JFK)
    • destination: Arrival airport code (e.g., LAX, ORD)
    • outbound_date: Departure date (YYYY-MM-DD)
    • return_date: Optional return date for round trips (YYYY-MM-DD)
  • server_status: Check if the MCP server is running

Project Structure

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

Author

For more articles on AI/ML and Generative AI, follow me on Medium: https://medium.com/@arjun-prabhulal

License

This project is licensed under the MIT License - see the LICENSE file for details.

相关推荐

  • Joshua Armstrong
  • Confidential guide on numerology and astrology, based of GG33 Public information

  • https://suefel.com
  • Latest advice and best practices for custom GPT development.

  • Alexandru Strujac
  • Efficient thumbnail creator for YouTube videos

  • Emmet Halm
  • Converts Figma frames into front-end code for various mobile frameworks.

  • Elijah Ng Shi Yi
  • Advanced software engineer GPT that excels through nailing the basics.

  • Lists Tailwind CSS classes in monospaced font

  • https://maiplestudio.com
  • Find Exhibitors, Speakers and more

  • lumpenspace
  • Take an adjectivised noun, and create images making it progressively more adjective!

  • https://appia.in
  • Siri Shortcut Finder – your go-to place for discovering amazing Siri Shortcuts with ease

  • Carlos Ferrin
  • Encuentra películas y series en plataformas de streaming.

  • Yusuf Emre Yeşilyurt
  • I find academic articles and books for research and literature reviews.

  • tomoyoshi hirata
  • Sony α7IIIマニュアルアシスタント

  • apappascs
  • 发现市场上最全面,最新的MCP服务器集合。该存储库充当集中式枢纽,提供了广泛的开源和专有MCP服务器目录,并提供功能,文档链接和贡献者。

  • ShrimpingIt
  • MCP系列GPIO Expander的基于Micropython I2C的操作,源自ADAFRUIT_MCP230XX

  • jae-jae
  • MCP服务器使用剧作《无头浏览器》获取网页内容。

  • HiveNexus
  • 一个适用于中小型团队的AI聊天机器人,支持DeepSeek,Open AI,Claude和Gemini等车型。 专为中小团队设计的ai聊天应用,支持deepSeek,打开ai,claude,双子座等模型。

  • ravitemer
  • 一个功能强大的Neovim插件,用于管理MCP(模型上下文协议)服务器

  • patruff
  • Ollama和MCP服务器之间的桥梁,使本地LLMS可以使用模型上下文协议工具

    Reviews

    3 (1)
    Avatar
    user_5Q5WZU1N
    2025-04-16

    mcp-flight-search is an incredible tool for anyone who frequently searches for flights. The intuitive interface and swift search capabilities make finding the best flight deals a breeze. With the backing of developer arjunprabhulal, this open-source project is reliable and continuously improving. Highly recommended for travel enthusiasts! Check it out at https://github.com/arjunprabhulal/mcp-flight-search.