
Incident Response MCP for Apache Airflow
io.github.madamakPublished by GitHub account madamakv1.0.2Updated Oct 24, 2026
Diagnose Airflow failures from UI links with bounded logs and optional recovery actions.
Overview
Lets an assistant diagnose failed Apache Airflow DAG runs from UI links, pull bounded task logs, and optionally trigger or clear runs.
- What you can do
- Connects an MCP client to one or more Apache Airflow deployments and resolves Airflow UI URLs into instance, DAG, run, and task identifiers. Read tools list DAGs and runs, inspect task instances and attempts, and fetch task logs with level filtering, tailing, context lines, and byte caps sized for LLM context windows. Write tools can trigger a DAG, clear task instances or a whole run (dry_run by default), and pause or unpause DAGs. Every response carries a request_id for log correlation.
- When to use it
- Use it when an alert or PagerDuty/Datadog message contains an Airflow UI link and you want an agent to explain why a run failed and what the smallest recovery action is. It suits teams running Airflow 2 or 3 who want log triage and controlled recovery operations from an MCP client. It is not for mixed Airflow 2 and 3 instances in one process.
- Requirements
- Local process run with uvx from the PyPI package apache-airflow-mcp-server, with the matching apache-airflow-client pinned (for example 3.3.0 for Airflow 3.3, 2.10.0 for Airflow 2.11). Needs AIRFLOW_MCP_HOST (Airflow base URL) and either AIRFLOW_MCP_USERNAME plus AIRFLOW_MCP_PASSWORD or AIRFLOW_MCP_TOKEN. Optional: AIRFLOW_MCP_API_VERSION, AIRFLOW_MCP_READ_ONLY, AIRFLOW_MCP_INSTANCES_FILE, AIRFLOW_MCP_VERIFY_SSL. Network access to the Airflow instance is required.
Installation
In SourceWeft
- Open Incident Response MCP for Apache Airflow in the dashboard and add it to a workspace.
- Enable the server for the chats that should use its tools.
Desktop only via STDIO. STDIO servers start a local process, so they need the SourceWeft desktop host.
Other MCP clients
Follow the launch instructions in the repository.
README
Apache Airflow MCP Server
[MCP] [PyPI] [Python] [Airflow] [CI] [Security] [License] [Ruff]
Independent community project; not affiliated with or endorsed by the Apache Software Foundation.
Published through PyPI, GHCR, and the official MCP Registry. Reproducible scan reports, dependency audits, SBOMs, and provenance are attached to each immutable release.
Connect Claude, Cursor, VS Code, or another MCP client to your Apache Airflow deployments and help agents diagnose failed DAGs.
Paste an Airflow UI link from a PagerDuty/Datadog alert and ask "why did this fail?" — the agent resolves the URL, finds the failed tasks, pulls log errors filtered and bounded before the MCP response, and can re-trigger or clear runs. Write tools carry destructive-operation annotations that MCP clients can use to request confirmation.
Highlights
- 🔍 Incident-response first — resolve Airflow UI URLs straight to the failing task, filter logs by error level with context lines, follow
try_numbersemantics correctly (sensors included) - 🏢 Multi-instance — one server for same-API-family dev/staging/prod targets, with per-instance credentials and an SSRF guard that rejects unknown hosts
- 🔒 Safety controls — opt-in read-only mode (
AIRFLOW_MCP_READ_ONLY=true) that never registers write tools; write tools annotated as destructive; configured credentials are redacted from instance responses and operation logs - 📉 Token-efficient — log tailing, level filtering, byte caps, and truncation metadata designed for LLM context windows
- 🧭 Airflow 2 and 3 — API v1/v2 adapters with live E2E against Airflow 2.11 and 3.3, including JWT auth
- 📎 Traceable — every response carries a
request_idthat matches the structured server logs
Quickstart
1. Install
Airflow 2.11? Use
--with 'apache-airflow-client==2.10.0'instead; 2.10.0 is the final generated v1 client and targets Airflow 2's stable API. See Airflow compatibility before using a different release.
2. Connect your MCP client
The fastest path is a single instance configured entirely with environment variables — no config file needed.
Claude Code
Claude Desktop
Add to claude_desktop_config.json (Settings → Developer → Edit Config):
Cursor
Add to ~/.cursor/mcp.json:
VS Code (Copilot)
Add to .vscode/mcp.json:
Any client, over HTTP
Run the server yourself and point the client at the endpoint:
Health check: GET /health → 200 OK.
3. Ask your agent something
"Why did the latest run of
etl_pipelinefail?""https://airflow.example.com/dags/etl_pipeline/grid — what happened here, and is it safe to clear?"
"Show the failed task's error context and tell me the smallest recovery action."
Airflow compatibility
The server talks to Airflow through the generated apache-airflow-client.
For Airflow 3, match the client release to your Airflow release: generated
models can change within a major version, and a newer client is not guaranteed
to deserialize an older server's responses correctly. Airflow 2.11 uses the
final v1 client release, 2.10.0, against Airflow 2's stable API.
When api_version isn't set, the server assumes the API matching the installed
client (v1 for a 2.x client, v2 for 3.x). Set
AIRFLOW_MCP_API_VERSION (or api_version: in the registry) explicitly to
catch a major-version mismatch early.
One server process can currently load only one generated client major. All instances in a registry must therefore use the same API family; run separate MCP server processes for Airflow 2 and Airflow 3. Mixed-version support requires a future client-adapter change and is not advertised as working today.
Airflow 3 notes:
- Auth: bearer tokens are passed through as JWTs; basic credentials are automatically exchanged for a JWT via
POST /auth/tokenand refreshed periodically (AIRFLOW_MCP_TOKEN_REFRESH_SECONDS, default 3600 — keep it below your deployment's JWT expiry, and note there is no automatic re-auth on 401 yet). execution_dateordering maps tological_date, datasets map to assets, and UI links use the Airflow 3 route scheme. Tool names and the core workflow stay stable; documented fields and options can differ by API family.- Clear options that no longer exist in Airflow 3 (
include_subdags/include_parentdag, and theinclude_*/reset_dag_runsoptions ofairflow_clear_dag_run) are rejected withINVALID_INPUTrather than silently narrowing a destructive operation.
Both client families are exercised on relevant pull requests and main pushes. Bug reports from real Airflow deployments are very welcome!
Configuration
Single instance (env vars only)
* provide either username+password or a token.
Multiple instances (registry YAML)
Point AIRFLOW_MCP_INSTANCES_FILE at a YAML registry (it takes precedence over the single-instance env vars). Values may reference environment variables with ${VAR}:
Every tool accepts either an instance key (data-stg) or a ui_url — a full http(s) Airflow UI URL whose host is resolved against the registry, with unknown hosts rejected (SSRF guard). ui_url also auto-fills dag_id/dag_run_id/task_id when the link contains them. If both instance and ui_url are passed and disagree, the call fails with INSTANCE_MISMATCH rather than guessing.
Kubernetes tip: mount the registry from a Secret at /config/instances.yaml and set AIRFLOW_MCP_INSTANCES_FILE=/config/instances.yaml.
Server options
Read-only mode
The quickstarts set AIRFLOW_MCP_READ_ONLY=true: write tools (trigger, clear,
pause/unpause) are never registered. This prevents MCP mutations, but read tools
can still disclose sensitive logs, configuration, rendered fields, and DAG-run
data; use least-privilege Airflow credentials.
To enable recovery operations deliberately, set AIRFLOW_MCP_READ_ONLY=false.
Write tools then carry MCP destructiveHint annotations that clients can use
when deciding whether to request confirmation. Annotations are advisory, so do
not enable writes unless the Airflow credentials and MCP client's approval
behavior are appropriate for the target environment.
Tools
Discovery & URL utilities
Read
Write (annotated destructive so clients can require approval; hidden entirely in read-only mode)
Every success payload includes a request_id for log correlation; failures raise a structured ToolError with {code, message, request_id, context}.
The incident workflow
This is the flow the tools were designed around — going from an alert link to a diagnosis in four calls:
Log responses include truncated, auto_tailed (logs >100MB tail automatically), match_count, and byte/line stats so the agent knows exactly what it's looking at. Host-segmented logs are flattened with --- [worker-1] --- headers; Airflow 3 structured logs are rendered as plain lines.
Note on
try_number: reschedule-mode sensors could increment it on every reschedule through Airflow 2.9; Airflow 2.10+ no longer does. Always read it fromairflow_get_task_instancerather than guessing—the derivedretries_consumed/retries_remainingfields are heuristics.
Deployment
Docker
Or build locally with docker build -t airflow-mcp .
The release image contains the lockfile's Airflow 3.3 client and serves
streamable HTTP on :8765 (/mcp endpoint, /health for probes). The MCP HTTP
endpoint has no built-in caller authentication: keep it loopback-bound or place
it behind an authenticated private proxy. Mount a same-API-family registry YAML
for multi-instance setups. Airflow 2 deployments should use the pinned local
installation path above until a separate v1 image is published.
CI audits the exact image's installed Python dependencies and scans both the read-only and write-enabled MCP tool surfaces with a pinned Cisco MCP Scanner release's YARA analyzer. The security workflow fails on incomplete scans or any untriaged YARA finding. Starting with v1.0.1, release assets include the machine-readable scan reports, and release image manifests carry attached SBOM and provenance attestations covering their broader package inventory. These are automated checks, not a security certification or substitute for deployment-specific review.
FastMCP tooling
A fastmcp.json is included so FastMCP-aware tooling can auto-discover the entrypoint and deployment defaults.
Development
CI runs the unit suite against both apache-airflow-client families on Python 3.10–3.13. Relevant pull requests, main pushes, nightly runs, and releases also exercise live dockerized Airflow 2.11 and 3.3. See CONTRIBUTING.md for guidelines and AGENTS.md if you're pointing a coding agent at this repo (it's written for that).
Contributing
Issues and PRs are welcome — especially:
- Reports from real Airflow incident-response workflows and version combinations
- Bounded-log, diagnosis-safety, and URL-first workflow improvements
- Client setup recipes for more MCP hosts and deployment types
If this server saves you a debugging session, a ⭐ helps other Airflow teams find it.
License
Apache 2.0 — see LICENSE.
Apache Airflow and Airflow are registered trademarks of The Apache Software Foundation. This independent project is not affiliated with or endorsed by the ASF.
Source: README.md at commit 3262c41
Tools
0Version history
1- v1.0.2LatestSep 16, 2026
Score
50% of the applicable checks met
How complete this listing is, computed from the registry entry, the endpoint and public sources. Not a rating of the server and not a statement that it is safe or working today: reachability is a dated check, and no installs or reviews go into the score.
- Reached in the last 30 days25 pts
Keep the endpoint answering the MCP handshake; SourceWeft probes it every 30 days.
- Auth declared10 pts
Declare the credential headers in the registry entry, or keep the endpoint answering the probe so its auth can be classified.
- Tools listed15 pts
Answer tools/list without a credential, or ship a package that starts in a sandbox without one.
- DescriptionRequired15 pts
- Logo10 pts
- Documentation15 pts
- License10 pts