值得注意的事项:
https://github.com/Jacck/mcp-reasoner
谢谢你给我这个想法,杰克。
用于Cursor AI的MCP高级推理服务器
一个模型上下文协议(MCP)服务器,为Cursor AI中的Claude提供高级推理能力。
特性
- 蒙特卡洛树搜索(MCTS):将MCTS推理用于复杂的问题解决任务。
- 波束搜索:同时探索多种推理路径。
- R1变压器:利用基于Transformer的推理来解决复杂问题。
- 混合推理:将变压器分析与MCTS相结合,以增强推理能力。
- 自动迭代推理:所有多步骤推理方法都会在一次工具调用中自动完成所有推理步骤。
安装
npm install
npm run build用法
使用Cursor AI进行配置
- 首先构建服务器:
cd mcp-reasoning-server
npm run build- 打开光标AI
- 导航到“设置”>“功能”>“MCP”
- 点击“+添加新的全局MCP服务器”按钮
- 输入以下详细信息:
- 在命令字段中: node C:\\Users\\[YourUsername]\\path\\to\\mcp-reasoning-server\\dist\\index.js - 确保使用项目dist/index.js文件的完整路径 - 对Windows路径使用双反斜杠
- 点击“添加”
- 在列表中找到您的服务器(它最初将显示为“已禁用”)
- 点击“禁用”将其切换为“启用”
- 单击刷新按钮加载可用工具
- 命令提示符窗口将自动打开-这是您正在运行的服务器
- 只要此命令提示窗口保持打开状态,推理工具就可用
或者,您可以在以下位置手动编辑Cursor MCP配置文件 C:\Users\[Username]\.cursor\mcp.json (Windows):
{
"mcpServers": {
"mcp-reasoner": {
"command": "node",
"args": ["C:\\Users\\[Username]\\path\\to\\mcp-reasoning-server\\dist\\index.js"]
}
}
}重要提示
- 服务器正在运行:这些工具仅在命令提示符窗口打开并运行时可用
- 进行更改:如果对服务器代码进行了更改,则必须使用重新生成
npm run build重新启动之前 - 重新启动:要重新启动服务器,请关闭命令提示符窗口,并在光标设置中关闭/打开服务器
使用推理工具
您可以在与Claude的Cursor AI对话中直接使用推理工具:
MCTS推理
使用 /reason-mcts 命令后面跟着您的查询,以启动基于MCTS的推理链:
/reason-mcts How can I optimize the performance of this React component?波束搜索推理
使用 /reason-beam 基于波束搜索的推理命令:
/reason-beam What architecture would be best for this microservice system?R1变压器推理
使用 /reason-r1 基于Transformer的单步推理命令:
/reason-r1 Analyze the complexity of this algorithm.混合推理
使用 /reason-hybrid 命令结合Transformer和MCTS推理:
/reason-hybrid How should we approach refactoring this legacy codebase?克劳德集成
为了使Claude更容易使用这些推理工具,您可以添加以下自定义说明:
When I use commands like /reason-mcts, /reason-beam, /reason-r1, or /reason-hybrid in chat, interpret them as requests to use the corresponding reasoning tools:
/reason-mcts: Use the reason_mcts tool with the text following the command as the query
Example: "/reason-mcts How do I solve this problem?" should call the reason_mcts tool
/reason-beam: Use the reason_beam tool with the text following the command as the query
Example: "/reason-beam What's the best approach for this complex problem?" should call the reason_beam tool
/reason-r1: Use the reason_r1 tool with the text following the command as the query
Example: "/reason-r1 Analyze this code for performance issues" should call the reason_r1 tool
/reason-hybrid: Use the reason_hybrid tool with the text following the command as the query
Example: "/reason-hybrid How should we restructure this architecture?" should call the reason_hybrid tool
When these commands are used, extract the text after the command as the query parameter and use the corresponding tool to perform advanced reasoning.发展
项目结构
src/index.ts:主服务器入口点src/tools/reasoning-tools.ts:实施推理工具src/tools/reasoning-wrapper.ts:命令包装器,便于在Cursor中使用src/utils/errors.ts:错误处理实用程序
自动迭代推理
推理工具被实现为在单个工具调用期间在内部自动完成所有推理步骤。每种推理方法都遵循以下过程:
- 初始化第一个想法/步骤
- 自动生成后续想法/步骤
- 返回所有想法以及最终结果
这种方法确保推理过程完全完成,而不需要多次手动工具调用。
添加新的推理方法
要添加新的推理方法,请执行以下步骤:
- 在中添加新的工具实现
src/tools/reasoning-tools.ts - 在中添加相应的命令包装器
src/tools/reasoning-wrapper.ts - 遵循现有工具的模式,定义参数和响应格式
- 如果是多步骤推理方法,则实现自动迭代
- 使用重建项目
npm run build
局限性
这是一个模拟推理服务器。在生产实现中,您将连接到实际的推理算法,而不是当前使用的占位符响应。
许可证
国际协调委员会
