Divide and Conquer MCP Server

by landicefu
Verified

local-only server

The server can only run on the client’s local machine because it depends on local resources.

Integrations

  • Mentioned in the context of authentication implementation, where the current system uses express-session with MongoDB store.

  • Used as a storage solution for session-based authentication, mentioned in example context for a refactoring task.

  • Supports JWT implementation for Node.js applications, allowing for token structure, storage, and refresh mechanisms according to best practices.

分而治之 MCP 服务器

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

目录

目的

Divide and Conquer 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. 开始在对话中使用它:
    // Initialize a new task await use_mcp_tool({ server_name: "divide-and-conquer", tool_name: "initialize_task", arguments: { task_description: "Refactor the authentication system", context_for_all_tasks: "The current system uses session-based authentication." } }); // Add checklist items await use_mcp_tool({ server_name: "divide-and-conquer", tool_name: "add_checklist_item", arguments: { task: "Analyze current authentication flow", detailed_description: "Review the existing authentication code.", context_and_plan: "Look at src/auth/* files. The current implementation uses express-session with MongoDB store." } });

安装

选项 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 status(不包括 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 代理经常面临上下文窗口限制,难以在一次对话中完成所有步骤。分而治之的 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" } ] }

配置存储

默认情况下,Divide and Conquer MCP 服务器将任务数据存储在以下位置:

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

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

服务器处理以下场景:

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

贡献

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

执照

该项目根据 MIT 许可证获得许可 - 有关详细信息,请参阅 LICENSE 文件。

ID: pls8towgdb