MCP Server for Apache Airflow

MCP Server for Apache Airflow

为 MCP 客户端提供了一种与 Apache Airflow REST API 交互的标准化方式,支持 DAG 管理和监控 Airflow 系统健康等操作。

监控
操作系统自动化
访问服务器

Tools

list_dags

Lists all DAGs in the Airflow instance

get_dag

Get details of a specific DAG

unpause_dag

Unpause a DAG

pause_dag

Pause a DAG

trigger_dag

Trigger a DAG run

get_dag_runs

Get DAG runs for a specific DAG

get_dag_tasks

Get tasks for a specific DAG

get_task_instance

Get details of a specific task instance

list_task_instances

List all task instances for a specific DAG run

get_import_error

Get details of a specific import error

list_import_errors

List all import errors

get_health

Get the health status of the Airflow instance

get_version

Get the version information of the Airflow instance

README

mcp-server-apache-airflow

smithery badge

一个用于 Apache Airflow 的模型上下文协议 (MCP) 服务器实现,能够与 MCP 客户端无缝集成。此项目提供了一种通过模型上下文协议与 Apache Airflow 交互的标准化方式。

<a href="https://glama.ai/mcp/servers/e99b6vx9lw"> <img width="380" height="200" src="https://glama.ai/mcp/servers/e99b6vx9lw/badge" alt="Server for Apache Airflow MCP server" /> </a>

关于

此项目实现了一个 模型上下文协议 服务器,它封装了 Apache Airflow 的 REST API,允许 MCP 客户端以标准化的方式与 Airflow 交互。它使用官方的 Apache Airflow 客户端库,以确保兼容性和可维护性。

功能实现状态

功能 API 路径 状态
DAG 管理
列出 DAG /api/v1/dags
获取 DAG 详情 /api/v1/dags/{dag_id}
暂停 DAG /api/v1/dags/{dag_id}
恢复 DAG /api/v1/dags/{dag_id}
更新 DAG /api/v1/dags/{dag_id}
删除 DAG /api/v1/dags/{dag_id}
获取 DAG 源码 /api/v1/dagSources/{file_token}
批量修改 DAG /api/v1/dags
重新解析 DAG 文件 /api/v1/dagSources/{file_token}/reparse
DAG 运行
列出 DAG 运行 /api/v1/dags/{dag_id}/dagRuns
创建 DAG 运行 /api/v1/dags/{dag_id}/dagRuns
获取 DAG 运行详情 /api/v1/dags/{dag_id}/dagRuns/{dag_run_id}
更新 DAG 运行 /api/v1/dags/{dag_id}/dagRuns/{dag_run_id}
删除 DAG 运行 /api/v1/dags/{dag_id}/dagRuns/{dag_run_id}
批量获取 DAG 运行 /api/v1/dags/~/dagRuns/list
清除 DAG 运行 /api/v1/dags/{dag_id}/dagRuns/{dag_run_id}/clear
设置 DAG 运行备注 /api/v1/dags/{dag_id}/dagRuns/{dag_run_id}/setNote
获取上游数据集事件 /api/v1/dags/{dag_id}/dagRuns/{dag_run_id}/upstreamDatasetEvents
任务
列出 DAG 任务 /api/v1/dags/{dag_id}/tasks
获取任务详情 /api/v1/dags/{dag_id}/tasks/{task_id}
获取任务实例 /api/v1/dags/{dag_id}/dagRuns/{dag_run_id}/taskInstances/{task_id}
列出任务实例 /api/v1/dags/{dag_id}/dagRuns/{dag_run_id}/taskInstances
更新任务实例 /api/v1/dags/{dag_id}/dagRuns/{dag_run_id}/taskInstances/{task_id}
清除任务实例 /api/v1/dags/{dag_id}/clearTaskInstances
设置任务实例状态 /api/v1/dags/{dag_id}/updateTaskInstancesState
变量
列出变量 /api/v1/variables
创建变量 /api/v1/variables
获取变量 /api/v1/variables/{variable_key}
更新变量 /api/v1/variables/{variable_key}
删除变量 /api/v1/variables/{variable_key}
连接
列出连接 /api/v1/connections
创建连接 /api/v1/connections
获取连接 /api/v1/connections/{connection_id}
更新连接 /api/v1/connections/{connection_id}
删除连接 /api/v1/connections/{connection_id}
测试连接 /api/v1/connections/test
列出池 /api/v1/pools
创建池 /api/v1/pools
获取池 /api/v1/pools/{pool_name}
更新池 /api/v1/pools/{pool_name}
删除池 /api/v1/pools/{pool_name}
XComs
列出 XComs /api/v1/dags/{dag_id}/dagRuns/{dag_run_id}/taskInstances/{task_id}/xcomEntries
获取 XCom 条目 /api/v1/dags/{dag_id}/dagRuns/{dag_run_id}/taskInstances/{task_id}/xcomEntries/{xcom_key}
数据集
列出数据集 /api/v1/datasets
获取数据集 /api/v1/datasets/{uri}
获取数据集事件 /api/v1/datasetEvents
创建数据集事件 /api/v1/datasetEvents
获取 DAG 数据集排队事件 /api/v1/dags/{dag_id}/dagRuns/queued/datasetEvents/{uri}
获取 DAG 数据集排队事件 /api/v1/dags/{dag_id}/dagRuns/queued/datasetEvents
删除 DAG 数据集排队事件 /api/v1/dags/{dag_id}/dagRuns/queued/datasetEvents/{uri}
删除 DAG 数据集排队事件 /api/v1/dags/{dag_id}/dagRuns/queued/datasetEvents
获取数据集排队事件 /api/v1/datasets/{uri}/dagRuns/queued/datasetEvents
删除数据集排队事件 /api/v1/datasets/{uri}/dagRuns/queued/datasetEvents
监控
获取健康状态 /api/v1/health
DAG 统计
获取 DAG 统计 /api/v1/dags/statistics
配置
获取配置 /api/v1/config
插件
获取插件 /api/v1/plugins
提供者
列出提供者 /api/v1/providers
事件日志
列出事件日志 /api/v1/eventLogs
获取事件日志 /api/v1/eventLogs/{event_log_id}
系统
获取导入错误 /api/v1/importErrors
获取导入错误详情 /api/v1/importErrors/{import_error_id}
获取健康状态 /api/v1/health
获取版本 /api/v1/version

设置

依赖

此项目依赖于官方的 Apache Airflow 客户端库 (apache-airflow-client)。安装此软件包时,它将自动安装。

环境变量

设置以下环境变量:

AIRFLOW_HOST=<你的-airflow-主机>
AIRFLOW_USERNAME=<你的-airflow-用户名>
AIRFLOW_PASSWORD=<你的-airflow-密码>

与 Claude Desktop 一起使用

添加到你的 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"
      }
    }
  }
}

使用 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"
      }
    }
  }
}

/path/to/mcp-server-apache-airflow 替换为你克隆存储库的实际路径。

选择 API 组

你可以通过设置 --apis 标志来选择要使用的 API 组。

uv run mcp-server-apache-airflow --apis "dag,dagrun"

默认是使用所有 API。

允许的值为:

  • config
  • connections
  • dag
  • dagrun
  • dagstats
  • dataset
  • eventlog
  • importerror
  • monitoring
  • plugin
  • pool
  • provider
  • taskinstance
  • variable
  • xcom

手动执行

你也可以手动运行服务器:

make run

make run 接受以下选项:

选项:

  • --port: 监听 SSE 的端口 (默认: 8000)
  • --transport: 传输类型 (stdio/sse, 默认: stdio)

或者,你可以直接运行 sse 服务器,它接受相同的参数:

make run-sse

通过 Smithery 安装

要通过 Smithery 为 Claude Desktop 自动安装 Apache Airflow MCP Server:

npx -y @smithery/cli install @yangkyeongmo/mcp-server-apache-airflow --client claude

贡献

欢迎贡献!请随时提交 Pull Request。

许可证

MIT 许可证

推荐服务器

Claude Code MCP

Claude Code MCP

一个实现了 Claude Code 作为模型上下文协议(Model Context Protocol, MCP)服务器的方案,它可以通过标准化的 MCP 接口来使用 Claude 的软件工程能力(代码生成、编辑、审查和文件操作)。

精选
本地
JavaScript
@kazuph/mcp-taskmanager

@kazuph/mcp-taskmanager

用于任务管理的模型上下文协议服务器。它允许 Claude Desktop(或任何 MCP 客户端)在基于队列的系统中管理和执行任务。

精选
本地
JavaScript
Jira-Context-MCP

Jira-Context-MCP

MCP 服务器向 AI 编码助手(如 Cursor)提供 Jira 工单信息。

精选
TypeScript
mixpanel

mixpanel

连接到您的 Mixpanel 数据。 从 Mixpanel 分析查询事件、留存和漏斗数据。

精选
TypeScript
PostHog MCP Server

PostHog MCP Server

一个模型上下文协议服务器,它使 Claude Desktop 用户能够直接与 PostHog 交互,允许他们通过自然语言命令查看项目和创建注释。

官方
本地
Python
metoro-mcp-server

metoro-mcp-server

使用LLM查询和交互由Metoro监控的Kubernetes环境。查看APM、指标、追踪和性能分析信息。

官方
本地
Go
Beamlit MCP Server

Beamlit MCP Server

一个 MCP 服务器实现,它支持 Beamlit CLI 和 AI 模型之间的无缝集成,并使用模型上下文协议标准。

官方
TypeScript
Raygun MCP Server

Raygun MCP Server

MCP 服务器用于 Raygun 的 API V3 端点,用于与您的崩溃报告和真实用户监控应用程序进行交互。该服务器通过模型上下文协议提供对 Raygun API 功能的全面访问。

官方
TypeScript
ThingsPanel MCP

ThingsPanel MCP

一个集成服务器,将人工智能模型与 ThingsPanel 物联网平台连接起来,使人工智能助手能够通过自然语言与物联网设备交互,以进行设备控制、数据检索和管理操作。

官方
Python
systemd-coredump MCP Server

systemd-coredump MCP Server

启用支持 MCP 的应用程序,通过与 systemd-coredump 功能集成,来访问、管理和分析系统核心转储。

本地
JavaScript