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.

Metadata

Release files for aviationstack-mcp-server 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for aviationstack-mcp-server 0.1.1
File Size Uploaded Provenance Actions
aviationstack_mcp_server-0.1.1.tar.gz 22.3 kB With provenance Details for aviationstack_mcp_server-0.1.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for aviationstack-mcp-server 0.1.1
File Interpreter ABI Platform Actions
aviationstack_mcp_server-0.1.1-py3-none-any.whl Python 3 none any Details for aviationstack_mcp_server-0.1.1-py3-none-any.whl

Total release size: 64.7 kB

Release files / aviationstack_mcp_server-0.1.1.tar.gz

Download URL aviationstack_mcp_server-0.1.1.tar.gz
Size 22.3 kB
Tags Source
SHA-256 checksum
How to use checksums
7077eb8b416230cdc8f7db648cbcb0b174dc6d71c62f075962b85299224325ef
BLAKE2b-256 checksum
How to use checksums
6da63cbb7c1a46d9433b7dd713319d60041251ff60bc668e04ac9c9d1455576c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 10, 2026.

Transparency log

Release files / aviationstack_mcp_server-0.1.1-py3-none-any.whl

Download URL aviationstack_mcp_server-0.1.1-py3-none-any.whl
Size 42.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6981a043cf4844fd89cf1410e5984ab45669c22d530cb5f487fe7aacf8a57137
BLAKE2b-256 checksum
How to use checksums
0a31d4c73aa84fe9c42e4aa98d12bc2276ee6e1fbbdf381799c28905a7affc15
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 10, 2026.

Transparency log

Security for aviationstack-mcp-server 0.1.1

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.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for aviationstack_mcp_server-0.1.1.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 10, 2026.

Transparency log

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.

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files Full provenance

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