Skip to main content

Model Context Protocol (MCP) server for Apache Airflow API integration. Provides comprehensive tools for managing Airflow clusters including service operations, configuration management, status monitoring, and request tracking.

Project description

Model Context Protocol (MCP) server for Apache Airflow API integration.
This project provides natural language MCP tools for essential Airflow cluster operations.

Deploy to PyPI with tag

smithery badge


MCP-Airflow-API

Tested and supported Airflow version: 2.10.2 (API Version: v1)

Features

  • List all DAGs in the Airflow cluster
  • Monitor running/failed DAG runs
  • Trigger DAG runs on demand
  • Minimal, LLM-friendly output for all tools
  • Easy integration with MCP Inspector, OpenWebUI, Smithery, etc.

Available MCP Tools

DAG Management

  • list_dags
    Returns all DAGs registered in the Airflow cluster.
    Output: dag_id, dag_display_name, is_active, is_paused, owners, tags

  • running_dags
    Returns all currently running DAG runs.
    Output: dag_id, run_id, state, execution_date, start_date, end_date

  • failed_dags
    Returns all recently failed DAG runs.
    Output: dag_id, run_id, state, execution_date, start_date, end_date

  • trigger_dag(dag_id)
    Immediately triggers the specified DAG.
    Output: dag_id, run_id, state, execution_date, start_date, end_date

  • pause_dag(dag_id)
    Pauses the specified DAG (prevents scheduling new runs).
    Output: dag_id, is_paused

  • unpause_dag(dag_id)
    Unpauses the specified DAG (allows scheduling new runs).
    Output: dag_id, is_paused

DAG Analysis & Monitoring

  • dag_details(dag_id)
    Retrieves comprehensive details for a specific DAG.
    Output: dag_id, description, schedule_interval, owners, tags, start_date, next_dagrun, etc.

  • dag_graph(dag_id)
    Retrieves task dependency graph structure for a specific DAG.
    Output: dag_id, tasks, dependencies, task relationships

  • dag_code(dag_id)
    Retrieves the source code for a specific DAG.
    Output: dag_id, file_token, source_code

  • dag_event_log(dag_id, limit=20)
    Retrieves event log entries for a specific DAG.
    Output: dag_id, events, execution history, state changes

  • dag_run_duration(dag_id, limit=10)
    Retrieves run duration statistics for a specific DAG.
    Output: dag_id, runs, duration analysis, success/failure stats

  • dag_task_duration(dag_id, run_id=None)
    Retrieves task duration information for a specific DAG run.
    Output: dag_id, run_id, tasks, individual task performance

  • dag_calendar(dag_id, start_date=None, end_date=None)
    Retrieves calendar/schedule information for a specific DAG.
    Output: dag_id, schedule_interval, runs, upcoming executions


Prompt Template

The package exposes a tool get_prompt_template that returns either the entire template, a specific section, or just the headings. Three MCP prompts (prompt_template_full, prompt_template_headings, prompt_template_section) are also registered for discovery.

MCP Prompts

For easier discoverability in MCP clients (so prompts/list is not empty), the server now registers three prompts:

prompt_template_full – returns the full canonical template
prompt_template_headings – returns only the section headings
prompt_template_section – takes a section argument (number or keyword) and returns that section

You can still use the get_prompt_template tool for programmatic access or when you prefer tool invocation over prompt retrieval.

Single canonical English prompt template guides safe and efficient tool selection.

Files: • Packaged: src/mcp_airflow_api/prompt_template.md (distributed with PyPI)
• (Optional workspace root copy PROMPT_TEMPLATE.md may exist for editing; packaged copy is the one loaded at runtime.)

Retrieve dynamically via MCP tool: • get_prompt_template() – full template
get_prompt_template("tool map") – only the tool mapping section
get_prompt_template("3") – section 3 (tool map)
get_prompt_template(mode="headings") – list all section headings

Policy: Only English is stored; LLM는 사용자 질의 언어와 무관하게 영어 지침을 내부 추론용으로 사용하고, 사용자 응답은 필요 시 다국어로 생성한다.


Main Tool Files

  • MCP tool definitions: src/mcp_airflow_api/airflow_api.py
  • Utility functions: src/mcp_airflow_api/functions.py

How To Use

  1. In your MCP Tools environment, configure mcp-config.json as follows:
{
	"mcpServers": {
		"airflow-api": {
			"command": "uvx",
			"args": ["--python", "3.11", "mcp-airflow-api"],
			"env": {
				"AIRFLOW_API_URL": "http://localhost:38080/api/v1",
				"AIRFLOW_API_USERNAME": "airflow",
				"AIRFLOW_API_PASSWORD": "airflow",
				"AIRFLOW_LOG_LEVEL": "INFO"
			}
		}
	}
}
  1. Register the MCP server in MCP Inspector, OpenWebUI, Smithery, etc. and use the tools.

QuickStart (Demo): Running MCP-Airflow-API with Docker

  1. Prepare an Airflow cluster

  2. Prepare MCP Tools environment

    • Install Docker and Docker Compose
    • Clone this project and run docker-compose up -d in the root directory
  3. Register the MCP server in MCP Inspector/Smithery

    • Example address: http://localhost:8000/airflow-api

Logging & Observability

  • Structured logs for all tool invocations and HTTP requests
  • Control log level via environment variable (AIRFLOW_LOG_LEVEL) or CLI flag (--log-level)
  • Supported levels: DEBUG, INFO, WARNING, ERROR, CRITICAL

License

This project is licensed under the MIT License.


Roadmap

This project starts with a minimal set of essential Airflow management tools. Many more useful features and tools for Airflow cluster operations will be added soon, including advanced monitoring, DAG/task analytics, scheduling controls, and more. Contributions and suggestions are welcome!


Additional Links

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mcp_airflow_api-0.2.0.tar.gz (12.9 kB view details)

Uploaded Source

Built Distribution

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

mcp_airflow_api-0.2.0-py3-none-any.whl (12.4 kB view details)

Uploaded Python 3

File details

Details for the file mcp_airflow_api-0.2.0.tar.gz.

File metadata

  • Download URL: mcp_airflow_api-0.2.0.tar.gz
  • Upload date:
  • Size: 12.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for mcp_airflow_api-0.2.0.tar.gz
Algorithm Hash digest
SHA256 8a63f29db4630c803a7cff3ea821ed39a022382f7aecd76b57b06a0803fed47f
MD5 d6b383e4119bc9876a7214273094215a
BLAKE2b-256 8972441fe6fdfceb9ab922a266b5d2d4b1b1c9a9eb39b6300a282faed9ae51ea

See more details on using hashes here.

Provenance

The following attestation bundles were made for mcp_airflow_api-0.2.0.tar.gz:

Publisher: pypi-publish.yml on call518/MCP-Airflow-API

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

File details

Details for the file mcp_airflow_api-0.2.0-py3-none-any.whl.

File metadata

File hashes

Hashes for mcp_airflow_api-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e575a7acb423feb6dd663c141e692e3eae42add4ecf97b9ca4d3b6de5a383ce0
MD5 2d88f4305fe525dded83b9837aa260c6
BLAKE2b-256 b443e64aee60159712da5d15698659286244f779f6a38bb7ed7230e8caf499c9

See more details on using hashes here.

Provenance

The following attestation bundles were made for mcp_airflow_api-0.2.0-py3-none-any.whl:

Publisher: pypi-publish.yml on call518/MCP-Airflow-API

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

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page