DolphinScheduler MCP Server
# DolphinScheduler MCP Server
基于 [ocean-zhc/dolphinscheduler-mcp](https://github.com/ocean-zhc/dolphinscheduler-mcp) 二次开发的 MCP Server。
把 DolphinScheduler REST API 封装成 MCP Tools,让 AI Agent 能对工作流、任务、执行记录做分析,也能执行启停、创建、修改等运维操作。
仓库地址:https://github.com/melody3240/dolphinscheduler-mcp-server
## 特性
- **全量 API 覆盖**:269 个工具,覆盖 OpenAPI 规范里全部读写接口
- **分析导向**:查询工具覆盖项目、工作流 DAG、执行记录、日志、数据质量、告警、任务组排队等分析场景
- **标准协议**:基于 FastMCP 4.x,支持 stdio / HTTP / SSE 传输
- **参数可解释**:每个工具参数都带中文 description,模型能准确理解怎么填
## 环境要求
- Python >= 3.11
- Apache DolphinScheduler 3.x(工具基于 3.3.0 的 OpenAPI 规范生成,适用于接口兼容的 3.x 版本)
## 安装
项目尚未发布到 PyPI,目前支持以下两种安装方式。
### 方式一:从 GitHub 直接安装
```bash
pip install git+https://github.com/melody3240/dolphinscheduler-mcp-server.git
```
### 方式二:克隆后本地安装
```bash
git clone https://github.com/melody3240/dolphinscheduler-mcp-server.git
cd dolphinscheduler-mcp-server
python -m venv .venv
```
Windows PowerShell:
```powershell
.\.venv\Scripts\Activate.ps1
pip install -e .
```
macOS / Linux:
```bash
source .venv/bin/activate
pip install -e .
```
验证:
```bash
dolphinscheduler-mcp-server --help
```
## 配置
| 环境变量 | 说明 | 默认值 |
|---|---|---|
| `DOLPHINSCHEDULER_API_URL` | DolphinScheduler API 地址 | `http://localhost:12345/dolphinscheduler` |
| `DOLPHINSCHEDULER_API_KEY` | 认证 Token | 无 |
| `DOLPHINSCHEDULER_MCP_TRANSPORT` | 传输方式:`stdio` / `http` / `sse` / `streamable-http` | `stdio` |
| `DOLPHINSCHEDULER_MCP_HOST` | HTTP 模式绑定地址 | `0.0.0.0` |
| `DOLPHINSCHEDULER_MCP_PORT` | HTTP 模式端口 | `8089` |
| `DOLPHINSCHEDULER_MCP_LOG_LEVEL` | 日志级别 | `INFO` |
也可用命令行参数覆盖:
```bash
dolphinscheduler-mcp-server --api-url http://ds:12345/dolphinscheduler --api-key <token>
```
## 运行
### stdio(默认,用于 Cursor / Claude Desktop)
```bash
dolphinscheduler-mcp-server
```
Cursor 的 `mcp.json` 配置示例:
```json
{
"mcpServers": {
"dolphinscheduler": {
"command": "d:/workSpace/code/dolphinscheduler-mcp-server/.venv/Scripts/python.exe",
"args": ["-m", "dolphinscheduler_mcp"],
"env": {
"DOLPHINSCHEDULER_API_URL": "http://ds:12345/dolphinscheduler",
"DOLPHINSCHEDULER_API_KEY": "<token>"
}
}
}
}
```
stdio 模式下日志走 stderr,stdout 是 MCP 协议通道,不要改成 HTTP 模式接本地客户端。
### HTTP(远程客户端)
```bash
dolphinscheduler-mcp-server --transport http --host 0.0.0.0 --port 8089
```
访问地址:`http://localhost:8089/mcp`
### Docker
```bash
docker compose up --build -d
```
需设置 `DOLPHINSCHEDULER_API_KEY`,并按需修改 `docker-compose.yml` 中的 `DOLPHINSCHEDULER_API_URL`。
## 工具能力
当前共 **269 个工具**,全部来自 OpenAPI 规范。
### 查询分析类(113 个)
| 类别 | 能做什么 |
|---|---|
| 项目与权限 | 查项目列表、详情、授权级别、依赖项目、授权用户 |
| 工作流定义与 DAG | 查定义列表/详情/版本、变量、视图树、节点列表、批量节点映射 |
| 工作流实例与执行记录 | 查实例列表/详情、甘特图、实例变量、子流程、耗时 TopN、任务日志 |
| 任务定义与实例 | 查任务定义列表/详情/版本、任务实例列表、状态统计 |
| 执行分析 | 状态统计、错误命令、待执行命令、队列状态、执行中工作流 |
| 数据质量 | 查规则列表、执行结果、规则表单配置 |
| 告警 | 查告警组、告警插件实例、名称校验 |
| 任务组与队列 | 查任务组、组内排队任务、队列列表 |
| 审计与血缘 | 查审计日志、血缘关系、上下游依赖任务 |
| 数据源与资源 | 查数据源元数据、资源列表、资源下载、UDF |
| 环境信息 | Token、Worker 组、K8s 命名空间、UI 插件、动态任务类型、ADF |
### 写操作类(156 个)
| 类别 | 能做什么 |
|---|---|
| 项目与参数 | 创建/修改/删除项目、项目参数、项目偏好 |
| 工作流与任务 | 创建/修改/删除流程定义、任务定义、启停工作流、上下线调度 |
| 与任务的增删改查 | 创建/修改/删除数据源、Token、Worker 组、告警组、告警插件 |
| 系统管理 | 租户、用户、K8s 命名空间、任务组、队列管理 |
| 其他 | 血缘、审计、资源上传下载、数据质量规则等全部 OpenAPI 写接口 |
命名说明:全部工具统一使用 snake_case,无连字符或数字编号。写工具分两批,早期工具用 `create_*` / `delete_*` / `update_*` 等动词前缀,从 OpenAPI 批量生成的工具统一带 `write_` 前缀。
## 开发
```bash
pip install -r requirements-dev.txt
python -m pytest tests/ -q
```
## 致谢
原始项目:[ocean-zhc/dolphinscheduler-mcp](https://github.com/ocean-zhc/dolphinscheduler-mcp)
## License
Apache License 2.0
TDQS
Scored across 269 tools
The tool set contains extensive duplication across nearly every domain: worker groups have get_worker_groups, get_all_worker_groups, get_project_worker_group, create_worker_groups, and write_save_worker_group; projects have create_projects, write_create_project, list_all_projects, query_project_list_paging, and multiple authorization-query variants. Many query_/get_/list_ tools target the same underlying API resources, and the write_* wrappers further overlap with the descriptive CRUD tools, making selection highly ambiguous.
Names are snake_case but follow several incompatible conventions: verb_resource (get_worker_groups), resource_action (create_projects_worker_group), nested path-like names (create_projects_lineages_tasks_verify_delete), generic write_* wrappers (write_update_task_definition, write_execute), and duplicated endpoint names. The write_* prefix is especially inconsistent because it wraps create, update, delete, execute, login, and other verbs under one non-descriptive prefix.
269 tools is extreme for an MCP server and far beyond what an agent can reasonably navigate; many tools are duplicate wrappers of the same DolphinScheduler API endpoints. The surface is not well-scoped, and the large number of overlapping query/get/list variants makes the set unwieldy rather than comprehensive.
The server appears to cover a very broad portion of DolphinScheduler's API, including projects, workflows, task definitions, schedules, datasources, alerts, queues, workers, namespaces, users, tokens, and audit logs. Coverage is extensive, though the presence of duplicate wrappers makes it hard to tell whether some lifecycle operations are genuinely missing or just obscured by overlapping tools.