Aviationstack MCP Server
An MCP server that gives AI assistants structured access to flight, airport, airline, aircraft, route, tax, and other aviation reference data from the Aviationstack API.
Features
- Search current and historical flight records.
- Search airports and airlines.
- Retrieve airport arrival and departure schedules.
- Browse aircraft types, airplanes, countries, and cities.
- Search routes and aviation taxes.
- Expose planning prompts and machine-readable MCP resources.
- Validate query input with typed Pydantic models.
- Return safe MCP-facing errors without leaking internal details.
Requirements
- Python 3.13 or newer for local development.
- An Aviationstack API key for live requests.
- An MCP-compatible client, such as Claude Desktop, Cursor, or another MCP host.
Installation
Run directly with uvx:
uvx aviationstack-mcp-server
Set your Aviationstack API key in the environment:
export AVIATIONSTACK_API_KEY="your-api-key"
The server reads the key when it starts. It does not require a local checkout or a manually managed virtual environment for normal MCP client use.
Configuration
The required setting is:
| Environment variable | Required | Default | Description |
|---|---|---|---|
AVIATIONSTACK_API_KEY |
Yes | None | API key used for Aviationstack requests. |
Optional settings include:
| Environment variable | Default | Description |
|---|---|---|
AVIATIONSTACK_BASE_URL |
https://api.aviationstack.com/v1 |
Aviationstack API base URL. |
ENVIRONMENT |
development |
Application environment: development, testing, staging, or production. |
LOG_LEVEL |
INFO |
Logging level, such as DEBUG, INFO, or WARNING. |
AVIATIONSTACK_CONNECT_TIMEOUT |
5.0 |
HTTP connection timeout in seconds. |
AVIATIONSTACK_READ_TIMEOUT |
30.0 |
HTTP read timeout in seconds. |
AVIATIONSTACK_WRITE_TIMEOUT |
30.0 |
HTTP write timeout in seconds. |
AVIATIONSTACK_POOL_TIMEOUT |
5.0 |
HTTP connection-pool timeout in seconds. |
AVIATIONSTACK_RETRY_MAX_ATTEMPTS |
3 |
Maximum number of HTTP attempts. |
AVIATIONSTACK_RETRY_BACKOFF_FACTOR |
0.5 |
Exponential retry backoff factor. |
For local development, create a .env file in the repository root. Do not
commit it:
AVIATIONSTACK_API_KEY=your-api-key
MCP Client Configuration
Add the server to an MCP client using the uvx command:
{
"mcpServers": {
"aviationstack": {
"command": "uvx",
"args": [
"aviationstack-mcp-server"
],
"env": {
"AVIATIONSTACK_API_KEY": "your-api-key"
}
}
}
}
The exact location of this configuration depends on the MCP client. Keep the API key in the client's environment configuration rather than putting it in tool arguments or prompts.
Available Tools
Every tool accepts a structured query object. Unless noted otherwise,
limit defaults to 10 and must be between 1 and 100. IATA codes are
normalized to uppercase by the server.
| Tool | Description | Parameters |
|---|---|---|
search_flights |
Search current scheduled flight records. | airline_name (optional string); airline_iata (optional 2-3 character code); flight_iata (optional string); flight_icao (optional string); departure_iata (optional 3-character code); arrival_iata (optional 3-character code); limit (optional integer, 1-100). |
search_historical_flights |
Search historical flight records for a specific date. | flight_date (required YYYY-MM-DD date); airline_iata (optional 2-3 character code); departure_iata (optional 3-character code); arrival_iata (optional 3-character code); limit (optional integer, 1-100). |
get_flight_schedule |
Retrieve airport arrival or departure schedules. | airport_iata (required 3-character code); schedule_type (required arrival or departure); airline_name (optional string); limit (optional integer, 1-100). |
search_airports |
Search airport records by name, city, or other text. | search (optional string); limit (optional integer, 1-100, default 10); offset (optional integer, default 0). |
search_airlines |
Search airline records by name or other text. | search (optional string); limit (optional integer, 1-100, default 10); offset (optional integer, default 0). |
list_aircraft_types |
List aircraft type records. | limit (optional integer, 1-100, default 10). |
list_airplanes |
List individual airplane records. | limit (optional integer, 1-100, default 10). |
list_countries |
List country reference records. | limit (optional integer, 1-100, default 10). |
list_cities |
List city reference records. | limit (optional integer, 1-100, default 10). |
search_routes |
Search airline routes by airline and airports. | airline_iata (optional 2-3 character code); departure_iata (optional 3-character code); arrival_iata (optional 3-character code); limit (optional integer, 1-100, default 10); offset (optional integer, default 0). |
search_taxes |
Search aviation tax records. | search (optional string); limit (optional integer, 1-100, default 10); offset (optional integer, default 0). |
Examples of structured tool arguments:
{
"query": {
"departure_iata": "DEL",
"arrival_iata": "DXB",
"limit": 10
}
}
{
"query": {
"airport_iata": "LHR",
"schedule_type": "departure",
"limit": 20
}
}
Available Prompts
| Prompt | Arguments | Purpose |
|---|---|---|
plan_flight_search |
request (string) |
Translate a natural-language flight request into appropriate flight filters. |
plan_schedule_search |
airport (string), schedule_type (string, default departure) |
Plan an airport arrival or departure schedule lookup. |
plan_reference_data_search |
request (string) |
Choose and plan the appropriate reference-data lookup tool. |
Available Resources
| Resource URI | Description |
|---|---|
aviationstack://metadata/server |
Server identity, capabilities, and supported aviation domains. |
aviationstack://metadata/endpoints |
Aviationstack endpoint and operation mapping. |
aviationstack://documentation/tools |
Machine-readable documentation for the exposed tools. |
Development
Clone the repository and install the development environment with uv:
git clone https://github.com/raviagrawal121/aviationstack-mcp-server.git
cd aviationstack-mcp-server
uv sync
source .venv/bin/activate
Run the server locally after setting AVIATIONSTACK_API_KEY:
uv run aviationstack-mcp-server
Build the source distribution and wheel:
uv build
Testing
The default test suite is offline. MCP integration tests inject an in-memory Aviationstack client, so they do not require an API key or network access:
uv run pytest -m "not live_api and not capability_discovery"
To run only the MCP integration tests:
uv run pytest tests/integration/mcp
Lint the project with Ruff:
uv run ruff check .
Live API Testing
Live tests make real requests and require an Aviationstack API key:
export AVIATIONSTACK_API_KEY="your-api-key"
uv run pytest -m live_api
Capability discovery is opt-in and probes supported endpoint access for the configured account. It makes bounded requests against the live API:
AVIATIONSTACK_LIVE=1 uv run pytest -m capability_discovery -s
Run live tests only when network access and API quota are available. The results depend on the Aviationstack plan associated with the configured key.
Architecture
The server is organized into a small set of layers:
MCP client
|
MCP tools, prompts, and resources
|
Application context and domain services
|
Aviationstack API client and HTTP transport
|
Aviationstack REST API
src/aviationstack_mcp_server/mcp/registers the MCP surface and manages the application lifespan.src/aviationstack_mcp_server/services/contains domain operations for flights, airports, airlines, aircraft, and reference data.src/aviationstack_mcp_server/client/contains the API client, HTTP transport, retries, and client factory.src/aviationstack_mcp_server/models/contains typed response and query models.- Non-live MCP tests inject a fake client through
create_server(client_factory=...); production uses the default factory, which loadsSettingsand the API key.
Contributing
- Create a focused branch for your change.
- Add or update tests for behavior changes.
- Run the offline test suite and Ruff locally.
- Update the README when the public MCP surface changes.
- Open a pull request with a concise description of the change.
Please do not include API keys, .env files, build artifacts, or live API
responses containing sensitive data in commits or pull requests.
License
This project is licensed under the MIT License. See LICENSE.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file aviationstack_mcp_server-0.1.1.tar.gz.
File metadata
- Download URL: aviationstack_mcp_server-0.1.1.tar.gz
- Upload date:
- Size: 22.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7077eb8b416230cdc8f7db648cbcb0b174dc6d71c62f075962b85299224325ef
|
|
| MD5 |
c3887e79f08bb9cbb8a4ff105f895e0f
|
|
| BLAKE2b-256 |
6da63cbb7c1a46d9433b7dd713319d60041251ff60bc668e04ac9c9d1455576c
|
Provenance
The following attestation bundles were made for aviationstack_mcp_server-0.1.1.tar.gz:
Publisher:
publish-pypi.yml on raviagrawal121/aviationstack-mcp-server
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
aviationstack_mcp_server-0.1.1.tar.gz -
Subject digest:
7077eb8b416230cdc8f7db648cbcb0b174dc6d71c62f075962b85299224325ef - Sigstore transparency entry: 2780553767
- Sigstore integration time:
-
Permalink:
raviagrawal121/aviationstack-mcp-server@34345fd42f150f78ed85c9bd8cc8e1334ccc5875 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/raviagrawal121
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-pypi.yml@34345fd42f150f78ed85c9bd8cc8e1334ccc5875 -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file aviationstack_mcp_server-0.1.1-py3-none-any.whl.
File metadata
- Download URL: aviationstack_mcp_server-0.1.1-py3-none-any.whl
- Upload date:
- Size: 42.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6981a043cf4844fd89cf1410e5984ab45669c22d530cb5f487fe7aacf8a57137
|
|
| MD5 |
c5cd40b09c4487269ffb8de05847b663
|
|
| BLAKE2b-256 |
0a31d4c73aa84fe9c42e4aa98d12bc2276ee6e1fbbdf381799c28905a7affc15
|
Provenance
The following attestation bundles were made for aviationstack_mcp_server-0.1.1-py3-none-any.whl:
Publisher:
publish-pypi.yml on raviagrawal121/aviationstack-mcp-server
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
aviationstack_mcp_server-0.1.1-py3-none-any.whl -
Subject digest:
6981a043cf4844fd89cf1410e5984ab45669c22d530cb5f487fe7aacf8a57137 - Sigstore transparency entry: 2780553888
- Sigstore integration time:
-
Permalink:
raviagrawal121/aviationstack-mcp-server@34345fd42f150f78ed85c9bd8cc8e1334ccc5875 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/raviagrawal121
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-pypi.yml@34345fd42f150f78ed85c9bd8cc8e1334ccc5875 -
Trigger Event:
workflow_dispatch
-
Statement type: