mcpField
R
RAT MCP Server (Retrieval Augmented Thinking)

RAT MCP Server (Retrieval Augmented Thinking)

本地服务
github.com/newideas99AI 与智能体11591 周前更新

关于 RAT MCP Server (Retrieval Augmented Thinking)

这是面向 Cline 的 MCP 服务,通过两阶段流程处理提示词:DeepSeek R1 生成推理,Claude 3.5 Sonnet 经由 OpenRouter 生成回答。它还管理对话上下文和耗时响应任务。

主要功能

  1. 01DeepSeek 到 Claude 的两阶段回答
  2. 02通过 OpenRouter 访问模型
  3. 03对话上下文管理
  4. 04并发对话处理
  5. 05任务状态轮询
  6. 06可选推理与历史记录

适用场景

  1. 01通过分阶段推理生成回答
  2. 02查看耗时请求的进度
  3. 03纳入 Cline 对话历史
  4. 04在对话间清除上下文

MCP 相关

该 MCP 服务提供 `generate_response` 和 `check_response_status` 工具。MCP 客户端可提交提示词、设置上下文与推理选项,并轮询任务完成状态。

配置

本地服务的配置在各客户端中通用,复制后粘贴到客户端的 MCP 配置文件即可。

暂未收录安装方式

我们还没有获取到这个服务的安装包或远程地址,请按项目 README 中的说明安装。

代码仓库

工具

还没有获取到工具列表

本地服务需要在你的电脑上运行后才能读取工具,维护者暂未提供工具列表。

详细介绍

Deepseek-Thinking-Claude-3.5-Sonnet-CLINE-MCP

smithery badge

一个模型上下文协议(MCP)服务,通过 OpenRouter 将 DeepSeek R1 的推理能力与 Claude 3.5 Sonnet 的响应生成相结合。此实现采用两阶段流程:DeepSeek 提供结构化推理,随后将其融入 Claude 的响应生成中。

功能

  • 两阶段处理:

    • 使用 DeepSeek R1 进行初步推理(5 万字符上下文)
    • 使用 Claude 3.5 Sonnet 生成最终响应(60 万字符上下文)
    • 两个模型均通过 OpenRouter 统一 API 访问
    • 将 DeepSeek 的推理令牌注入 Claude 的上下文
  • 智能对话管理:

    • 根据文件修改时间检测活动对话
    • 处理多个并发对话
    • 自动过滤已结束的对话
    • 支持按需清除上下文
  • 优化参数:

    • 按模型设置上下文限制:
      • DeepSeek:50,000 个字符,用于聚焦推理
      • Claude:600,000 个字符,用于全面响应
    • 推荐设置:
      • temperature:0.7,平衡创造性
      • top_p:1.0,使用完整概率分布
      • repetition_penalty:1.0,防止重复

安装

通过 Smithery 安装

通过 Smithery 为 Claude Desktop 自动安装 DeepSeek Thinking with Claude 3.5 Sonnet:

npx -y @smithery/cli install @newideas99/Deepseek-Thinking-Claude-3.5-Sonnet-CLINE-MCP --client claude
手动安装
  1. 克隆代码库:
git clone https://github.com/yourusername/Deepseek-Thinking-Claude-3.5-Sonnet-CLINE-MCP.git
cd Deepseek-Thinking-Claude-3.5-Sonnet-CLINE-MCP
  1. 安装依赖项:
npm install
  1. 创建 .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
  1. 构建服务:
npm run build

在 Cline 中使用

将以下内容添加到 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": []
    }
  }
}

工具用法

该服务提供两个工具,用于生成和监控响应:

generate_response

用于生成响应的主要工具,参数如下:

{
  "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
}
响应轮询

该服务使用轮询机制处理长时间运行的请求:

  1. 初始请求:

    • generate_response 会立即返回任务 ID
    • 响应格式:{"taskId": "uuid-here"}
  2. 状态检查:

    • 使用 check_response_status 轮询任务状态
    • **注意:**响应可能需要最多 60 秒才能完成
    • 状态依次为:pending → reasoning → responding → complete

在 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

工作原理

  1. 推理阶段(DeepSeek R1):

    • 使用 OpenRouter 的推理令牌功能
    • 修改提示词,使其输出 'done',同时捕获推理内容
    • 从响应元数据中提取推理内容
  2. 响应阶段(Claude 3.5 Sonnet):

    • 接收原始提示词和 DeepSeek 的推理内容
    • 结合推理生成最终响应
    • 保留对话上下文和历史记录

许可证

MIT 许可证——详情请参阅 LICENSE 文件。

致谢

基于 Skirano 提出的 RAT(检索增强思考)理念,该理念通过结构化推理和知识检索提升 AI 响应质量。

此实现通过 OpenRouter 统一 API,将 DeepSeek R1 的推理能力与 Claude 3.5 Sonnet 的响应生成相结合。

评论

支持 Markdown

第一次接触 MCP?

从协议是什么,到在客户端里装上第一个服务,这几条回答覆盖了大多数入门问题。

一个开放协议,规定了 AI 应用如何以统一方式连接外部工具与数据源。客户端负责与模型对话,MCP 服务负责提供工具、资源和提示模板,两者通过标准消息通信,同一个服务可以被不同客户端复用。