分而治之任务管理服务器

@landicefu/divide-and-conquer-mcp-server
1 Stars 607 次浏览 landicefu 更新于 2026-08-23

启用AI代理使用具有任务跟踪、上下文保留和进度监控功能的结构化JSON格式,将复杂任务分解为可管理的部分。

MCP 服务配置

复制以下 JSON 到 OPClaw 或其他 MCP 客户端的配置文件中即可使用

{
  "mcpServers": {
    "divide-and-conquer": {
      "args": [
        "-y",
        "@landicefu/divide-and-conquer-mcp-server"
      ],
      "command": "npx",
      "disabled": false
    }
  }
}

服务介绍

分而治之 MCP 服务器

一种模型上下文协议(MCP)服务器,使AI代理能够使用结构化的JSON格式将复杂任务分解为可管理的部分。

目录

目的

分而治之MCP服务器是Temp Notes MCP服务器的一种进化版本,专门设计用于需要分解成可管理部分的复杂任务。与使用简单的文本文件不同,此服务器使用结构化的JSON格式来存储任务信息、检查列表和上下文,这使得跟踪进度并在多次对话中保持上下文变得更加容易。

主要功能

  • 结构化的JSON格式:使用JSON结构而不是纯文本存储任务信息
  • 任务跟踪:包含具有完成状态跟踪功能的检查列表
  • 上下文保留:专为任务上下文和详细描述设置字段
  • 进度监控:轻松可视化已完成与剩余任务
  • 任务排序:维护任务顺序以进行顺序执行
  • 任务插入:能够在检查列表中的特定位置插入新任务
  • 元数据:跟踪附加信息,如标签、优先级和预计完成时间
  • 笔记和资源:存储与任务相关的额外笔记和资源

快速开始

  1. 将服务器添加到您的MCP配置中:

    {
      "mcpServers": {
        "divide-and-conquer": {
          "command": "npx",
          "args": ["-y", "@landicefu/divide-and-conquer-mcp-server"],
          "disabled": false
        }
      }
    }
    
  2. 在您的对话中开始使用它:

    // 初始化一个新任务
    await use_mcp_tool({
      server_name: "divide-and-conquer",
      tool_name: "initialize_task",
      arguments: {
        task_description: "重构认证系统",
        context_for_all_tasks: "当前系统使用基于会话的认证。"
      }
    });
    
    // 添加检查列表项
    await use_mcp_tool({
      server_name: "divide-and-conquer",
      tool_name: "add_checklist_item",
      arguments: {
        task: "分析当前认证流程",
        detailed_description: "审查现有的认证代码。",
        context_and_plan: "查看src/auth/*文件。当前实现使用express-session与MongoDB存储。"
      }
    });
    

安装

选项1:使用 npx(推荐)

将服务器添加到您的MCP配置中:

{
  "mcpServers": {
    "divide-and-conquer": {
      "command": "npx",
      "args": ["-y", "@landicefu/divide-and-conquer-mcp-server"],
      "disabled": false
    }
  }
}

选项2:从源码安装

  1. 克隆仓库:

    git clone https://github.com/landicefu/divide-and-conquer-mcp-server.git
    cd divide-and-conquer-mcp-server
    
  2. 安装依赖项:

    npm install
    
  3. 构建服务器:

    npm run build
    
  4. 将服务器添加到您的 MCP 配置中:

    {
      "mcpServers": {
        "divide-and-conquer": {
          "command": "node",
          "args": ["/path/to/divide-and-conquer-mcp-server/build/index.js"],
          "disabled": false
        }
      }
    }
    

工具

Divide and Conquer MCP 服务器提供了以下工具:

initialize_task

使用指定的描述和可选的初始检查清单项创建新任务。

update_task_description

更新主要任务描述。

update_context

更新所有任务的上下文信息。

add_checklist_item

向检查清单添加新项目。

update_checklist_item

更新现有的检查清单项。

mark_task_done

标记一个检查清单项为已完成。

mark_task_undone

标记一个检查清单项为未完成。

remove_checklist_item

移除一个检查清单项。

reorder_checklist_item

将检查清单项移动到新位置。

add_note

向任务添加备注。

add_resource

向任务添加资源。

update_metadata

更新任务元数据。

clear_task

清除当前任务数据。

get_checklist_summary

返回带有完成状态的检查清单摘要。有意排除了上下文信息,以节省上下文窗口空间。

get_current_task_details

检索当前任务(第一个未完成的任务)的详细信息(包括完整上下文),以及所有其他任务的部分字段。对于当前任务,包含所有字段,包括 context_and_plan。对于其他任务,仅包含 task、detailed_description 和 done 状态(不包含 context_and_plan)。这是处理任务时推荐使用的工具。

使用示例

初始化复杂任务

await use_mcp_tool({
  server_name: "divide-and-conquer",
  tool_name: "initialize_task",
  arguments: {
    task_description: "Refactor the authentication system to use JWT tokens and improve security",
    context_for_all_tasks: "The current system uses session-based authentication with cookies. We need to migrate to JWT for better scalability and security.",
    initial_checklist: [
      {
        task: "Analyze current authentication flow",
        detailed_description: "Review the existing authentication code to understand the current flow.",
        context_and_plan: "Look at src/auth/* files. The current implementation uses express-session with MongoDB store. Pay special attention to session expiration handling."
      },
      {
        task: "Design JWT implementation",
        detailed_description: "Create a design document outlining how JWT will be implemented.",
        context_and_plan: "Consider token structure, storage, and refresh mechanisms. Research best practices for JWT implementation in Node.js applications. Reference the security requirements document in docs/security.md."
      }
    ],
    metadata: {
      tags: ["security", "refactoring", "authentication"],
      priority: "high",
      estimated_completion_time: "2 weeks"
    }
  }
});

获取检查清单摘要

const summary = await use_mcp_tool({
  server_name: "divide-and-conquer",
  tool_name: "get_checklist_summary",
  arguments: {
    include_descriptions: true
  }
});

// Result contains a formatted summary of the checklist with completion status (context is excluded to save space)

获取当前任务详情

const taskDetails = await use_mcp_tool({
  server_name: "divide-and-conquer",
  tool_name: "get_current_task_details",
  arguments: {}
});

// Result contains:
// - ultimate_goal: The final goal of the entire task (task_description)
// - tasks: Array of all tasks, where the current task (first uncompleted) has all fields including context_and_plan,
//   while other tasks have limited fields (task, detailed_description, done) without context_and_plan
// - current_task_index: Index of the current task (first uncompleted)
// - Additional task metadata, notes, resources, etc.

使用场景

1. 复杂的软件开发任务

在处理复杂的软件开发任务时,AI 代理经常面临上下文窗口限制,这使得在一个对话中完成所有步骤变得困难。Divide and Conquer MCP 服务器允许代理:

  • 将大型任务分解成较小的、可管理的部分
  • 跨多个对话跟踪进度
  • 维护否则会丢失的重要上下文
  • 按逻辑顺序组织任务
  • 记录决策和资源

2. 项目规划和管理

对于项目规划和管理任务,服务器支持:

  • 创建包含任务和子任务的结构化项目计划
  • 跟踪进度和完成状态
  • 保持上下文和需求
  • 记录决策和资源
  • 在多个对话中协作

3. 研究与分析

在进行研究和分析时,代理可以:

  • 将研究问题分解为具体的调查领域
  • 跟踪进度和发现
  • 保持上下文和背景信息
  • 记录来源和资源
  • 以结构化的方式组织发现

JSON 结构

服务器使用以下 JSON 结构来存储任务信息:

{
  "task_description": "A medium-level detailed description about the whole task. The final goal we want to achieve.",
  
  "checklist": [
    {
      "done": false,
      "task": "A short yet comprehensive name for the task",
      "detailed_description": "A longer description about what we want to achieve with this task",
      "context_and_plan": "Related information, files the agent should read, and more details from other tasks, as well as a detailed plan for this task. This is typically the longest string."
    }
  ],
  
  "context_for_all_tasks": "Information that all tasks in the checklist should include.",
  
  "metadata": {
    "created_at": "ISO timestamp",
    "updated_at": "ISO timestamp",
    "progress": {
      "completed": 0,
      "total": 1,
      "percentage": 0
    },
    "tags": ["tag1", "tag2"],
    "priority": "high|medium|low",
    "estimated_completion_time": "ISO timestamp or duration"
  },
  
  "notes": [
    {
      "timestamp": "ISO timestamp",
      "content": "Additional notes or observations about the overall task"
    }
  ],
  
  "resources": [
    {
      "name": "Resource name",
      "url": "URL or file path",
      "description": "Description of the resource"
    }
  ]
}

配置存储

默认情况下,分而治之MCP服务器将任务数据存储在以下位置:

  • 在 macOS/Linux 上:~/.mcp_config/divide_and_conquer.json(扩展为 /Users/用户名/.mcp_config/divide_and_conquer.json
  • 在 Windows 上:C:\Users\用户名\.mcp_config\divide_and_conquer.json

当您首次初始化任务时,会自动创建此文件。如果您尝试读取任务数据时文件不存在,则服务器将返回一个空的任务结构,并且在下次写入时创建该文件。

服务器处理以下情况:

  • 如果读取时文件不存在:返回一个空的任务结构
  • 如果目录不存在:在写入时自动创建目录结构
  • 如果文件损坏或无法访问:返回适当的错误消息

贡献

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

许可证

本项目根据 MIT 许可证发布 - 详情请参阅 LICENSE 文件。

相关 MCP 服务