草案链(CoD)MCP 服务器
概述
该 MCP 服务器实现了研究论文《Chain of Draft: Thinking Faster by Writing Less》中描述的 Chain of Draft (CoD) 推理方法。CoD 是一种新颖的范式,它允许 LLM 在解决任务时生成简洁但信息丰富的中间推理输出,从而显著减少 token 的使用,同时保持准确性。
主要优点
- 效率:显著减少代币使用量(仅为标准 CoT 的 7.6%)
- 速度:由于生成时间较短,响应速度更快
- 节省成本:降低 LLM 调用的 API 成本
- 保持精度:与 CoT 相比,精度相似甚至更高
- 灵活性:适用于各种推理任务和领域
特征
- 草案实施的核心链
- 简洁的推理步骤(通常 5 个字或更少)
- 格式强制执行
- 答案提取
- 性能分析
- 代币使用情况追踪
- 解决方案准确性监控
- 执行时间测量
- 特定领域的性能指标
- 自适应字数限制
- 自动复杂度评估
- 动态调整字数限制
- 特定领域校准
- 综合示例数据库
- CoT 到 CoD 的转换
- 特定领域的示例(数学、代码、生物、物理、化学、谜题)
- 基于问题相似度的示例检索
- 格式执行
- 后期处理以确保遵守字数限制
- 台阶结构保存
- 依从性分析
- 混合推理方法
- 自动选择 CoD 和 CoT
- 特定领域优化
- 基于历史绩效的选择
- OpenAI API 兼容性
- 标准 OpenAI 客户端的直接替代品
- 支持完成和聊天界面
- 轻松集成到现有工作流程中
设置和安装
先决条件
- Python 3.10+(用于 Python 实现)
- Node.js 18+(用于 JavaScript 实现)
- 人类学 API 密钥
Python 安装
- 克隆存储库
- 安装依赖项:
- 在
.env
文件中配置 API 密钥: - 运行服务器:
JavaScript 安装
- 克隆存储库
- 安装依赖项:
- 在
.env
文件中配置 API 密钥: - 运行服务器:
Claude 桌面集成
与 Claude Desktop 集成:
- 从claude.ai/download安装 Claude Desktop
- 创建或编辑 Claude Desktop 配置文件:
- 添加服务器配置(Python版本):或者对于 JavaScript 版本:
- 重启Claude桌面
您还可以使用 Claude CLI 添加服务器:
可用工具
Chain of Draft 服务器提供以下工具:
工具 | 描述 |
---|---|
chain_of_draft_solve | 使用 Chain of Draft 推理解决问题 |
math_solve | 使用 CoD 解决数学问题 |
code_solve | 使用 CoD 解决编码问题 |
logic_solve | 使用 CoD 解决逻辑问题 |
get_performance_stats | 获取 CoD 与 CoT 的性能统计数据 |
get_token_reduction | 获取 token 减少统计数据 |
analyze_problem_complexity | 分析问题复杂性 |
开发人员使用情况
Python客户端
如果您想在 Python 代码中直接使用 Chain of Draft 客户端:
JavaScript 客户端
对于 JavaScript/Node.js 应用程序:
实现细节
该服务器有 Python 和 JavaScript 两种实现,均由几个集成组件组成:
Python 实现
- AnalyticsService :跟踪不同问题领域和推理方法的性能指标
- ComplexityEstimator :分析问题以确定适当的字数限制
- ExampleDatabase :管理和检索示例,将 CoT 示例转换为 CoD 格式
- FormatEnforcer :确保推理步骤符合字数限制
- ReasoningSelector :根据问题特征在 CoD 和 CoT 之间进行智能选择
JavaScript 实现
- analyticsDb :用于跟踪性能指标的内存数据库
- complexityEstimator :分析问题以确定复杂性和适当的字数限制
- formatEnforcer :确保推理步骤符合字数限制
- reasoningSelector :根据问题特征和历史表现自动在 CoD 和 CoT 之间进行选择
两种实现都遵循相同的核心原则并提供相同的 MCP 工具,使得它们在大多数用例中可以互换。
执照
该项目是开源的,并根据 MIT 许可证提供。
You must be authenticated.
remote-capable server
The server can be hosted and run remotely because it primarily relies on remote services or has no dependency on the local environment.
Tools
实施 Chain of Draft 推理方法,在解决任务时生成简约的中间推理输出,在保持准确性的同时显著减少 token 的使用。
Related Resources
Related MCP Servers
- AsecurityAlicenseAqualityEnhances Claude's reasoning capabilities by integrating DeepSeek R1's advanced reasoning engine for intricate multi-step reasoning tasks with precision and efficiency.Last updated -135PythonMIT License
- -securityAlicense-qualityEnhances Claude's reasoning capabilities by integrating DeepSeek R1's advanced reasoning engine, allowing Claude to tackle complex multi-step reasoning tasks with greater precision.Last updated -PythonMIT License
- -security-license-qualityProvides a tool for dynamic and reflective problem-solving by breaking complex problems into manageable steps with support for revision, branching, and hypothesis generation.Last updated -13,824JavaScript
- -securityAlicense-qualityA minimal MCP Server that provides Claude AI models with the 'think' tool capability, enabling better performance on complex reasoning tasks by allowing the model to pause during response generation for additional thinking steps.Last updated -5251TypeScriptMIT License