关于 Ultrafast Mcp Sequential Thinking
UltraFast MCP Sequential Thinking 是基于 Rust 的 MCP 服务端与客户端,用于结构化、迭代式地解决问题。它支持分支推演、修改思路、会话管理、导出和分析,并提供 stdio 与 HTTP 传输方式。
主要功能
- 01将问题拆分为连续思考步骤
- 02修改思路并探索分支
- 03动态调整规划深度
- 04管理、合并和导出会话
- 05分析会话并跟踪进度
适用场景
- 01梳理多步骤问题求解过程
- 02比较不同推理路径
- 03保存并回顾思考会话
MCP 相关
服务端提供 sequential_thinking、export_session、analyze_session 和 merge_sessions 工具,以及会话和分析资源,支持 stdio 与 HTTP 传输方式。
配置
本地服务的配置在各客户端中通用,复制后粘贴到客户端的 MCP 配置文件即可。
工具
本地服务需要在你的电脑上运行后才能读取工具,维护者暂未提供工具列表。
详细介绍
UltraFast MCP Sequential Thinking
官方 Docker 镜像现已推出:techgopal/ultrafast-mcp-sequential-thinking
基于 UltraFast MCP 框架构建的高性能 Rust 版模型上下文协议(MCP)顺序思考服务和客户端实现。
🚀 概述
UltraFast MCP Sequential Thinking 通过动态且反思性的思考过程,提供结构化的问题解决方法。此实现相比官方 TypeScript 版本具有显著的性能优势,同时完全兼容 MCP 2025-06-18 规范。
✨ 功能
核心能力
- 动态拆解问题:将复杂问题分解为易于处理的步骤
- 反思式思考:随着理解的深入,修正和完善思路
- 分支逻辑:探索替代推理路径
- 自适应规划:动态调整思考总步数
- 解决方案验证:生成并验证解决方案假设
- 上下文保留:在多个步骤中保留思考上下文
性能优势
- 快 10 至 100 倍:Rust 实现带来显著的性能提升
- 内存高效:针对处理大型思考会话进行了优化
- 并发处理:支持 async/await,可进行高吞吐量操作
- 类型安全:编译时保证符合协议要求
- 可用于生产环境:提供全面的错误处理和监控
增强功能
- 进度跟踪:为长时间思考会话提供实时进度通知
- 支持取消:按需中断思考过程
- 会话管理:跨连接持久化思考会话
- 导出功能:以多种格式导出思考会话
- 分析:详细分析思考模式和效率
🏗️ 架构
服务组件
┌─────────────────────────────────────────────────────────────┐
│ Sequential Thinking Server │
├─────────────────────────────────────────────────────────────┤
│ ┌─────────────┐ ┌─────────────┐ ┌─────────────┐ │
│ │ Thinking │ │ Session │ │ Analytics │ │
│ │ Engine │ │ Management │ │ & Metrics │ │
│ └─────────────┘ └─────────────┘ └─────────────┘ │
├─────────────────────────────────────────────────────────────┤
│ ┌─────────────┐ ┌─────────────┐ ┌─────────────┐ │
│ │ Branch │ │ Context │ │ Export │ │
│ │ Management │ │ Tracking │ │ Handlers │ │
│ └─────────────┘ └─────────────┘ └─────────────┘ │
├─────────────────────────────────────────────────────────────┤
│ UltraFast MCP Core │
│ ┌─────────────┐ ┌─────────────┐ ┌─────────────┐ │
│ │ Protocol │ │ Transport │ │ Handlers │ │
│ │ Layer │ │ Layer │ │ System │ │
│ └─────────────┘ └─────────────┘ └─────────────┘ │
└─────────────────────────────────────────────────────────────┘
客户端组件
┌─────────────────────────────────────────────────────────────┐
│ Sequential Thinking Client │
├─────────────────────────────────────────────────────────────┤
│ ┌─────────────┐ ┌─────────────┐ ┌─────────────┐ │
│ │ Session │ │ Progress │ │ Export │ │
│ │ Manager │ │ Tracker │ │ Manager │ │
│ └─────────────┘ └─────────────┘ └─────────────┘ │
├─────────────────────────────────────────────────────────────┤
│ ┌─────────────┐ ┌─────────────┐ ┌─────────────┐ │
│ │ Thinking │ │ Branch │ │ Analytics │ │
│ │ Interface │ │ Explorer │ │ Dashboard │ │
│ └─────────────┘ └─────────────┘ └─────────────┘ │
├─────────────────────────────────────────────────────────────┤
│ UltraFast MCP Client │
└─────────────────────────────────────────────────────────────┘
🛠️ 安装
先决条件
- Rust 1.70 或更高版本
- Cargo(Rust 包管理器)
快速开始
1. 克隆仓库
git clone https://github.com/your-org/ultrafast-mcp-sequential-thinking.git
cd ultrafast-mcp-sequential-thinking
2. 构建项目
cargo build --release
3. 运行服务
# STDIO transport (default)
cargo run --bin sequential-thinking-server
# HTTP transport
cargo run --bin sequential-thinking-server -- --transport http --port 8080
4. 运行客户端
# Connect to server
cargo run --bin sequential-thinking-client -- --server stdio://
# Connect to HTTP server
cargo run --bin sequential-thinking-client -- --server http://localhost:8080
5. 使用 MCP Inspector(可选)
# Start HTTP server for Inspector
cargo run --bin sequential-thinking-server -- --transport http --port 8080
# Open MCP Inspector and load mcp-inspector-config.json
# Choose "sequential-thinking-server-http" for HTTP transport
使用 Docker 快速开始
1. 使用官方 Docker 镜像
# Pull the latest image from Docker Hub
docker pull techgopal/ultrafast-mcp-sequential-thinking:latest
# Run HTTP server on port 8080
docker run --rm -p 8080:8080 techgopal/ultrafast-mcp-sequential-thinking:latest
# Run with custom configuration
docker run --rm -p 8080:8080 -e MAX_THOUGHTS=200 techgopal/ultrafast-mcp-sequential-thinking:latest
# Run in detached mode
docker run -d --name thinking-server -p 8080:8080 techgopal/ultrafast-mcp-sequential-thinking:latest
2.(可选)在本地构建 Docker 镜像
# Build the server image locally (if you want to make changes)
docker build -t sequential-thinking-server .
# Verify the image was created
docker images | grep sequential-thinking-server
3. 将客户端连接到 Docker 服务
# Connect to HTTP server running in Docker
cargo run --bin sequential-thinking-client -- --server http://localhost:8080
# Or use curl to test the server
curl -X POST http://localhost:8080/mcp \
-H "Content-Type: application/json" \
-d '{"jsonrpc":"2.0","method":"initialize","params":{"protocolVersion":"2025-06-18"},"id":1}'
MCP Inspector Docker 配置示例
如果你想使用 MCP Inspector 或其他工具,在 Docker 容器中通过高级选项(例如分析功能和提高最大思考数)启动服务,请使用以下配置:
{
"mcpServers": {
"sequential-thinking": {
"command": "docker",
"args": [
"run",
"--rm",
"-i",
"techgopal/ultrafast-mcp-sequential-thinking:latest",
"/usr/local/bin/sequential-thinking-server",
"--transport",
"stdio",
"--max-thoughts",
"200",
"--enable-analytics"
],
"env": {}
}
}
}
此配置将使用 STDIO 传输在 Docker 容器中启动服务,并启用分析功能、提高最大思考数上限。请根据使用场景调整参数。
4. Docker Compose(可选)
# Create docker-compose.yml for easy deployment
cat > docker-compose.yml << EOF
version: '3.8'
services:
sequential-thinking-server:
build: .
ports:
- "8080:8080"
environment:
- MAX_THOUGHTS=100
- ENABLE_ANALYTICS=true
restart: unless-stopped
EOF
# Start with Docker Compose
docker-compose up -d
# Stop the service
docker-compose down
多平台 Docker 支持
Docker 镜像支持多个平台,以实现最大兼容性:
支持的平台
- linux/amd64:Intel/AMD 64 位处理器
- linux/arm64:ARM 64 位处理器(Apple Silicon、ARM 服务)
- linux/arm/v7:ARM 32 位处理器(Raspberry Pi、较旧的 ARM 设备)
特定平台的用法
# Pull for specific platform
docker pull --platform linux/amd64 techgopal/ultrafast-mcp-sequential-thinking:latest
docker pull --platform linux/arm64 techgopal/ultrafast-mcp-sequential-thinking:latest
docker pull --platform linux/arm/v7 techgopal/ultrafast-mcp-sequential-thinking:latest
# Run on specific platform
docker run --platform linux/amd64 --rm -p 8080:8080 techgopal/ultrafast-mcp-sequential-thinking:latest
docker run --platform linux/arm64 --rm -p 8080:8080 techgopal/ultrafast-mcp-sequential-thinking:latest
docker run --platform linux/arm/v7 --rm -p 8080:8080 techgopal/ultrafast-mcp-sequential-thinking:latest
在本地构建多平台镜像
# Set up Docker Buildx for multi-platform builds
docker buildx create --name multiplatform --use
# Build for all supported platforms
docker buildx build --platform linux/amd64,linux/arm64,linux/arm/v7 \
-t your-username/ultrafast-mcp-sequential-thinking:latest \
--push .
# Build for specific platform only
docker buildx build --platform linux/arm64 \
-t your-username/ultrafast-mcp-sequential-thinking:arm64 \
--push .
指定平台的 Docker Compose
# docker-compose.yml
version: '3.8'
services:
sequential-thinking:
image: techgopal/ultrafast-mcp-sequential-thinking:latest
platform: linux/arm64 # Specify platform for ARM64
ports:
- "8080:8080"
environment:
- MAX_THOUGHTS=200
- ENABLE_ANALYTICS=true
restart: unless-stopped
CI/CD 多平台流水线
项目包含 GitHub Actions 工作流,可自动构建并推送多平台镜像:
- Docker Test:在拉取请求上构建并测试镜像
- Docker Release:在 main 分支上构建并推送多平台镜像
- 缓存:使用 GitHub Actions 缓存加快构建速度
- 来源证明:为提高兼容性而禁用
构建脚本
项目包含便捷脚本,用于构建和测试多平台镜像:
# Build multi-platform images locally
./scripts/build-multi-platform.sh --push
# Test multi-platform images
./scripts/test-multi-platform.sh
# Build for specific platforms only
./scripts/build-multi-platform.sh -p linux/amd64,linux/arm64 --push
# Test with custom image and port
./scripts/test-multi-platform.sh -i my-image -t v1.0.0 -p 9090
🔧 配置
MCP Inspector
本项目包含一个 MCP Inspector 配置文件(mcp-inspector-config.json),支持 HTTP 和 STDIO 传输模式。
使用 MCP Inspector
-
启动服务(任选其一):
# HTTP transport (recommended for Inspector) cargo run --bin sequential-thinking-server -- --transport http --port 8080 # STDIO transport cargo run --bin sequential-thinking-server -- --transport stdio -
打开 MCP Inspector 并加载配置文件:
- 导航到项目目录
- 选择
mcp-inspector-config.json - 选择你偏好的传输模式:
- HTTP:
sequential-thinking-server-http(默认) - STDIO:
sequential-thinking-server-stdio
- HTTP:
-
测试工具:
sequential_thinking:用于问题解决的主要思考工具export_session:以多种格式导出会话analyze_session:获取分析结果和洞察merge_sessions:合并多个会话
配置文件结构
mcp-inspector-config.json 包含:
- HTTP 服务:
http://localhost:8080/mcp - STDIO 服务:使用 stdio 传输的 Cargo 子进程
- 工具架构:所有工具的完整输入/输出架构
- 文档:各工具的详细说明
服务配置
# config.toml
[server]
name = "ultrafast-sequential-thinking"
version = "1.0.0"
transport = "http"
port = 8080
[thinking]
max_thoughts_per_session = 100
max_branches_per_session = 10
session_timeout_seconds = 3600
enable_analytics = true
[export]
formats = ["json", "markdown", "pdf"]
auto_export = false
客户端配置
# client_config.toml
[client]
server_url = "http://localhost:8080"
timeout_seconds = 30
retry_attempts = 3
[thinking]
auto_save_interval = 60
enable_progress_tracking = true
show_thought_visualization = true
📊 API 参考
核心类型
ThoughtData
pub struct ThoughtData {
pub thought: String,
pub thought_number: u32,
pub total_thoughts: u32,
pub next_thought_needed: bool,
pub is_revision: Option<bool>,
pub revises_thought: Option<u32>,
pub branch_from_thought: Option<u32>,
pub branch_id: Option<String>,
pub needs_more_thoughts: Option<bool>,
}
ThinkingSession
pub struct ThinkingSession {
pub session_id: String,
pub title: String,
pub thoughts: Vec<ThoughtData>,
pub branches: HashMap<String, Vec<ThoughtData>>,
pub metadata: SessionMetadata,
}
服务端点
工具
sequential_thinking:主要思考工具(符合 MCP 2025-06-18 规范)export_session:以多种格式导出思考会话analyze_session:获取会话的分析结果和洞察merge_sessions:合并多个思考会话
资源
session_history:访问思考会话历史记录analytics_data:会话分析数据和指标export_templates:导出格式模板
🧪 测试
运行测试
# Run all tests
cargo test
# Run specific test suite
cargo test --test thinking_tests
# Run with coverage
cargo tarpaulin
集成测试
# Run integration tests
cargo test --test integration_tests
# Run performance benchmarks
cargo bench
📈 性能
基准测试
- 思考处理:每条思考约 0.1ms(TypeScript 中为 1-5ms)
- 会话创建:约 0.5ms(TypeScript 中为 10-20ms)
- 分支管理:每个分支约 0.2ms(TypeScript 中为 2-8ms)
- 导出操作:JSON 约 1ms,Markdown 约 5ms(TypeScript 中为 50-200ms)
内存使用
- 每个会话:基础约 2KB,每条思考增加 100 字节
- 服务内存:基础约 10MB,每个活动会话增加 1KB
- 客户端内存:基础约 5MB,每个会话增加 500 字节
🔒 安全
功能
- 输入验证:全面验证所有输入
- 会话隔离:会话之间完全隔离
- 速率限制:内置 API 端点速率限制
- 身份验证:可选支持 OAuth 2.1
- 审计日志:所有操作均有完整审计记录
最佳实践
- 处理前验证所有用户输入
- 实施适当的会话清理
- 所有 HTTP 通信均使用 HTTPS
- 定期进行安全审计和更新
🤝 贡献
开发环境设置
# Clone repository
git clone https://github.com/techgopal/ultrafast-mcp-sequential-thinking.git
cd ultrafast-mcp-sequential-thinking
# Install dependencies
cargo build
# Run development server
cargo run --bin sequential-thinking-server -- --dev
# Run tests
cargo test
代码风格
- 遵循 Rust 编码规范
- 使用
cargo fmt进行格式化 - 使用
cargo clippy进行代码检查 - 编写全面的测试
拉取请求流程
- Fork 仓库
- 创建功能分支
- 进行更改
- 添加测试
- 更新文档
- 提交拉取请求
📄 许可证
本项目采用 MIT 许可证,详情请参阅 LICENSE 文件。
🙏 致谢
- Model Context Protocol:感谢提供出色的协议规范
- UltraFast MCP:感谢提供高性能 Rust 框架
- Official Sequential Thinking Server:感谢提供原始 TypeScript 实现
🔄 更新日志
v1.0.0
- 首次发布
- 完全符合 MCP 2025-06-18 规范
- 高性能 Rust 实现
- 全面的测试套件
- 可用于生产环境的功能
使用 UltraFast MCP 倾情打造 ❤️
评论
一个开放协议,规定了 AI 应用如何以统一方式连接外部工具与数据源。客户端负责与模型对话,MCP 服务负责提供工具、资源和提示模板,两者通过标准消息通信,同一个服务可以被不同客户端复用。