Chain of Draft Thinking
链式草稿服务器 (Chain of Draft Server) 是一个强大的 AI 驱动工具,它通过系统化、迭代式地改进想法和设计,帮助开发者做出更好的决策。它可以与流行的 AI 代理无缝集成,并为推理、API 设计、架构决策、代码编写提供结构化的方法。
Tools
chain-of-draft
# Chain of Draft (CoD): Systematic Reasoning Tool ⚠️ REQUIRED PARAMETERS - ALL MUST BE PROVIDED: 1. reasoning_chain: string[] - At least one reasoning step 2. next_step_needed: boolean - Whether another iteration is needed 3. draft_number: number - Current draft number (≥ 1) 4. total_drafts: number - Total planned drafts (≥ draft_number) Optional parameters only required based on context: - is_critique?: boolean - If true, critique_focus is required - critique_focus?: string - Required when is_critique=true - revision_instructions?: string - Recommended for revision steps - step_to_review?: number - Specific step index to review - is_final_draft?: boolean - Marks final iteration ## Purpose: Enhances problem-solving through structured, iterative critique and revision. Chain of Draft is an advanced reasoning tool that enhances problem-solving through structured, iterative critique and revision. Unlike traditional reasoning approaches, CoD mimics the human drafting process to improve clarity, accuracy, and robustness of conclusions. ## When to Use This Tool: - **Complex Problem-Solving:** Tasks requiring detailed, multi-step analysis with high accuracy demands - **Critical Reasoning:** Problems where logical flow and consistency are essential - **Error-Prone Scenarios:** Questions where initial reasoning might contain mistakes or oversight - **Multi-Perspective Analysis:** Cases benefiting from examining a problem from different angles - **Self-Correction Needs:** When validation and refinement of initial thoughts are crucial - **Detailed Solutions:** Tasks requiring comprehensive explanations with supporting evidence - **Mathematical or Logical Puzzles:** Problems with potential for calculation errors or logical gaps - **Nuanced Analysis:** Situations with subtle distinctions that might be missed in a single pass ## Key Capabilities: - **Iterative Improvement:** Systematically refines reasoning through multiple drafts - **Self-Critique:** Critically examines previous reasoning to identify flaws and opportunities - **Focused Revision:** Targets specific aspects of reasoning in each iteration - **Perspective Flexibility:** Can adopt different analytical viewpoints during critique - **Progressive Refinement:** Builds toward optimal solutions through controlled iterations - **Context Preservation:** Maintains understanding across multiple drafts and revisions - **Adaptable Depth:** Adjusts the number of iterations based on problem complexity - **Targeted Improvements:** Addresses specific weaknesses in each revision cycle ## Parameters Explained: - **reasoning_chain:** Array of strings representing your current reasoning steps. Each element should contain a clear, complete thought that contributes to the overall analysis. - **next_step_needed:** Boolean flag indicating whether additional critique or revision is required. Set to true until the final, refined reasoning chain is complete. - **draft_number:** Integer tracking the current iteration (starting from 1). Increments with each critique or revision. - **total_drafts:** Estimated number of drafts needed for completion. This can be adjusted as the solution evolves. - **is_critique:** Boolean indicating the current mode: * true = Evaluating previous reasoning * false = Implementing revisions - **critique_focus:** (Required when is_critique=true) Specific aspect being evaluated, such as: * "logical_consistency": Checking for contradictions or flaws in reasoning * "factual_accuracy": Verifying correctness of facts and calculations * "completeness": Ensuring all relevant aspects are considered * "clarity": Evaluating how understandable the reasoning is * "relevance": Assessing if reasoning directly addresses the problem - **revision_instructions:** (Required when is_critique=false) Detailed guidance for improving the reasoning based on the preceding critique. - **step_to_review:** (Optional) Zero-based index of the specific reasoning step being critiqued or revised. When omitted, applies to the entire chain. - **is_final_draft:** (Optional) Boolean indicating whether this is the final iteration of reasoning. ## Best Practice Workflow: 1. **Start with Initial Draft:** Begin with your first-pass reasoning and set a reasonable total_drafts (typically 3-5). 2. **Alternate Critique and Revision:** Use is_critique=true to evaluate reasoning, then is_critique=false to implement improvements. 3. **Focus Each Critique:** Choose a specific critique_focus for each evaluation cycle rather than attempting to address everything at once. 4. **Provide Detailed Revision Guidance:** Include specific, actionable revision_instructions based on each critique. 5. **Target Specific Steps When Needed:** Use step_to_review to focus on particular reasoning steps that need improvement. 6. **Adjust Total Drafts As Needed:** Modify total_drafts based on problem complexity and progress. 7. **Mark Completion Appropriately:** Set next_step_needed=false only when the reasoning chain is complete and satisfactory. 8. **Aim for Progressive Improvement:** Each iteration should measurably improve the reasoning quality. ## Example Application: - **Initial Draft:** First-pass reasoning about a complex problem - **Critique #1:** Focus on logical consistency and identify contradictions - **Revision #1:** Address logical flaws found in the critique - **Critique #2:** Focus on completeness and identify missing considerations - **Revision #2:** Incorporate overlooked aspects and strengthen reasoning - **Final Critique:** Holistic review of clarity and relevance - **Final Revision:** Refine presentation and ensure direct addressing of the problem Chain of Draft is particularly effective when complex reasoning must be broken down into clear steps, analyzed from multiple perspectives, and refined through systematic critique. By mimicking the human drafting process, it produces more robust and accurate reasoning than single-pass approaches.
README
MCP Chain of Draft Server 🧠
Chain of Draft Server 是一个强大的 AI 驱动工具,它通过系统性的、迭代式的思考和设计改进,帮助开发者做出更好的决策。它可以无缝集成流行的 AI 代理,并为推理、API 设计、架构决策、代码审查和实施计划提供结构化的方法。
🌟 功能
核心能力
- 迭代推理: 通过 Chain of Draft 协议进行系统性改进
- 思考历史: 跟踪和管理推理迭代
- 分支支持: 将审查重点放在特定的推理步骤上
- TypeScript 支持: 完整的 TypeScript 实现,带有 Zod 验证
- 错误处理: 全面的错误类型和处理
- 实时日志: 内置的调试和监控系统
🚀 快速开始
前提条件
- Node.js >= 16.0.0
- npm >= 8.0.0
安装
- 克隆仓库:
git clone https://github.com/bsmi021/mcp-chain-of-draft-server.git
cd mcp-chain-of-draft-server
- 安装依赖:
npm install
配置
在 initialize.ts 中进行简单的服务器配置:
const serverConfig = {
name: "chain-of-draft",
version: "1.0.0",
}
💡 使用示例
Chain of Draft 协议
const thoughtData = {
reasoning_chain: ["问题的初步分析"],
next_step_needed: true,
draft_number: 1,
total_drafts: 3,
is_critique: true,
critique_focus: "logical_consistency"
};
🛠️ 开发
项目结构
src/
├── tools/ # 专用工具
│ ├── chainOfDraft/ # 核心协议
│ └── index.ts / # 入口点
├── utils/ # 实用工具
└── index.ts # 入口点
启动开发服务器
npm run dev
❓ 常见问题
Chain of Draft 协议是如何工作的?
该协议通过迭代草案和重点评论指导您系统地改进您的思维。
我可以自定义评论维度吗?
是的!每个工具都支持根据您的特定需求定制的评论重点。
我应该计划多少个草案?
我们建议大多数任务使用 3-5 个草案,但您可以根据复杂性进行调整。
🤝 贡献
我们欢迎贡献!请查看我们的 贡献指南。
👥 社区 & 支持
- GitHub Issues - 报告错误或建议功能
- Pull Requests - 提交您的贡献
- 文档 - 查看我们的详细文档
📝 许可证
MIT 许可证 - 有关详细信息,请参阅 LICENSE 文件。
🙏 致谢
- 感谢我们的贡献者和早期采用者
- 特别感谢 MCP 社区
- 受系统推理方法的启发
用 🧠 由 @bsmi021 制作
推荐服务器
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
mcp-server-qdrant
这个仓库展示了如何为向量搜索引擎 Qdrant 创建一个 MCP (Managed Control Plane) 服务器的示例。
AIO-MCP Server
🚀 集成了 AI 搜索、RAG 和多服务(GitLab/Jira/Confluence/YouTube)的一体化 MCP 服务器,旨在增强 AI 驱动的开发工作流程。来自 Folk。
https://github.com/Streen9/react-mcp
react-mcp 与 Claude Desktop 集成,能够根据用户提示创建和修改 React 应用程序。
MCP Atlassian
适用于 Atlassian Cloud 产品(Confluence 和 Jira)的 Model Context Protocol (MCP) 服务器。此集成专为 Atlassian Cloud 实例设计,不支持 Atlassian Server 或 Data Center 部署。
any-chat-completions-mcp
将 Claude 与任何 OpenAI SDK 兼容的聊天完成 API 集成 - OpenAI、Perplexity、Groq、xAI、PyroPrompts 等。
Exa MCP Server
一个模型上下文协议服务器,它使像 Claude 这样的人工智能助手能够以安全和受控的方式,使用 Exa AI 搜索 API 执行实时网络搜索。
MySQL MCP Server
允许人工智能助手通过受控界面列出表格、读取数据和执行 SQL 查询,从而使数据库探索和分析更安全、更有条理。