Skip to main content
Glama
airflow-mcp

airflow-mcp

by omar-massfih

airflow-mcp

A Python 3.12 MCP server for the Airflow 3 public API. FastMCP 4.2.6 generates a curated set of tools from the official OpenAPI spec for the deployed Airflow release. Tests exercise the generated interface against the 3.3.2 and 3.4.0 specifications.

The default tools are read-only and cover DAGs, DAG runs, tasks, task instances (including mapped tasks), logs, import errors, health, and version. List limits are 1–100, with pagination and upstream filters available.

Deployments can opt into writes by adding their operation IDs to AIRFLOW_MCP_OPERATIONS, for example trigger_dag_run, patch_dag, or post_clear_task_instances. Clearing defaults to a dry run. Set dry_run=false to perform it. A specific run and only_failed=true are required, and past or future runs and running tasks cannot be included.

Run

Install uv, then:

uv sync --locked
export AIRFLOW_MCP_AIRFLOW_URL=https://airflow.example.com
uv run airflow-mcp

The server listens on port 8000, with stateless Streamable HTTP at /mcp and a separate /healthz. Optional settings are AIRFLOW_MCP_HOST, AIRFLOW_MCP_PORT and AIRFLOW_MCP_TIMEOUT_SECONDS (default 30). Configure the Airflow deployment's HTTPS root URL. See example configuration.

At startup, the server queries the deployment's public GET /api/v2/version endpoint and downloads the official OpenAPI spec for the reported release. Allow outbound HTTPS to raw.githubusercontent.com. Version discovery and spec download or validation errors prevent startup.

Set AIRFLOW_MCP_OPERATIONS to a JSON array of exact OpenAPI operation IDs to replace the default allowlist. Every configured ID must appear exactly once in the spec. FastMCP derives the tool names from those operation IDs.

Related MCP server: Apache Airflow MCP Server

Authenticate and call a tool

Obtain an Airflow API bearer token using your deployment's existing authentication flow. Configure your MCP client to send it in the Authorization: Bearer TOKEN header. The server forwards that token on each Airflow API request; Airflow validates it and enforces the caller's existing permissions. Token issuance and refresh are handled by your Airflow deployment and client.

For example, using FastMCP's Python client:

import asyncio
import os

from fastmcp import Client
from fastmcp.client.transports import StreamableHttpTransport


async def main():
    transport = StreamableHttpTransport(
        "http://localhost:8000/mcp",
        headers={"Authorization": f"Bearer {os.environ['AIRFLOW_API_TOKEN']}"},
    )
    async with Client(transport) as client:
        result = await client.call_tool("get_dags", {"limit": 10})
        print(result.data)


asyncio.run(main())

Credentials stay on individual requests. Shared client headers contain no tokens, and caller cookies are not forwarded. The server does not retry writes. Missing bearer credentials receive HTTP 401 at /mcp; upstream authentication and permission failures are reported to the tool caller with their HTTP status. Use HTTPS when hosting remotely. /healthz reports process health without accessing Airflow.

Container and releases

docker build -t airflow-mcp:local .
docker run --rm -p 8000:8000 \
  -e AIRFLOW_MCP_AIRFLOW_URL=https://airflow.example.com \
  airflow-mcp:local

The container runs as a non-root user and does not install Airflow. CI checks the server, builds its package and container, and publishes a multi-platform GHCR image on version tags. For example, v0.1.0 publishes ghcr.io/omar-massfih/airflow-mcp:0.1.0 after verification succeeds. PyPI publication is deferred.

Validate

uv run ruff check .
uv run ruff format --check .
uv run mypy
uv run pytest -q
uv build
docker build -t airflow-mcp:local .

See validation details for test coverage and live Airflow checks.

Application code is MIT licensed. The downloaded Apache Airflow specifications are Apache-2.0 licensed. Compatibility tests use the official Airflow 3.4.0 specification and the official Airflow 3.3.2 specification.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      A
      quality
      C
      maintenance
      Enables inspection and management of Apache Airflow DAGs, runs, and logs across multiple instances. It provides tools for monitoring workflows and performing gated write operations like triggering DAGs or clearing task instances.
      16
      72 PyPI
      2
      Apache 2.0
    • A
      license
      Not graded
      quality
      Not graded
      maintenance
      An MCP server that wraps the Apache Airflow REST API, enabling clients to manage DAGs, monitor task instances, and handle workflows through a standardized interface. It provides comprehensive access to Airflow features including DAG runs, variables, connections, and XComs.
      MIT