关于 Sequential Thinking Multi-Agent System (MAS)
Sequential Thinking MAS 是一个 MCP 服务,通过一组专业 AI Agent 对每个思考步骤进行多视角分析。它基于 Agno 框架构建,适合需要结构化、多角度推理并能接受较高 Token 消耗的场景。
主要功能
- 01单一 sequentialthinking 工具支持多步推理循环
- 02六个专业 Agent 并行分析并由综合 Agent 汇总
- 03可选 ExaTools 联网研究,需设置 EXA_API_KEY
- 04支持 DeepSeek、Groq、Anthropic、Ollama 等多个提供方
- 05固定执行策略,每次调用路径一致
适用场景
- 01对复杂问题进行事实、风险与创意等多角度分析
- 02在 MCP 客户端中驱动结构化的逐步推理过程
- 03比较不同模型提供方在多 Agent 推理中的表现
MCP 相关
该项目作为 MCP 服务运行,暴露 sequentialthinking 工具,返回 should_continue 等结构化字段,指导客户端持续调用直至推理结束。
配置
本地服务的配置在各客户端中通用,复制后粘贴到客户端的 MCP 配置文件即可。
工具
本地服务需要在你的电脑上运行后才能读取工具,维护者暂未提供工具列表。
详细介绍
Sequential Thinking Multi-Agent System(MAS) 
English | 简体中文
这是一个 MCP 服务,通过一组专业 AI Agent 处理连续思考,每个 Agent 都从不同的认知视角分析问题。
这是什么
这是一个 MCP 服务,而不是独立应用。它作为后台服务运行,为兼容 MCP 的大模型客户端(如 Claude Desktop)扩展结构化的连续思考能力。它提供一个工具 sequentialthinking,让每个思考都经过固定的多 Agent 工作流:先进行初步综合,再由多个专业 Agent 并行思考,最后进行综合并回答原始问题。
工作原理
系统对每个请求都使用固定的 full_exploration 策略。AI 复杂度分析器仍会运行,以记录诊断元数据(复杂度分数、问题类型、所需思考模式),但不再改变执行路径——所有思考都采用相同流程:
flowchart TD
A[Input Thought] --> B[AI Complexity Analyzer]
B --> C[Complexity Metadata Stored]
C --> D[Fixed Strategy: full_exploration]
D --> E[Step 1: Initial Synthesis]
E --> F[Step 2: Parallel Specialist Agents]
F --> G[Step 3: Final Synthesis]
G --> H[Unified Response]
专业 Agent
每个请求都会并行运行六个专业 Agent,此外还会运行一个综合 Agent 两次(开始时一次,结束时一次)。除综合 Agent 外,每个专业 Agent 都可以选择使用 ExaTools 进行网络研究。
| Agent | 思考方向 | 重点 | 时间预算 |
|---|---|---|---|
| 事实型 | factual | 客观事实和已验证的数据 | 120s |
| 情感型 | emotional | 直觉和本能反应 | 30s |
| 批判型 | critical | 风险、弱点、逻辑缺陷 | 120s |
| 乐观型 | optimistic | 优势、机会、价值 | 120s |
| 创意型 | creative | 新想法和替代方案 | 240s |
| 元认知型 | metacognitive | 偏见检测和推理过程评估 | 90s |
| 综合型 | synthesis | 整合并给出最终答案 | 60s |
主要特性:
- 确定性:每个请求都会运行相同的多步骤流程。
- 并行:专业 Agent 使用
asyncio.gather同时运行。 - 由综合驱动:编排过程和最终答案都由综合 Agent 提供,该 Agent 使用增强模型。
模型策略
每个提供商配置两个模型:
- 增强模型:供综合 Agent 使用(整合任务)。
- 标准模型:供专业 Agent 使用。
研究能力
除综合 Agent 外,所有 Agent 均配置了 ExaTools。研究是可选的——只有在设置了 EXA_API_KEY 时才会启用。未设置时,系统仅依靠推理运行。
sequentialthinking 工具
该服务提供一个 MCP 工具。
输入
{
thought: string, // One focused reasoning step
thoughtNumber: number, // 1-based step index; increment each call
totalThoughts: number, // Planned number of steps
nextThoughtNeeded: boolean, // true for intermediate steps, false on final step
isRevision: boolean, // true only when revising earlier conclusions
branchFromThought?: number, // Set with branchId to branch from a prior step
branchId?: string, // Branch identifier (required when branching)
needsMoreThoughts: boolean // true only when extending beyond totalThoughts
}
输出
{
should_continue: boolean, // Canonical continuation signal
next_thought_number: number?, // Recommended next thoughtNumber
stop_reason: string, // Why to continue/stop/retry
current_thought_number: number,
total_thoughts: number,
next_call_arguments?: { // Suggested next-call arguments when applicable
thoughtNumber: number,
totalThoughts: number,
nextThoughtNeeded: boolean,
needsMoreThoughts: boolean
},
parameter_usage: Record<string, string>
}
调用约定
- 将此工具视为多步骤循环,而不是一次性调用。
- 每次收到响应后,都要读取
structuredContent.should_continue。 - 持续调用,直到
should_continue为false。 - 主动运用反思:当某一步质量较差或不正确时,发送一个
isRevision=true的修订步骤。 - 构建下一次请求时,优先使用
structuredContent.next_thought_number和next_call_arguments。
支持的提供商
| 提供商 | 环境变量 | 默认增强模型 | 默认标准模型 |
|---|---|---|---|
| DeepSeek(默认) | DEEPSEEK_API_KEY | deepseek-chat | deepseek-chat |
| Groq | GROQ_API_KEY | openai/gpt-oss-120b | openai/gpt-oss-20b |
| OpenRouter | OPENROUTER_API_KEY | deepseek/deepseek-chat-v3-0324 | deepseek/deepseek-r1 |
| GitHub Models | GITHUB_TOKEN | openai/gpt-5 | openai/gpt-5-min |
| Anthropic | ANTHROPIC_API_KEY | claude-3-5-sonnet-20241022 | claude-3-5-haiku-20241022 |
| Ollama | 无 | devstral:24b | devstral:24b |
安装
前置条件
- Python 3.10+
- 上述任一提供商的 LLM API 密钥
- 可选:用于网络研究的
EXA_API_KEY uv包管理器(推荐)或pip
安装
git clone https://github.com/FradSer/mcp-server-mas-sequential-thinking.git
cd mcp-server-mas-sequential-thinking
uv pip install . # or: pip install .
配置 MCP 客户端
添加到 MCP 客户端配置中:
{
"mcpServers": {
"sequential-thinking": {
"command": "mcp-server-mas-sequential-thinking",
"env": {
"LLM_PROVIDER": "deepseek",
"DEEPSEEK_API_KEY": "your_api_key",
"EXA_API_KEY": "your_exa_key_optional"
}
}
}
}
环境变量
# LLM provider (required)
LLM_PROVIDER="deepseek" # deepseek, groq, openrouter, github, anthropic, ollama
DEEPSEEK_API_KEY="sk-..."
# Optional: override the models per provider (prefixed by provider name)
# DEEPSEEK_ENHANCED_MODEL_ID="deepseek-chat"
# DEEPSEEK_STANDARD_MODEL_ID="deepseek-chat"
# Optional: web research (enables ExaTools)
# EXA_API_KEY="your_exa_api_key"
# Optional: custom endpoint
# LLM_BASE_URL="https://custom-endpoint.com"
# Optional: team orchestration mode (standard/broadcast, route, coordinate)
# TEAM_MODE="standard"
直接运行服务
mcp-server-mas-sequential-thinking # installed script
uv run mcp-server-mas-sequential-thinking # or via uv
开发
# Install with dev dependencies
uv pip install -e ".[dev]"
# Code quality
uv run ruff check . --fix
uv run ruff format .
uv run mypy .
# Run tests
uv run pytest tests/
# Or use the Makefile
make test # all tests with coverage + quality checks
make test-fast # fast run without coverage
make check-all # all quality checks
使用 MCP Inspector 测试
npx @modelcontextprotocol/inspector uv run mcp-server-mas-sequential-thinking
打开 http://127.0.0.1:6274/ 并测试 sequentialthinking 工具。
Token 消耗警告
与单 Agent 工具相比,多 Agent 架构消耗的 token 显著更多——每次 sequentialthinking 调用大约多出 5-10 倍,因为每次调用都会触发多个专门 Agent。其代价是获得更深入、更多视角的分析。
项目结构
mcp-server-mas-sequential-thinking/
├── src/mcp_server_mas_sequential_thinking/
│ ├── main.py # MCP server entry point (MCPServer)
│ ├── processors/
│ │ ├── multi_thinking_core.py # Specialist agent definitions
│ │ └── multi_thinking_processor.py # Parallel sequence execution
│ ├── routing/
│ │ ├── ai_complexity_analyzer.py # AI complexity analysis
│ │ ├── complexity_types.py # Complexity metric models
│ │ └── multi_thinking_router.py # Fixed full_exploration routing
│ ├── services/
│ │ ├── server_core.py # ThoughtProcessor implementation
│ │ ├── processing_orchestrator.py # Agno Team orchestration
│ │ ├── workflow_executor.py
│ │ └── context_builder.py
│ ├── infrastructure/
│ │ ├── persistent_memory.py # SQLite session storage
│ │ └── learning_resources.py # Agent learning machine
│ ├── security/rate_limiter.py # Rate limiting and request validation
│ └── config/
│ ├── modernized_config.py # Provider strategies
│ └── constants.py # System constants
├── scripts/mcp_python_client_smoke.py # Protocol smoke test
├── tests/ # Unit and integration tests
├── pyproject.toml
└── Makefile
更新日志
版本历史请参阅 CHANGELOG.md。
贡献
欢迎贡献。请确保:
- 代码符合项目风格(ruff、mypy)
- 提交消息采用约定式提交格式
- 提交 PR 前所有测试均通过
- 按需更新文档
许可证
本项目尚未声明许可证。如果需要复用本项目,请参阅 许可证讨论。
致谢
- 使用 Agno v2.x 构建
- Model Context Protocol 由 Anthropic 提供
- 研究能力由 Exa 提供支持(可选)
- 多维思考的灵感来自 Edward de Bono 的研究成果
支持
- GitHub Issues:报告 Bug 或请求功能
- 文档:请参阅 CLAUDE.md,了解实现说明
- MCP 协议:MCP 官方文档
评论
一个开放协议,规定了 AI 应用如何以统一方式连接外部工具与数据源。客户端负责与模型对话,MCP 服务负责提供工具、资源和提示模板,两者通过标准消息通信,同一个服务可以被不同客户端复用。