Skip to main content
Glama
airflow-mcp-server

airflow-mcp-server

by us-all

@us-all/airflow-mcp

Airflow MCP 服务器 — 读取 DAG、运行记录、任务实例、日志尾部;触发和清除(写入受限)。基于 @us-all/mcp-toolkit 构建。

一个专注于 Airflow 稳定版 REST API 的 MCP。默认只读;airflow-trigger-dag 和 airflow-clear-task 受 AIRFLOW_ALLOW_WRITE=true 限制。

如需更深入的 dbt 集成(清单解析、运行结果历史、源新鲜度、每列测试覆盖率、血缘关系遍历、自定义数据质量结果表),请同时安装配套的 @us-all/dbt-mcp。

  • 7 个 airflow + meta 类别的工具

  • 2 个用于 DAG 分诊工作流的 MCP 提示词

  • 1 个聚合工具,替代 list-runs → get-task-instances 的组合操作

安装

pnpm add -D @us-all/airflow-mcp

Related MCP server: Apache Airflow MCP Server

运行

AIRFLOW_API_URL=http://airflow.example.com:8080/api/v1 \
AIRFLOW_USERNAME=admin AIRFLOW_PASSWORD=... \
npx @us-all/airflow-mcp

该服务器使用 MCP stdio 通信;将其连接到 Claude Desktop / Cursor / 任何 MCP 客户端。设置 MCP_TRANSPORT=http 以启用可流式传输的 HTTP 传输(Bearer 认证,/health 端点)。

工具

airflow (6 + 1 个聚合工具)

工具

描述

airflow-list-dags

列出带有标签/搜索过滤器的活跃 DAG

airflow-list-runs

单个 DAG 的近期运行记录(状态过滤,按最新排序)

airflow-get-task-instances

特定 DAG 运行的任务实例

airflow-get-task-logs

获取单个任务实例日志的尾部(最后 N kB)

airflow-trigger-dag

触发新的运行(写入受限)

airflow-clear-task

清除特定任务实例 → 重新运行(写入受限)

dag-health-rollup

聚合 DAG 健康状况:成功率 + 平均持续时间 + 最后一次失败运行 + 失败任务

meta

search-tools — 自然语言工具发现。

提示词

提示词

使用场景

dag-failure-triage

“为什么 DAG X 失败了?” — 拉取运行记录、定位失败原因、导出日志、提出修复建议

dag-schedule-audit

“扫描所有 DAG 的低成功率和卡住的运行记录”

环境变量

环境变量

必需

说明

AIRFLOW_API_URL

是

Airflow REST API 基础地址,例如 http://airflow.example.com:8080/api/v1

AIRFLOW_USERNAME

否

基本认证用户名

AIRFLOW_PASSWORD

否

基本认证密码(密钥)

AIRFLOW_ALLOW_WRITE

否

true 启用 airflow-trigger-dag / airflow-clear-task

AIRFLOW_TOOLS / AIRFLOW_DISABLE

否

类别开关

测试过的架构

  • Airflow 稳定版 REST API (2.x)。Airflow 3.x 通过 /api/v1/ 稳定端点暴露了相同的接口,因此该服务器适用于 2.x 和 3.x 部署。

配套服务器

如需 dbt 工件解析、运行结果历史和数据质量结果表,请同时安装 @us-all/dbt-mcp。

构建

pnpm install
pnpm run build      # tsc → dist/
pnpm test           # vitest
pnpm run smoke      # spawns dist/index.js, calls initialize + tools/list (set env first)

许可证

MIT — 参见 LICENSE。

Available Tools

8 tools
airflow-clear-taskA

Clear specific task instances in an Airflow DAG run (re-run them); supports include_upstream / include_downstream. Write-gated by AIRFLOW_ALLOW_WRITE.

Inputs: dagId (required), dagRunId (required), taskIds (required), includeDownstream, +1 more.

airflow-get-task-instancesB

List task instances for a specific Airflow DAG run with state, try_number, duration

Inputs: dagId (required), dagRunId (required), extractFields.

airflow-get-task-logsB

Fetch the tail (last N kB) of an Airflow task instance log for a specific try_number

Inputs: dagId (required), dagRunId (required), taskId (required), tryNumber, +2 more.

airflow-list-dagsB

List Airflow DAGs (active by default) with optional tag filter and dag_id substring search

Inputs: onlyActive, tag, search, limit, +1 more.

airflow-list-runsA

List recent runs of one Airflow DAG, optionally filtered by state, ordered newest first

Inputs: dagId (required), state, limit, extractFields.

airflow-trigger-dagA

Trigger a new Airflow DAG run with optional conf payload and note. Write-gated by AIRFLOW_ALLOW_WRITE.

Inputs: dagId (required), dagRunId, conf, note, +1 more.

dag-health-rollupA

Aggregated DAG health: success-rate over the last N runs + count breakdown (succeeded/failed/queued) + average duration + last-failed-run id + (optional) failing task instances. Replaces the airflow-list-runs + airflow-get-task-instances combo for 'is this DAG healthy right now?'.

Inputs: dagId (required), recentRuns, includeFailingTasks, extractFields.

search-toolsA

Discover available Airflow MCP tools by natural language query.

Inputs: query (required), category, limit.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A3.6/5.0

    Scored across 8 tools

    Disambiguation4/5

    Each tool maps to a distinct resource/action: DAGs, runs, task instances, logs, aggregate health, and tool discovery. dag-health-rollup and airflow-list-runs could overlap for health questions, but the description explicitly positions the rollup as the higher-level replacement, so ambiguity remains low.

    Naming Consistency3/5

    Most tools follow the airflow-<verb>-<object> pattern (airflow-list-dags, airflow-trigger-dag, airflow-clear-task, airflow-list-runs, airflow-get-task-instances, airflow-get-task-logs), but dag-health-rollup and search-tools break both the airflow- prefix and the verb-noun convention. There is also minor inconsistency between 'list' and 'get' for similar retrieval operations.

    Tool Count5/5

    Eight tools is well-scoped for an Airflow operations server. Each tool covers a meaningful operation without redundancy or bloat.

    Completeness4/5

    The set covers the core operational workflow: discover DAGs, trigger runs, inspect runs/task instances/logs, clear tasks, and get an aggregated health rollup. Minor gaps like pause/unpause DAGs or fetching DAG details exist, but they do not break the primary monitoring and troubleshooting use case.

    Maintenance

    ActivityInactive
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      A
      quality
      C
      maintenance
      Enables inspection and management of Apache Airflow DAGs, runs, and logs across multiple instances. It provides tools for monitoring workflows and performing gated write operations like triggering DAGs or clearing task instances.
      16
      73 PyPI
      2
      Apache 2.0
    • A
      license
      Not graded
      quality
      Not graded
      maintenance
      An MCP server that wraps the Apache Airflow REST API, enabling clients to manage DAGs, monitor task instances, and handle workflows through a standardized interface. It provides comprehensive access to Airflow features including DAG runs, variables, connections, and XComs.
      MIT