使用说明
《Deepseek Thinking》第3.5章十四行诗-CLINE-MCP
一种模型上下文协议(MCP)服务器,通过OpenRouter将DeepSeek R1的推理能力与Claude 3.5 Sonnet的响应生成相结合。此实现使用两阶段过程,DeepSeek提供结构化推理,然后将其合并到Claude的响应生成中。
特性
-
两阶段处理:
- 使用DeepSeek R1进行初始推理(50k字符上下文)
- 使用克劳德3.5十四行诗作为最终响应(600k字符上下文)
- 这两种模型都通过OpenRouter的统一API访问
- 将DeepSeek的推理令牌注入Claude的上下文中
-
智能对话管理:
- 使用文件修改时间检测活动对话
- 处理多个并发对话
- 自动过滤已结束的对话
- 支持在需要时清除上下文
-
优化参数:
- 特定于模型的上下文限制:
- DeepSeek:50000个字符用于集中推理
- 克劳德:60万个字符用于综合回答
- 推荐设置:
- 温度:0.7,平衡创造力
- top_p:1.0表示全概率分布
- repetition_ppenalty:1.0以防止重复
- 特定于模型的上下文限制:
安装
通过Smithery安装
使用Claude 3.5 Sonnet for Claude Desktop自动安装DeepSeek Thinking 史密瑟里:
npx -y @smithery/cli install @newideas99/Deepseek-Thinking-Claude-3.5-Sonnet-CLINE-MCP --client claude
手动安装
- 克隆存储库:
git clone https://github.com/yourusername/Deepseek-Thinking-Claude-3.5-Sonnet-CLINE-MCP.git
cd Deepseek-Thinking-Claude-3.5-Sonnet-CLINE-MCP
- 安装依赖项:
npm install
- 创建一个
.env使用OpenRouter API密钥的文件:
# Required: OpenRouter API key for both DeepSeek and Claude models
OPENROUTER_API_KEY=your_openrouter_api_key_here
# Optional: Model configuration (defaults shown below)
DEEPSEEK_MODEL=deepseek/deepseek-r1 # DeepSeek model for reasoning
CLAUDE_MODEL=anthropic/claude-3.5-sonnet:beta # Claude model for responses
- 构建服务器:
npm run build
与Cline一起使用
添加到您的临床MCP设置中(通常在 ~/.vscode/globalStorage/saoudrizwan.claude-dev/settings/cline_mcp_settings.json):
{
"mcpServers": {
"deepseek-claude": {
"command": "/path/to/node",
"args": ["/path/to/Deepseek-Thinking-Claude-3.5-Sonnet-CLINE-MCP/build/index.js"],
"env": {
"OPENROUTER_API_KEY": "your_key_here"
},
"disabled": false,
"autoApprove": []
}
}
}
工具使用
服务器提供两种工具用于生成和监视响应:
生成响应
生成具有以下参数的响应的主要工具:
{
"prompt": string, // Required: The question or prompt
"showReasoning"?: boolean, // Optional: Show DeepSeek's reasoning process
"clearContext"?: boolean, // Optional: Clear conversation history
"includeHistory"?: boolean // Optional: Include Cline conversation history
}
check_response_status
用于检查响应生成任务状态的工具:
{
"taskId": string // Required: The task ID from generate_response
}
响应轮询
服务器使用轮询机制来处理长时间运行的请求:
-
初始请求:
generate_response立即返回任务ID- 响应格式:
{"taskId": "uuid-here"}
-
状态检查:
- 使用
check_response_status轮询任务状态 - 注: 完成响应可能需要60秒
- 状态进展通过:待定→ 推理→ 回应→ 完成
- 使用
Cline中的示例用法:
// Initial request
const result = await use_mcp_tool({
server_name: "deepseek-claude",
tool_name: "generate_response",
arguments: {
prompt: "What is quantum computing?",
showReasoning: true
}
});
// Get taskId from result
const taskId = JSON.parse(result.content[0].text).taskId;
// Poll for status (may need multiple checks over ~60 seconds)
const status = await use_mcp_tool({
server_name: "deepseek-claude",
tool_name: "check_response_status",
arguments: { taskId }
});
// Example status response when complete:
{
"status": "complete",
"reasoning": "...", // If showReasoning was true
"response": "..." // The final response
}
发展
对于自动重建的开发:
npm run watch
运作原理
-
推理阶段(DeepSeek R1):
- 使用OpenRouter的推理令牌功能
- 在捕获推理时,提示被修改为输出“完成”
- 从响应元数据中提取推理
-
反应阶段(克劳德3.5十四行诗):
- 收到原始提示和DeepSeek的推理
- 生成包含推理的最终响应
- 维护对话上下文和历史记录
许可证
MIT许可证-有关详细信息,请参阅许可证文件。
鸣谢
基于RAT(检索增强思维)概念 斯基拉诺,通过结构化推理和知识检索增强AI响应。
该实现特别结合了DeepSeek R1的推理功能和Claude 3.5 Sonnet通过OpenRouter的统一API生成的响应。