Skip to main content

Aviationstack MCP Server

CI PyPI Python License

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 loads Settings and the API key.

Contributing

  1. Create a focused branch for your change.
  2. Add or update tests for behavior changes.
  3. Run the offline test suite and Ruff locally.
  4. Update the README when the public MCP surface changes.
  5. 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

aviationstack_mcp_server-0.1.1.tar.gz (22.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

aviationstack_mcp_server-0.1.1-py3-none-any.whl (42.4 kB view details)

Uploaded Python 3

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

Hashes for aviationstack_mcp_server-0.1.1.tar.gz
Algorithm Hash digest
SHA256 7077eb8b416230cdc8f7db648cbcb0b174dc6d71c62f075962b85299224325ef
MD5 c3887e79f08bb9cbb8a4ff105f895e0f
BLAKE2b-256 6da63cbb7c1a46d9433b7dd713319d60041251ff60bc668e04ac9c9d1455576c

See more details on using hashes here.

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

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file aviationstack_mcp_server-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for aviationstack_mcp_server-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 6981a043cf4844fd89cf1410e5984ab45669c22d530cb5f487fe7aacf8a57137
MD5 c5cd40b09c4487269ffb8de05847b663
BLAKE2b-256 0a31d4c73aa84fe9c42e4aa98d12bc2276ee6e1fbbdf381799c28905a7affc15

See more details on using hashes here.

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

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 files

0.1.0

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page