K

KunihiroS

@KunihiroS/cort-mcp
1 Stars 153 次浏览 KunihiroS 更新于 2026-08-23
该服务暂未提供标准配置,请参考 README 手动接入

服务介绍

CoRT MCP 服务器

smithery 徽章

这是一个递归思维链(CoRT)MCP 服务器。
原始项目如下,我非常感谢原作者的工作。

原始项目: PhialsBasement/Chain-of-Recursive-Thoughts: 我通过让 AI 反复与自己争论来使其更深入地思考。效果出奇地好。
https://github.com/PhialsBasement/Chain-of-Recursive-Thoughts

发布说明

0.2.0 更新了 LLM 列表
0.1.0 初始发布

特性

  • 通过 MCP 服务器提供 CoRT 方法,使 AI 通过反复与自己争论来进行更深入的思考。效果出奇地好。

工作检查

Roo 代码 / Cline

MCP 主机配置

建议设置 300 秒超时。(有时可能比预期时间更长)
需要 OPENROUTER_API_KEY。https://openrouter.ai/

示例:禁用日志记录

json
"CoRT-chain-of-recursive-thinking": {
"command": "pipx",
"args": ["run", "cort-mcp", "--log=off"],
"env": {
"OPENAI_API_KEY": "{apikey}",
"OPENROUTER_API_KEY": "{apikey}"
}
}

示例:启用日志记录(需要绝对日志文件路径)

json
"CoRT-chain-of-recursive-thinking": {
"command": "pipx",
"args": ["run", "cort-mcp", "--log=on", "--logfile=/workspace/logs/cort-mcp.log"],
"env": {
"OPENAI_API_KEY": "{apikey}",
"OPENROUTER_API_KEY": "{apikey}"
}
}

  • --log=off : 禁用所有日志记录(不写入任何日志)
  • --log=on --logfile=/absolute/path/to/logfile.log : 启用日志记录并将日志写入指定的绝对文件路径
  • 当启用日志记录时,这两个参数都是必需的。如果缺少任何一个参数、路径不是绝对路径或给定值无效,服务器将退出并显示错误信息。

注意:

  • 当启用日志记录时,日志仅写入到指定的绝对文件路径。相对路径或省略 --logfile 将导致错误。
  • 当禁用日志记录时,不会输出任何日志。
  • 如果缺少必需的参数或参数无效,服务器将无法启动,并会打印错误消息。
  • 日志文件必须对 MCP 服务器进程可访问且可写。
  • 如果运行此服务器遇到问题,可能是由于缓存了较旧版本的 cort-mcp。请尝试使用最新版本(将 x.y.z 设置为最新版本)的 cort-mcp 运行,如下所示。

json
"CoRT-chain-of-recursive-thinking": {
"command": "pipx",
"args": ["run", "cort-mcp==x.y.z", "--log=off"],
"env": {
"OPENAI_API_KEY": "{apikey}",
"OPENROUTER_API_KEY": "{apikey}"
}
}

可用工具

  • {toolname}.simple
    无详细信息,仅输出最终选定的选项。
  • {toolname}.details
    包含 LLM 响应历史的详细信息。
  • {toolname}.mixed.llm
    多 LLM 推理。
  • {toolname}.neweval
    新的评估提示。

查看以下详细信息。

什么是 CoRT?

mermaid
flowchart TB
Start[用户查询] --> DetermineRounds[AI 确定思考轮数]
DetermineRounds -->|determine_thinking_rounds 1-5 轮| InitialResponse[初始响应
temperature=0.7]

InitialResponse --> Round1[开始第1轮]

subgraph "第1轮"
    Round1 --> R1A1[创建备选方案1 temperature=0.7]
    Round1 --> R1A2[创建备选方案2 temperature=0.8]
    Round1 --> R1A3[创建备选方案3 temperature=0.9]

    InitialResponse & R1A1 & R1A2 & R1A3 --> R1Eval[评估 temperature=0.2]
    R1Eval --> R1Best[第1轮最佳响应]
end

R1Best --> Round2[开始第2轮]

subgraph "第2轮"
    Round2 --> R2A1[创建备选方案1 temperature=0.7]
    Round2 --> R2A2[创建备选方案2 temperature=0.8]
    Round2 --> R2A3[创建备选方案3 temperature=0.9]

    R1Best & R2A1 & R2A2 & R2A3 --> R2Eval[评估 temperature=0.2]
    R2Eval --> R2Best[第2轮最佳响应]
end

R2Best --> Remaining[剩余轮次重复相同过程]
Remaining --> FinalBest[最终轮次最佳响应]

FinalBest --> FinalResponse[最终响应]## 与原始方法的主要增强

从原始的CoRT方法论中,有几项重要的增强:

  1. 多LLM推理:每个备选项都是通过随机选择不同的LLM(模型+提供商)生成的。
  2. 评估增强:通过添加一个要求AI解释其推理过程的提示来更新提示评估。(原始提示可通过工具获取)

多LLM推理

概述:
这是一种新工具,在传统的CoRT思维流程中加入了“为每个备选项随机选择不同的LLM(模型+提供商)”这一探索策略。这使您能够最大化利用异构模型的知识和想法,并从更广泛的选择中挑选出最优解。

  • 该功能可通过混合LLM工具获得。

LLM列表

  • 为了更好的用户体验,选择了相对轻量且更快的模型。

python
MIXED_LLM_LIST = [
{"provider": "openai", "model": "gpt-4.1-nano"},
{"provider": "openrouter", "model": "meta-llama/llama-4-scout:free"},
{"provider": "openrouter", "model": "google/gemini-2.0-flash-exp:free"},
{"provider": "openrouter", "model": "mistralai/mistral-small-3.1-24b-instruct:free"},
{"provider": "openrouter", "model": "meta-llama/llama-3.2-3b-instruct:free"},
{"provider": "openrouter", "model": "thudm/glm-4-9b:free"},
]

混合LLM工具处理过程

  • 对于每个备选项,从上述列表中随机选择一个LLM(模型+提供商)
  • 始终记录日志中“为每个生成的备选项使用了哪个模型和提供商”
  • 在详细模式下,在响应历史信息中明确包含“每个备选项使用的模型和提供商”

评估增强

概述:
使评估提示更加丰富。(原始提示可通过工具获取)
使用{toolname}.neweval提供的提示,要求AI解释其推理过程。

原始提示

python
f"""Original message: {prompt}
Evaluate these responses and choose the best one:
Current best: {current_best}
Alternatives:
{chr(10).join([f"{i+1}. {alt}" for i, alt in enumerate(alternatives)])}
Which response best addresses the original message? Consider accuracy, clarity, and completeness.
First, respond with ONLY current or a number (1-{len(alternatives)}).
Then on a new line, explain your choice in one sentence."""

增强后的提示

python
f""" Original message: {prompt}
You are an expert evaluator tasked with selecting the response that best fulfills the user s true needs, considering multiple perspectives.
Current best: {current_best}
Alternatives: {chr(10).join([f"{i+1}. {alt}" for i, alt in enumerate(alternatives)])}
Please follow this evaluation process:
Intent Analysis: What is the user REALLY seeking? What underlying needs might be present beyond the surface question?
Context Consideration: What possible situations or backgrounds could this question arise from?
Diversity Assessment: Does the response consider different viewpoints or possible interpretations?
Practicality Evaluation: How useful would the response be in the user s real-world context?
Consistency Check: Is the response internally consistent and logically coherent?
For each response (including the current best):
Does it solve the user s TRUE problem?
Does it balance accuracy and usefulness?
Does it avoid unnecessary assumptions or biases?
Is it flexible enough to apply in various contexts or situations?
Does it account for exceptions or special cases?
After completing your evaluation:
Indicate your choice with ONLY current or a number (1-{len(alternatives)}).
On the next line, explain specifically why this response best meets the user s true needs. """

参数指定和回退处理

此API根据指定的providermodel参数确定实际使用的模型,并在出现错误时进行回退处理。

  1. 提供商(provider)解析- 当未指定时:默认使用 openrouter 作为提供者。
  • 当指定了无效值(除了 openaiopenrouter):回退到默认提供者 openrouter
  1. 模型 (model) 解析

    • 当未指定时
      • 如果解析的提供者是 openrouter:使用默认模型 mistralai/mistral-small-3.1-24b-instruct:free
      • 如果解析的提供者是 openai:使用默认的 OpenAI 模型。
    • 当指定了有效提供者时
      • 使用指定的模型名称与解析的提供者进行匹配。
      • 重要提示:在此阶段,不会验证指定的模型名称是否确实存在于该提供者中。
  2. API 调用和错误回退

    • 首先尝试使用上述规则解析出的提供者和模型组合进行 API 调用。
    • 如果在 API 调用过程中发生错误(例如,指定的模型不存在于提供者中,API 密钥认证错误等):
      • 条件 1:首次尝试调用的提供者不是 openai
      • 条件 2:系统中设置了环境变量 OPENAI_API_KEY
      • 如果同时满足以上两个条件,系统将自动使用 openai 提供者的默认模型重新尝试(这是回退处理)。
      • 如果上述任一或两个条件不满足(例如,首次尝试是使用 openai,或者 OPENAI_API_KEY 未设置),则返回初始错误作为最终结果,并且这种类型的回退不会发生。

关于环境变量的说明:

  • 使用 openrouter 需要设置 OPENROUTER_API_KEY
  • 使用 openai 或利用上述回退功能需要设置 OPENAI_API_KEY
  • 如果相应的 API 密钥未设置,API 调用将失败(根据回退条件,回退到 OpenAI 也将失败)。

许可证

MIT

随意使用它

相关 MCP 服务