关于 Sequential Thinking MCP Server
Sequential Thinking MCP Server 是一个实现顺序思考协议的 MCP 服务,将复杂问题拆解为可管理的步骤。它允许修订已有思考、分支出替代推理路径,并可动态调整总步数,适合需要逐步推理的场景。
主要功能
- 01结构化拆解复杂问题
- 02支持修订已有思考步骤
- 03支持分支出替代推理路径
- 04可动态调整思考总数
- 05生成并验证解决方案假设
适用场景
- 01分步分析复杂问题
- 02规划与设计类项目的迭代完善
- 03分析过程中需要修正方向的任务
MCP 相关
该项目是一个 MCP 服务,向 MCP 客户端暴露名为 sequential_thinking 的工具,用于逐步记录和推进思考过程。
配置
本地服务的配置在各客户端中通用,复制后粘贴到客户端的 MCP 配置文件即可。
工具
1收录的工具列表 · 更新于 3 周前
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
| thought | string | 是 | 当前思考步骤 |
| nextThoughtNeeded | boolean | 是 | 是否需要继续思考 |
| thoughtNumber | integer | 是 | 当前思考编号 |
| totalThoughts | integer | 是 | 所需思考总数的估计值 |
| isRevision | boolean | 否 | 此项是否修订了先前的思考 |
| revisesThought | integer | 否 | 正在重新考虑的思考编号 |
| branchFromThought | integer | 否 | 分支起点的思考编号 |
| branchId | string | 否 | 分支标识符 |
| needsMoreThoughts | boolean | 否 | 是否需要更多思考 |
详细介绍
顺序思考 MCP 服务
📖 概述
一个实现顺序思考协议的强大 MCP 服务,为问题解决提供结构化方法。此服务可帮助将复杂问题拆解为易于处理的步骤,同时支持灵活修订和采用其他推理路径。
✨ 功能特性
- 🔍 结构化分析 - 将复杂问题拆解为易于处理的步骤
- 🔄 迭代优化 - 随着理解加深,修订和优化思路
- 🌲 替代路径 - 分支到其他推理路径
- 📊 动态调整 - 根据需要调整思考总数
- ✅ 解决方案验证 - 生成并验证解决方案假设
🛠️ 工具接口
sequential_thinking
通过详细的逐步思考过程,帮助解决问题并进行分析。
输入参数
| 参数 | 类型 | 必填 | 描述 |
|---|---|---|---|
thought | string | 是 | 当前思考步骤 |
nextThoughtNeeded | boolean | 是 | 是否需要进行下一步思考 |
thoughtNumber | integer | 是 | 当前思考编号 |
totalThoughts | integer | 是 | 预计需要的思考总数 |
isRevision | boolean | 否 | 是否在修订之前的思考 |
revisesThought | integer | 否 | 正在重新考虑哪个思考 |
branchFromThought | integer | 否 | 分支起始思考编号 |
branchId | string | 否 | 分支标识符 |
needsMoreThoughts | boolean | 否 | 是否需要更多思考 |
🎯 使用场景
顺序思考工具适用于:
- 📝 需要逐步拆解的复杂问题
- 🎨 需要迭代优化的规划和设计项目
- 🔄 可能需要纠正方向的分析工作流
- 🌐 初始阶段尚不清楚整体范围的情况
- 📚 需要在多个步骤中保持上下文的任务
- 🔍 从复杂情境中筛除无关信息
⚙️ 集成方式
与 Claude Desktop 搭配使用
📦 NPX 配置
{
"mcpServers": {
"sequential-thinking": {
"command": "npx",
"args": [
"-y",
"@zengwenliang/mcp-server-sequential-thinking"
]
}
}
}
🐳 Docker 配置
{
"mcpServers": {
"sequential-thinking": {
"command": "docker",
"args": [
"run",
"--rm",
"-i",
"zengwenliang0416/mcp-server-sequential-thinking"
]
}
}
}
与 Cursor IDE 搭配使用
📦 NPX 方式(推荐)
- 安装软件包:
# Install globally
npm install -g @zengwenliang/mcp-server-sequential-thinking
# Or use NPX directly
npx -y @zengwenliang/mcp-server-sequential-thinking
- 在 Cursor 设置中配置(JSON):
{
"mcpServers": {
"sequential-thinking": {
"command": "npx",
"args": [
"-y",
"@zengwenliang/mcp-server-sequential-thinking"
]
}
}
}
💻 本地构建方式
- 在本地构建:
cd /path/to/sequential-thinking
npm install
npm run build
- 在 Cursor 设置中配置(JSON):
{
"mcpServers": {
"sequential-thinking": {
"command": "node",
"args": [
"/absolute/path/to/sequential-thinking/dist/index.js"
]
}
}
}
🐳 Docker 方式
- 构建 Docker 镜像:
# Build Docker image
docker build -t zengwenliang0416/mcp-server-sequential-thinking .
- 在 Cursor 设置中配置(JSON):
{
"mcpServers": {
"sequential-thinking": {
"command": "docker",
"args": [
"run",
"--rm",
"-i",
"zengwenliang0416/mcp-server-sequential-thinking"
]
}
}
}
🔧 环境变量方式
- 创建启动脚本:
#!/bin/sh
export CURSOR_MCP_CONFIG=/path/to/your/mcp_config.json
open -a Cursor
- 添加到
mcp_config.json:
{
"mcpServers": {
"sequential-thinking": {
"command": "node",
"args": [
"/absolute/path/to/sequential-thinking/dist/index.js"
]
}
}
}
- 设置为可执行:
chmod +x start_cursor_with_mcp.sh
注意:MCP 集成主要支持 Cursor IDE 的 Composer 功能。
🚀 从源代码构建
本地构建
git clone https://github.com/zengwenliang416/mcp-server-sequential-thinking.git
cd mcp-server-sequential-thinking
npm install
npm run build
Docker 构建
git clone https://github.com/zengwenliang416/mcp-server-sequential-thinking.git
cd mcp-server-sequential-thinking
docker build -t zengwenliang0416/mcp-server-sequential-thinking .
# Verify the build
docker images | grep sequential-thinking
📄 发布指南
发布到 npm
前置条件
- 已安装 Node.js 和 npm
- 拥有可访问 @zengwenliang 作用域的 npm 账户
- 已在本地构建软件包
发布步骤
-
更新 package.json 中的版本
{ "name": "@zengwenliang/mcp-server-sequential-thinking", "version": "0.6.4", "description": "MCP server for sequential thinking and problem solving" } -
使用官方 npm registry
npm config set registry https://registry.npmjs.org/ -
登录 npm
npm login按照提示通过浏览器登录。
-
检查组织成员资格 对于带作用域的包,请确保你属于该作用域:
# Check if you're part of the organization npm org ls your-org-name # For personal scopes, this is automatically created with your username -
构建并发布
npm run build # For first-time publishing a scoped package npm publish --access public # For subsequent updates npm publish -
验证发布
npm view @zengwenliang/mcp-server-sequential-thinking -
提交更改
git add . git commit -m "feat(publish): 🚀 发布npm包@zengwenliang/mcp-server-sequential-thinking" git push
版本更新
使用语义化版本控制:
# For patches (bug fixes)
npm version patch
# For minor updates (features)
npm version minor
# For major updates (breaking changes)
npm version major
更新版本后,再次构建并发布:
npm run build
npm publish
🔐 CI/CD 配置
设置 GitHub Actions
必需的密钥
在仓库设置中添加以下密钥:
-
NPM_TOKEN
- 在 npm 中生成:Account → Access Tokens → "Automation" token type
- 分步说明:
- 登录 npm 账号:https://www.npmjs.com/login
- 点击个人头像,然后选择 "Access Tokens"
- 点击 "Generate New Token" 按钮
- 重要:选择 "Automation" token type(而非 "Publish"),以绕过 OTP 要求
- 输入令牌说明(例如 "GitHub Actions")
- 点击 "Generate Token"
- 重要:立即复制生成的令牌!它只会显示一次
-
DOCKERHUB_USERNAME
- 你的 Docker Hub 用户名
- 应使用你登录 Docker Hub 时使用的同一用户名
-
DOCKERHUB_TOKEN
- 在 Docker Hub 中生成:Account Settings → Security → New Access Token
- 分步说明:
- 登录 Docker Hub 账号
- 点击用户名,然后选择 "Account Settings"
- 在左侧导航栏中选择 "Security"
- 点击 "New Access Token"
- 输入说明并选择适当的权限(至少选择 "Read & Write")
- 点击 "Generate"
- 立即复制生成的令牌!它只会显示一次
将密钥添加到 GitHub
- 前往仓库的 Settings → Secrets and variables → Actions
- 点击 "New repository secret" 按钮
- 分别添加每个密钥:
- NPM_TOKEN:粘贴 npm 访问令牌值
- DOCKERHUB_USERNAME:输入你的 Docker Hub 用户名
- DOCKERHUB_TOKEN:粘贴你的 Docker Hub 访问令牌
- 添加所有密钥后,你应该能在 "Actions secrets" 列表中看到全部 3 个密钥
测试工作流
测试自动发布工作流的方法:
- 在 GitHub 仓库中,点击 "Actions" 选项卡
- 在左侧边栏中找到 "Publish Package" 工作流
- 点击 "Run workflow" 按钮
- 从分支下拉菜单中选择 "main" 分支
- 点击绿色的 "Run workflow" 按钮
- 在 Actions 选项卡中查看进度和结果
面向启用 2FA 的用户的注意事项:如果你的 npm 账号启用了双重身份验证,则必须选择以下方式之一:
- 使用 "Automation" 类型的令牌(推荐)
- 将 2FA 设置更改为 "Authorization only"(不推荐)
- 手动发布包(非自动化)
❗ 故障排除
如果遇到集成问题:
- 🔧 使用本地构建方式,并指定 JS 文件的绝对路径
- 📝 验证文件权限:
chmod +x dist/index.js - 🐳 尝试使用 Docker 作为替代方案
- 📚 查阅 Cursor 文档,了解最新的 MCP 集成方法
📄 许可证
本项目采用 MIT 许可证授权,详情请参阅 LICENSE 文件。
🔗 源代码
基于 modelcontextprotocol/servers,由 zengwenliang416/mcp-server-sequential-thinking 维护。
评论
一个开放协议,规定了 AI 应用如何以统一方式连接外部工具与数据源。客户端负责与模型对话,MCP 服务负责提供工具、资源和提示模板,两者通过标准消息通信,同一个服务可以被不同客户端复用。