mcp-server-apache-airflow
by: yangkyeongmo
mcp server apache airflow
π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
| Feature | API Path | Status |
|---|---|---|
| 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
