MCP Server for Apache Airflow

remote-capable server

The server can be hosted and run remotely because it primarily relies on remote services or has no dependency on the local environment.

Integrations

  • Allows interaction with Apache Airflow through a Model Context Protocol server that wraps Airflow's REST API. Supports DAG management (listing, viewing details, pausing/unpausing), DAG runs (listing, creating), task management (listing tasks and task instances), and system information (health status, version, import errors).

mcp-服务器-apache-airflow

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

关于

该项目实现了一个模型上下文协议 (MCP)服务器,它封装了 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=<your-airflow-host> AIRFLOW_USERNAME=<your-airflow-username> AIRFLOW_PASSWORD=<your-airflow-password>

与 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。

允许的值为:

  • 配置
  • 连接
  • 达格
  • 达格伦
  • 达格统计
  • 数据集
  • 事件日志
  • 导入错误
  • 监控
  • 插件
  • 水池
  • 提供者
  • 任务实例
  • 多变的
  • 幽浮

手动执行

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

make run

make run接受以下选项:

选项:

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

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

make run-sse

通过 Smithery 安装

要通过Smithery自动为 Claude Desktop 安装 Apache Airflow MCP 服务器:

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

贡献

欢迎贡献代码!欢迎提交 Pull 请求。

执照

MIT 许可证

You must be authenticated.

A
security – no known vulnerabilities
A
license - permissive license
A
quality - confirmed to work

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

  1. About
    1. Feature Implementation Status
      1. Setup
        1. Dependencies
        2. Environment Variables
        3. Usage with Claude Desktop
        4. Selecting the API groups
        5. Manual Execution
        6. Installing via Smithery
      2. Contributing
        1. License
          ID: e99b6vx9lw