mcpField
S
Sequential Thinking Multi-Agent System (MAS)

Sequential Thinking Multi-Agent System (MAS)

本地服务
github.com/FradSerAI 与智能体3051 天前更新

关于 Sequential Thinking Multi-Agent System (MAS)

Sequential Thinking MAS 是一个 MCP 服务,通过一组专业 AI Agent 对每个思考步骤进行多视角分析。它基于 Agno 框架构建,适合需要结构化、多角度推理并能接受较高 Token 消耗的场景。

主要功能

  1. 01单一 sequentialthinking 工具支持多步推理循环
  2. 02六个专业 Agent 并行分析并由综合 Agent 汇总
  3. 03可选 ExaTools 联网研究,需设置 EXA_API_KEY
  4. 04支持 DeepSeek、Groq、Anthropic、Ollama 等多个提供方
  5. 05固定执行策略,每次调用路径一致

适用场景

  1. 01对复杂问题进行事实、风险与创意等多角度分析
  2. 02在 MCP 客户端中驱动结构化的逐步推理过程
  3. 03比较不同模型提供方在多 Agent 推理中的表现

MCP 相关

该项目作为 MCP 服务运行,暴露 sequentialthinking 工具,返回 should_continue 等结构化字段,指导客户端持续调用直至推理结束。

配置

本地服务的配置在各客户端中通用,复制后粘贴到客户端的 MCP 配置文件即可。

mcp.json · 通用配置
{
"mcpServers": {
"mas-sequential-thinking": {
"command": "npx",
"args": [
"-y",
"@smithery/cli"
]
}
}
}
启动命令npx -y @smithery/cli

本地服务需要在你的电脑上安装运行环境(如 Node.js 18+)。各客户端的配置文件位置不同,请参考客户端文档。

安装包
npm@smithery/cli

工具

还没有获取到工具列表

本地服务需要在你的电脑上运行后才能读取工具,维护者暂未提供工具列表。

详细介绍

Sequential Thinking Multi-Agent System(MAS) README 配图

Python Version Framework Twitter Follow

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_KEYdeepseek-chatdeepseek-chat
GroqGROQ_API_KEYopenai/gpt-oss-120bopenai/gpt-oss-20b
OpenRouterOPENROUTER_API_KEYdeepseek/deepseek-chat-v3-0324deepseek/deepseek-r1
GitHub ModelsGITHUB_TOKENopenai/gpt-5openai/gpt-5-min
AnthropicANTHROPIC_API_KEYclaude-3-5-sonnet-20241022claude-3-5-haiku-20241022
Ollama无devstral:24bdevstral: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。

贡献

欢迎贡献。请确保:

  1. 代码符合项目风格(ruff、mypy)
  2. 提交消息采用约定式提交格式
  3. 提交 PR 前所有测试均通过
  4. 按需更新文档

许可证

本项目尚未声明许可证。如果需要复用本项目,请参阅 许可证讨论。

致谢

  • 使用 Agno v2.x 构建
  • Model Context Protocol 由 Anthropic 提供
  • 研究能力由 Exa 提供支持(可选)
  • 多维思考的灵感来自 Edward de Bono 的研究成果

支持

评论

支持 Markdown

第一次接触 MCP?

从协议是什么,到在客户端里装上第一个服务,这几条回答覆盖了大多数入门问题。

一个开放协议,规定了 AI 应用如何以统一方式连接外部工具与数据源。客户端负责与模型对话,MCP 服务负责提供工具、资源和提示模板,两者通过标准消息通信,同一个服务可以被不同客户端复用。