Skip to main content
Glama

任务编排器 (Task Orchestrator)

一个用于任务编排和管理的模型上下文协议 (MCP) 服务器。此工具可帮助将目标分解为可管理的任务并跟踪其进度。

如何使用

理想情况下,LLM 应该能够理解何时使用此 MCP 工具。但作为一个示例提示词,类似这样的内容可能会起作用:

“为我创建一个新的开发目标。目标是‘实现用户身份验证’,它是针对‘my-web-app’存储库的。”

如果您遇到任何问题,请在顶部的“Discussions”选项卡中创建一个新议题,让我知道。

Related MCP server: Jotdown

功能

  • 创建和管理目标

  • 将目标分解为层级任务

  • 跟踪任务完成状态

  • 支持子任务以及父任务与子任务之间的依赖管理

  • 使用 LokiDB 进行持久化存储

路线图

  • 复杂的任务/目标相互依赖编排

  • 目标删除

  • 完成处置

  • 进度可视化 UI

API 参考

任务 ID 命名约定

任务 ID 使用点号表示法(例如,“1”、“1.1”、“1.1.1”),其中每个段代表层级中的一个级别。

  • 对于每个新目标,顶级任务 ID 从“1”开始并按顺序递增(例如,“1”、“2”、“3”)。

  • 子任务的 ID 是通过在其父级 ID 后附加一个新段形成的(例如,“1.1”是“1”的子任务)。

  • goalIdtaskId 的组合保证是唯一的。

工具

服务器提供以下工具(基于 build/index.js):

  1. create_goal

    • 创建一个新目标

    • 参数:

      {
        description: string;  // The goal description
        repoName: string;     // The repository name associated with this goal
      }
    • 示例输入:

      {
        "description": "Implement user authentication",
        "repoName": "example/auth-service"
      }
    • 返回:{ goalId: number }

  2. add_tasks

    • 向目标添加多个任务。任务可以以层级结构提供。对于作为现有任务子级的任务,请使用 parentId 字段。该操作是事务性的:要么批处理中的所有任务都成功,要么整个操作失败。

    • 参数:

      {
        goalId: number; // ID of the goal to add tasks to (number)
        tasks: Array<{
          title: string; // Title of the task (string)
          description: string; // Detailed description of the task (string)
          parentId?: string | null; // Optional parent task ID for tasks that are children of *existing* tasks. Do not use for new subtasks defined hierarchically within this batch.
          subtasks?: Array<any>; // An array of nested subtask objects to be created under this task.
        }>;
      }
    • 示例输入:

      {
        "goalId": 1,
        "tasks": [
          {
            "title": "Design database schema",
            "description": "Define tables for users, roles, and permissions",
            "subtasks": [
              {
                "title": "Create ERD",
                "description": "Draw entity-relationship diagram"
              }
            ]
          },
          {
            "title": "Implement user registration",
            "description": "Create API endpoint for new user signup",
            "parentId": "1"
          }
        ]
      }
    • 返回:HierarchicalTaskResponse[]HierarchicalTaskResponse 对象经过简化,不包含 createdAtupdatedAtparentId

  3. remove_tasks

    • 软删除目标中的多个任务。任务被标记为已删除但仍保留在系统中。默认情况下,除非明确删除其子级,否则无法软删除具有子任务的父任务。除非将 includeDeletedTasks 设置为 true,否则软删除的任务默认从 get_tasks 结果中排除。

    • 参数:

      {
        goalId: number; // ID of the goal to remove tasks from
        taskIds: string[]; // IDs of the tasks to remove (array of strings). Task IDs use dot-notation (e.g., "1", "1.1").
        deleteChildren?: boolean; // Whether to delete child tasks along with the parent (boolean). Defaults to false. If false, attempting to delete a parent task with existing subtasks will throw an error.
      }
    • 示例输入(不删除子级):

      {
        "goalId": 1,
        "taskIds": ["2", "3"]
      }
    • 示例输入(删除子级):

      {
        "goalId": 1,
        "taskIds": ["1"],
        "deleteChildren": true
      }
    • 返回:{ removedTasks: TaskResponse[], completedParents: TaskResponse[] }TaskResponse 对象经过简化,不包含 createdAtupdatedAtparentId

  4. get_tasks

    • 获取目标的任务。任务 ID 使用点号表示法(例如,“1”、“1.1”、“1.1.1”)。当指定 includeSubtasks 时,响应将返回层级任务对象。否则,将返回不包含 createdAtupdatedAtparentId 的简化任务对象。

    • 参数:

      {
        goalId: number; // ID of the goal to get tasks for (number)
        taskIds?: string[]; // Optional: IDs of tasks to fetch (array of strings). If null or empty, all tasks for the goal will be fetched.
        includeSubtasks?: "none" | "first-level" | "recursive"; // Level of subtasks to include: "none" (only top-level tasks), "first-level" (top-level tasks and their direct children), or "recursive" (all nested subtasks). Defaults to "none".
        includeDeletedTasks?: boolean; // Whether to include soft-deleted tasks in the results (boolean). Defaults to false.
      }
    • 示例输入:

      {
        "goalId": 1,
        "includeSubtasks": "recursive",
        "includeDeletedTasks": true
      }
    • 返回:TaskResponse[]TaskResponse 对象经过简化,不包含 createdAtupdatedAtparentId

  5. complete_task_status

    • 将任务标记为完成。默认情况下,如果父任务有未完成的子任务,则无法将其标记为完成。

    • 参数:

      {
        goalId: number; // ID of the goal containing the tasks
        taskIds: string[]; // IDs of the tasks to update (array of strings). Task IDs use dot-notation (e.g., "1", "1.1").
        completeChildren?: boolean; // Whether to complete all child tasks recursively (boolean). Defaults to false. If false, a task can only be completed if all its subtasks are already complete.
      }
    • 示例输入(不完成子级):

      {
        "goalId": 1,
        "taskIds": ["1", "2"]
      }
    • 示例输入(完成子级):

      {
        "goalId": 1,
        "taskIds": ["1"],
        "completeChildren": true
      }
    • 返回:TaskResponse[]TaskResponse 对象经过简化,不包含 createdAtupdatedAtparentId

使用示例

创建目标和任务

// Create a new goal. Its top-level tasks will start with ID "1".
const goal = await callTool('create_goal', {
  description: 'Implement user authentication',
  repoName: 'user/repo'
});

// Add a top-level task
const task1 = await callTool('add_tasks', {
  goalId: goal.goalId,
  tasks: [
    {
      title: 'Set up authentication middleware',
      description: 'Implement JWT-based authentication'
    }
  ]
});
// task1.addedTasks[0].id will be "1"

// Add a subtask to the previously created task "1"
const task2 = await callTool('add_tasks', {
  goalId: goal.goalId,
  tasks: [
    {
      title: 'Create login endpoint',
      description: 'Implement POST /auth/login',
      parentId: "1"  // ParentId must refer to an *already existing* task ID
    }
  ]
});
// task2.addedTasks[0].id will be "1.1"

管理任务状态

// Mark a parent task as complete, which will also complete its children
await callTool('complete_task_status', {
  goalId: 1,
  taskIds: ["1"],
  completeChildren: true
});

// Get all tasks including subtasks recursively
const allTasks = await callTool('get_tasks', {
  goalId: 1,
  includeSubtasks: "recursive"
});

删除任务

// Attempt to remove a parent task without deleting children (will fail if it has subtasks)
try {
  await callTool('remove_tasks', {
    goalId: 1,
    taskIds: ["1"]
  });
} catch (error) {
  console.error(error.message); // Expected to throw an error if subtasks exist
}

// Remove a parent task and its children
await callTool('remove_tasks', {
  goalId: 1,
  taskIds: ["1"],
  deleteChildren: true
});

开发

先决条件

  • Node.js 18+

  • pnpm

设置

  1. 安装依赖:

    pnpm install
  2. 构建项目:

    pnpm build
  3. 运行测试:

    pnpm test

项目结构

  • src/ - 源代码

    • index.ts - 主服务器实现

    • storage.ts - 数据持久层

    • types.ts - TypeScript 类型定义

    • prompts.ts - AI 提示词模板

    • __tests__/ - 测试文件

许可证

MIT

Install Server
A
license - permissive license
B
quality
C
maintenance

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/coderexpert123/task-orchestrator'

If you have feedback or need assistance with the MCP directory API, please join our Discord server