MCP HubMCP Hub
yangkyeongmo

mcp-server-apache-airflow

by: yangkyeongmo

mcp server apache airflow

25created 13/02/2025
Visit
airflow
apache

πŸ“ŒOverview

Purpose: The main objective of this framework is to provide a Model Context Protocol (MCP) server implementation for seamless integration with Apache Airflow and its clients.

Overview: This project encapsulates Apache Airflow's REST API, enabling MCP clients to interact with Airflow in a standardized manner. It leverages the official Apache Airflow client library to ensure optimal compatibility and maintainability.

Key Features:

  • Comprehensive API Coverage: Supports a wide range of endpoints for managing DAGs, DAG runs, tasks, variables, connections, pools, XComs, and more, allowing for full control over Airflow resources.

  • Health Monitoring and Configuration Management: Includes endpoints for health checks and configuration retrieval, aiding in effective system monitoring and management.


mcp-server-apache-airflow

A Model Context Protocol (MCP) server implementation for Apache Airflow, enabling seamless integration with MCP clients. This project provides a standardized way to interact with Apache Airflow through the Model Context Protocol.

About

This project implements a Model Context Protocol server that wraps Apache Airflow's REST API, allowing MCP clients to interact with Airflow in a standardized way. It uses the official Apache Airflow client library to ensure compatibility and maintainability.

Feature Implementation Status

FeatureAPI PathStatus
DAG Management
List DAGs/api/v1/dagsβœ…
Get DAG Details/api/v1/dags/{dag_id}βœ…
Pause DAG/api/v1/dags/{dag_id}βœ…
Unpause DAG/api/v1/dags/{dag_id}βœ…
Update DAG/api/v1/dags/{dag_id}βœ…
Delete DAG/api/v1/dags/{dag_id}βœ…
Get DAG Source/api/v1/dagSources/{file_token}βœ…
Patch Multiple DAGs/api/v1/dagsβœ…
Reparse DAG File/api/v1/dagSources/{file_token}/reparseβœ…
DAG Runs
List DAG Runs/api/v1/dags/{dag_id}/dagRunsβœ…
Create DAG Run/api/v1/dags/{dag_id}/dagRunsβœ…
Get DAG Run Details/api/v1/dags/{dag_id}/dagRuns/{dag_run_id}βœ…
Update DAG Run/api/v1/dags/{dag_id}/dagRuns/{dag_run_id}βœ…
Delete DAG Run/api/v1/dags/{dag_id}/dagRuns/{dag_run_id}βœ…
Get DAG Runs Batch/api/v1/dags/~/dagRuns/listβœ…
Clear DAG Run/api/v1/dags/{dag_id}/dagRuns/{dag_run_id}/clearβœ…
Set DAG Run Note/api/v1/dags/{dag_id}/dagRuns/{dag_run_id}/setNoteβœ…
Get Upstream Dataset Events/api/v1/dags/{dag_id}/dagRuns/{dag_run_id}/upstreamDatasetEventsβœ…
Tasks
List DAG Tasks/api/v1/dags/{dag_id}/tasksβœ…
Get Task Details/api/v1/dags/{dag_id}/tasks/{task_id}βœ…
Get Task Instance/api/v1/dags/{dag_id}/dagRuns/{dag_run_id}/taskInstances/{task_id}βœ…
List Task Instances/api/v1/dags/{dag_id}/dagRuns/{dag_run_id}/taskInstancesβœ…
Update Task Instance/api/v1/dags/{dag_id}/dagRuns/{dag_run_id}/taskInstances/{task_id}βœ…
Clear Task Instances/api/v1/dags/{dag_id}/clearTaskInstancesβœ…
Set Task Instances State/api/v1/dags/{dag_id}/updateTaskInstancesStateβœ…
Variables
List Variables/api/v1/variablesβœ…
Create Variable/api/v1/variablesβœ…
Get Variable/api/v1/variables/{variable_key}βœ…
Update Variable/api/v1/variables/{variable_key}βœ…
Delete Variable/api/v1/variables/{variable_key}βœ…
Connections
List Connections/api/v1/connectionsβœ…
Create Connection/api/v1/connectionsβœ…
Get Connection/api/v1/connections/{connection_id}βœ…
Update Connection/api/v1/connections/{connection_id}βœ…
Delete Connection/api/v1/connections/{connection_id}βœ…
Test Connection/api/v1/connections/testβœ…
Pools
List Pools/api/v1/poolsβœ…
Create Pool/api/v1/poolsβœ…
Get Pool/api/v1/pools/{pool_name}βœ…
Update Pool/api/v1/pools/{pool_name}βœ…
Delete Pool/api/v1/pools/{pool_name}βœ…
XComs
List XComs/api/v1/dags/{dag_id}/dagRuns/{dag_run_id}/taskInstances/{task_id}/xcomEntriesβœ…
Get XCom Entry/api/v1/dags/{dag_id}/dagRuns/{dag_run_id}/taskInstances/{task_id}/xcomEntries/{xcom_key}βœ…
Datasets
List Datasets/api/v1/datasetsβœ…
Get Dataset/api/v1/datasets/{uri}βœ…
Get Dataset Events/api/v1/datasetEventsβœ…
Create Dataset Event/api/v1/datasetEventsβœ…
Get DAG Dataset Queued Event/api/v1/dags/{dag_id}/dagRuns/queued/datasetEvents/{uri}βœ…
Get DAG Dataset Queued Events/api/v1/dags/{dag_id}/dagRuns/queued/datasetEventsβœ…
Delete DAG Dataset Queued Event/api/v1/dags/{dag_id}/dagRuns/queued/datasetEvents/{uri}βœ…
Delete DAG Dataset Queued Events/api/v1/dags/{dag_id}/dagRuns/queued/datasetEventsβœ…
Get Dataset Queued Events/api/v1/datasets/{uri}/dagRuns/queued/datasetEventsβœ…
Delete Dataset Queued Events/api/v1/datasets/{uri}/dagRuns/queued/datasetEventsβœ…
Monitoring
Get Health/api/v1/healthβœ…
DAG Stats
Get DAG Stats/api/v1/dags/statisticsβœ…
Config
Get Config/api/v1/configβœ…
Plugins
Get Plugins/api/v1/pluginsβœ…
Providers
List Providers/api/v1/providersβœ…
Event Logs
List Event Logs/api/v1/eventLogsβœ…
Get Event Log/api/v1/eventLogs/{event_log_id}βœ…
System
Get Import Errors/api/v1/importErrorsβœ…
Get Import Error Details/api/v1/importErrors/{import_error_id}βœ…
Get Health Status/api/v1/healthβœ…
Get Version/api/v1/versionβœ…

Setup

Dependencies

This project depends on the official Apache Airflow client library (apache-airflow-client). It will be automatically installed when you install this package.

Environment Variables

Set the following environment variables:

AIRFLOW_HOST=<your-airflow-host>
AIRFLOW_USERNAME=<your-airflow-username>
AIRFLOW_PASSWORD=<your-airflow-password>

Usage with Claude Desktop

Add to your claude_desktop_config.json:

{
  "mcpServers": {
    "mcp-server-apache-airflow": {
      "command": "uvx",
      "args": ["mcp-server-apache-airflow"],
      "env": {
        "AIRFLOW_HOST": "https://your-airflow-host",
        "AIRFLOW_USERNAME": "your-username",
        "AIRFLOW_PASSWORD": "your-password"
      }
    }
  }
}

Alternatively, using uv:

{
  "mcpServers": {
    "mcp-server-apache-airflow": {
      "command": "uv",
      "args": [
        "--directory",
        "/path/to/mcp-server-apache-airflow",
        "run",
        "mcp-server-apache-airflow"
      ],
      "env": {
        "AIRFLOW_HOST": "https://your-airflow-host",
        "AIRFLOW_USERNAME": "your-username",
        "AIRFLOW_PASSWORD": "your-password"
      }
    }
  }
}

Replace /path/to/mcp-server-apache-airflow with the actual path where you've cloned the repository.

Selecting the API groups

You can select the API groups you want to use by setting the --apis flag.

uv run mcp-server-apache-airflow --apis "dag,dagrun"

The default is to use all APIs.

Allowed values are:

  • config
  • connections
  • dag
  • dagrun
  • dagstats
  • dataset
  • eventlog
  • importerror
  • monitoring
  • plugin
  • pool
  • provider
  • taskinstance
  • variable
  • xcom

Manual Execution

You can also run the server manually:

make run

make run accepts the following options:

  • --port: Port to listen on for SSE (default: 8000)
  • --transport: Transport type (stdio/sse, default: stdio)

Or, you could run the SSE server directly, which accepts the same parameters:

make run-sse

Installing via Smithery

To install Apache Airflow MCP Server for Claude Desktop automatically via Smithery:

npx -y @smithery/cli install @yangkyeongmo/mcp-server-apache-airflow --client claude

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

MIT License