clear_dag_run
Clear a DAG run
Drive an Airflow deployment from your client: trigger and clear DAG runs, read the log of the try that actually failed, test a connection before a DAG depends on it, and set variables and pools without opening the web UI.
LABSCO SUMMARY
The surface follows the REST API closely, so what you can do is exactly what your Airflow account can do, and the destructive calls sit next to the reads with nothing in between. clear_task_instances and clear_dag_run both take dry_run, which is the difference between a plan and an action at three in the morning. Queued dataset events get their own reads and deletes at both levels, which matters only if you schedule on datasets rather than on cron.
A server over the Airflow REST API, 68 tools covering DAGs, DAG runs, task instances, XComs, datasets, connections, variables, pools and the instance's own health.
AIRFLOW_HOST pointing at an Airflow deployment reachable from wherever the server runs, plus AIRFLOW_USERNAME and AIRFLOW_PASSWORD (or an AIRFLOW_JWT_TOKEN instead) for an account whose role permits the calls you intend — delete_dag and delete_dag_run sit in the same tool list as the reads.
Add the configuration to your client
USE CASES
Find the run that failed, clear the affected task instances with a dry run first to see what the clear would touch, then set the states and move the run itself back to running.
List the import errors, read the one that names your file, check the source Airflow currently holds, and ask it to parse the file again once the fix is in place.
A retried task has more than one log. Read the instance to see how many tries there were, list them, then fetch the log for the try number you care about.
Try the connection details inline first, and only save them as a named connection once the test comes back clean.
When a dataset-scheduled DAG has not run, the question is whether the upstream event arrived and whether it is still sitting in the queue.
Counted once with only startup setup. Other versions, modes or optional credentials may expose a different list.
clear_dag_runClear a DAG run
clear_task_instancesClear a set of task instances
create_connectionCreate a connection
create_dataset_eventCreate dataset event
create_variableCreate a variable
delete_connectionDelete a connection by ID
delete_dagDelete a DAG
delete_dag_dataset_queued_eventDelete a queued Dataset event for a DAG
delete_dag_dataset_queued_eventsDelete queued Dataset events for a DAG
delete_dag_runDelete a DAG run by DAG ID and DAG run ID
delete_dataset_queued_eventsDelete queued Dataset events for a Dataset
delete_poolDelete a pool
delete_variableDelete a variable by key
fetch_dagsFetch all DAGs
get_configGet current configuration
get_connectionGet a connection by ID
get_dagGet a DAG by ID
get_dag_dataset_queued_eventGet a queued Dataset event for a DAG
get_dag_dataset_queued_eventsGet queued Dataset events for a DAG
get_dag_detailsGet a simplified representation of DAG
get_dag_runGet a DAG run by DAG ID and DAG run ID
get_dag_runsGet DAG runs by ID
get_dag_runs_batchList DAG runs (batch)
get_dag_sourceGet a source code
get_dag_statsGet DAG stats
get_dag_tasksGet tasks for DAG
get_datasetGet a dataset by URI
get_dataset_eventsGet dataset events
get_dataset_queued_eventsGet queued Dataset events for a Dataset
get_datasetsList datasets
get_event_logGet a specific log entry by ID
get_event_logsList log entries from event log
get_healthGet instance status
get_import_errorGet a specific import error by ID
get_import_errorsList import errors
get_logGet the log from a task instance by DAG ID, task ID, DAG run ID and task try number
get_pluginsGet a list of loaded plugins
get_poolGet a pool by name
get_poolsList pools
get_providersGet a list of loaded providers
get_taskGet a task by ID
get_task_instanceGet a task instance by DAG ID, task ID, and DAG run ID
get_tasksGet tasks for DAG
get_upstream_dataset_eventsGet dataset events for a DAG run
get_valueGet a specific option from configuration
get_variableGet a variable by key
get_versionGet version information
get_xcom_entriesGet all XCom entries
get_xcom_entryGet an XCom entry
list_connectionsList all connections
list_task_instance_triesList task instance tries by DAG ID, DAG run ID, and task ID
list_task_instancesList task instances by DAG ID and DAG run ID
list_variablesList all variables
patch_dagUpdate a DAG
patch_dagsUpdate multiple DAGs
patch_poolUpdate a pool
pause_dagPause a DAG by ID
post_dag_runTrigger a DAG by ID
post_poolCreate a pool
reparse_dag_fileRequest re-parsing of a DAG file
set_dag_run_noteUpdate the DagRun note
set_task_instances_stateSet a state of task instances
test_connectionTest a connection
unpause_dagUnpause a DAG by ID
update_connectionUpdate a connection by ID
update_dag_run_stateUpdate a DAG run state by DAG ID and DAG run ID
update_task_instanceUpdate a task instance by DAG ID, DAG run ID, and task ID
update_variableUpdate a variable by key
BEFORE YOU INSTALL
68 tools when we connected. --read-only (READ_ONLY=true) exposes only read tools, and --apis selects among 15 API groups, so the recommended read-only setup shows far fewer.
CONTEXT COST
Rated by the size of the 68 tool definitions that ride along on every turn, not by how many there are
INSTALLATION
{
"mcpServers": {
"mcp-server-apache-airflow": {
"command": "uvx",
"args": [
"mcp-server-apache-airflow"
],
"env": {
"AIRFLOW_HOST": "https://<YOUR_AIRFLOW_HOST>",
"AIRFLOW_USERNAME": "<YOUR_AIRFLOW_USERNAME>",
"AIRFLOW_PASSWORD": "<YOUR_AIRFLOW_PASSWORD>"
}
}
}
}This block signs in with a username and password. To use a JWT token instead, put "AIRFLOW_JWT_TOKEN": "<YOUR_AIRFLOW_JWT_TOKEN>" in env instead of AIRFLOW_USERNAME and AIRFLOW_PASSWORD; if both are set, the token takes precedence. AIRFLOW_HOST defaults to http://localhost:8080 when left out.