
Airflow MCP Server
โ 168from yangkyeongmo
MCP server for Airflow
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} | โ |
| Get Task Instance Log | /api/v1/dags/{dag_id}/dagRuns/{dag_run_id}/taskInstances/{task_id}/logs/{task_try_number} | โ |
| Clear Task Instances | /api/v1/dags/{dag_id}/clearTaskInstances | โ |
| Set Task Instances State | /api/v1/dags/{dag_id}/updateTaskInstancesState | โ |
| List Task Instance Tries | /api/v1/dags/{dag_id}/dagRuns/{dag_run_id}/taskInstances/{task_id}/tries | โ |
| 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 | โ |
Development
Setting up Development Environment
- Clone the repository:
git clone https://github.com/yangkyeongmo/mcp-server-apache-airflow.git
cd mcp-server-apache-airflow- Install development dependencies:
uv sync --dev- Create a
.envfile for environment variables (optional for development):
touch .envNote: No environment variables are required for running tests. The
AIRFLOW_HOSTdefaults tohttp://localhost:8080for development and testing purposes.
Running Tests
The project uses pytest for testing with the following commands available:
# Run all tests
make testCode Quality
# Run linting
make lint
# Run code formatting
make formatContinuous Integration
The project includes a GitHub Actions workflow (.github/workflows/test.yml) that automatically:
- Runs tests on Python 3.10, 3.11, and 3.12
- Executes linting checks using ruff
- Runs on every push and pull request to
mainbranch
The CI pipeline ensures code quality and compatibility across supported Python versions before any changes are merged.
uv run mcp-server-apache-airflow --apis dag --apis dagrunBefore it works, you'll need: AIRFLOW_HOSTAIRFLOW_USERNAMEAIRFLOW_PASSWORD
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> # Optional, defaults to http://localhost:8080
AIRFLOW_API_VERSION=v1 # Optional, defaults to v1
READ_ONLY=true # Optional, enables read-only mode (true/false, defaults to false)Authentication
Choose one of the following authentication methods:
Basic Authentication (default):
AIRFLOW_USERNAME=<your-airflow-username>
AIRFLOW_PASSWORD=<your-airflow-password>JWT Token Authentication:
AIRFLOW_JWT_TOKEN=<your-jwt-token>To obtain a JWT token, you can use Airflow's authentication endpoint:
ENDPOINT_URL="http://localhost:8080" # Replace with your Airflow endpoint
curl -X 'POST' \
"${ENDPOINT_URL}/auth/token" \
-H 'Content-Type: application/json' \
-d '{ "username": "<your-username>", "password": "<your-password>" }'Note: If both JWT token and basic authentication credentials are provided, JWT token takes precedence.
Usage with Claude Desktop
Add to your claude_desktop_config.json:
Basic Authentication:
{
"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"
}
}
}
}JWT Token Authentication:
{
"mcpServers": {
"mcp-server-apache-airflow": {
"command": "uvx",
"args": ["mcp-server-apache-airflow"],
"env": {
"AIRFLOW_HOST": "https://your-airflow-host",
"AIRFLOW_JWT_TOKEN": "your-jwt-token"
}
}
}
}For read-only mode (recommended for safety):
Basic Authentication:
{
"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",
"READ_ONLY": "true"
}
}
}
}JWT Token Authentication:
{
"mcpServers": {
"mcp-server-apache-airflow": {
"command": "uvx",
"args": ["mcp-server-apache-airflow", "--read-only"],
"env": {
"AIRFLOW_HOST": "https://your-airflow-host",
"AIRFLOW_JWT_TOKEN": "your-jwt-token"
}
}
}
}Alternative configuration using uv:
Basic Authentication:
{
"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"
}
}
}
}JWT Token Authentication:
{
"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_JWT_TOKEN": "your-jwt-token"
}
}
}
}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 --apis dagrunThe default is to use all APIs.
Allowed values are:
- config
- connections
- dag
- dagrun
- dagstats
- dataset
- eventlog
- importerror
- monitoring
- plugin
- pool
- provider
- taskinstance
- variable
- xcom
Read-Only Mode
You can run the server in read-only mode by using the --read-only flag or by setting the READ_ONLY=true environment variable. This will only expose tools that perform read operations (GET requests) and exclude any tools that create, update, or delete resources.
Using the command-line flag:
uv run mcp-server-apache-airflow --read-onlyUsing the environment variable:
READ_ONLY=true uv run mcp-server-apache-airflowIn read-only mode, the server will only expose tools like:
- Listing DAGs, DAG runs, tasks, variables, connections, etc.
- Getting details of specific resources
- Reading configurations and monitoring information
- Testing connections (non-destructive)
Write operations like creating, updating, deleting DAGs, variables, connections, triggering DAG runs, etc. will not be available in read-only mode.
You can combine read-only mode with API group selection:
uv run mcp-server-apache-airflow --read-only --apis dag --apis variableManual Execution
You can also run the server manually:
make runmake run accepts following options:
Options:
--port: Port to listen on for SSE (default: 8000)--transport: Transport type (stdio/sse/http, default: stdio)
Or, you could run the sse server directly, which accepts same parameters:
make run-sseAlso, you could start service directly using uv like in the following command:
uv run src --transport http --port 8080Installing 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 claudeNo common issues documented yet. If you hit a problem, the repository's GitHub Issues page is the best place to look.
Licensed under MITโ you can use, modify, and redistribute it under that license's terms.
