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.
Metadata
Release files for iflow-mcp_mcp-flight-search 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| iflow_mcp_mcp_flight_search-0.2.0.tar.gz | 7.6 kB | Without provenance | Details for iflow_mcp_mcp_flight_search-0.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| iflow_mcp_mcp_flight_search-0.2.0-py3-none-any.whl | Python 3 | none | any | Details for iflow_mcp_mcp_flight_search-0.2.0-py3-none-any.whl |
Total release size: 18.2 kB
Release files / iflow_mcp_mcp_flight_search-0.2.0.tar.gz
| Download URL | iflow_mcp_mcp_flight_search-0.2.0.tar.gz |
|---|---|
| Size | 7.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a738861c3336ef1b23748e4d5f6d3f2fbc531f1058fcd96a93cb0472e36588a9
|
|
BLAKE2b-256 checksum How to use checksums |
f20da12da59c298dfc67a3072b1a8209786b9db62c1d10edfcde9796c2e1639b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.9.8
|
Release files / iflow_mcp_mcp_flight_search-0.2.0-py3-none-any.whl
| Download URL | iflow_mcp_mcp_flight_search-0.2.0-py3-none-any.whl |
|---|---|
| Size | 10.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
0dd4ead2719e61122a40dbb9562ba9d9b26c93fe52b6acab23a27d6daabd8992
|
|
BLAKE2b-256 checksum How to use checksums |
8a72fc28b206f9ed84b7480ff9d3c2fa10d66a61ac3ff4891db1578cc22ba708
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.9.8
|
Security for iflow-mcp_mcp-flight-search 0.2.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.