consensus-mcp
ai-consensus-mcp
一个极简的 stdio Model Context Protocol 服务器,将“共识验证协议”公开为单一的
consensus工具。 为 Claude Code、Cursor、Windsurf 或任何 MCP 主机提供真正的多模型圆桌会议。
ai-consensus-core 的轻量级封装。一个工具,一个配置文件,零麻烦。
它能为你做什么
一个 MCP 工具:
consensus。 指向模型和角色列表,即可运行多轮辩论。任何兼容 OpenAI 的提供商。 xAI Grok、Anthropic(通过 OpenAI 兼容端点)、OpenAI、Groq、Together、Fireworks 或你的私有网关。一个适配器,可针对每个参与者进行配置。
实时进度。 每个结构化的引擎事件都会作为 MCP 进度通知 转发——主机可以实时渲染轮次、参与者、分歧和评分状态。
轻量级依赖。
@modelcontextprotocol/sdk、zod、ai-consensus-core。SSE 解析使用原生fetch——无需提供商 SDK。
Related MCP server: Claude Code AI Collaboration MCP Server
协议
关于实际协议(轮次、阶段、提示词、评分),请参阅 ai-consensus-core 协议图。本 README 仅涵盖服务器层面。
安装
通过 npm:
# Globally, for use as a binary
npm install -g ai-consensus-mcp
# Or as a project dependency
npm install ai-consensus-mcp或者克隆并运行:
git clone https://github.com/entropyvortex/ai-consensus-mcp.git
cd ai-consensus-mcp
npm install
npm run build配置
复制示例并进行编辑:
cp consensus.config.example.json ./consensus.config.json最小配置结构:
{
"providers": {
"xai": {
"baseUrl": "https://api.x.ai/v1",
"apiKeyEnv": "GROK_API_KEY"
},
"anthropic": {
"baseUrl": "https://api.anthropic.com/v1",
"apiKeyEnv": "ANTHROPIC_API_KEY"
}
},
"participants": [
{ "id": "grok", "provider": "xai", "modelId": "grok-4", "personaId": "pessimist" },
{ "id": "domain", "provider": "anthropic", "modelId": "claude-sonnet-4-6", "personaId": "domain-expert" },
{ "id": "devil", "provider": "xai", "modelId": "grok-4", "personaId": "devils-advocate" }
],
"judge": {
"provider": "xai",
"modelId": "grok-4"
}
}配置参考
providers.<id>.baseUrl string OpenAI-compatible base URL. No trailing /chat/completions.
providers.<id>.apiKeyEnv string Name of the env var holding the API key.
providers.<id>.extraHeaders object? Static headers sent on every request (rarely needed).
participants[].id string Stable participant id (appears in events + progress).
participants[].provider string Key into providers.
participants[].modelId string Opaque model id the provider accepts.
participants[].personaId enum One of: pessimist, first-principles, vc-specialist,
scientific-skeptic, optimistic-futurist,
devils-advocate, domain-expert.
participants[].label string? Optional display label.
judge.provider string? Key into providers.
judge.modelId string? Opaque judge model id.
judge.temperature number? Defaults to 0.3.
judge.maxOutputTokens number? Defaults to 1500.
defaults.maxRounds int? 1–10, defaults 4.
defaults.earlyStop bool? Defaults true.
defaults.convergenceDelta number? Defaults 3.
defaults.disagreementThreshold number? Defaults 20.
defaults.blindFirstRound bool? Defaults true.
defaults.randomizeOrder bool? Defaults true.
defaults.participantTemperature number? Defaults 0.7.
defaults.maxOutputTokens int? Defaults 1500.
defaults.useJudge bool? Defaults true if `judge` is declared, else false.配置加载器会拒绝列表中未包含的任何字段——拼写错误会直接报错,而不是静默失败。
独立运行
export GROK_API_KEY=xai-...
export ANTHROPIC_API_KEY=sk-ant-...
ai-consensus-mcp --config ./consensus.config.json服务器通过 stdio 使用 JSON-RPC 进行通信。启动时,类似以下的一行就绪信息:
ai-consensus-mcp ready — 3 participant(s) from 2 provider(s), judge=grok-4 (config: /abs/consensus.config.json)会被写入 stderr;stdout 保留给 MCP 协议流。
在 MCP 主机中注册
Claude Desktop
编辑 ~/Library/Application Support/Claude/claude_desktop_config.json (macOS) 或 Windows 等效文件:
{
"mcpServers": {
"consensus": {
"command": "ai-consensus-mcp",
"args": ["--config", "/absolute/path/to/consensus.config.json"],
"env": {
"GROK_API_KEY": "xai-...",
"ANTHROPIC_API_KEY": "sk-ant-..."
}
}
}
}(如果你没有全局安装,请将 "command": "ai-consensus-mcp" 替换为 "command": "node",并将 args 指向 /path/to/ai-consensus-mcp/dist/index.js。)
重启 Claude Desktop。你应该会看到一个 consensus 工具可用。
Claude Code
claude mcp add consensus \
--scope user \
-- ai-consensus-mcp --config /absolute/path/to/consensus.config.json或者直接使用相同的 command / args / env 结构编辑 ~/.claude.json。
Cursor、Windsurf 及其他主机
将它们指向 ai-consensus-mcp --config <path>/consensus.config.json,并在环境中设置相关的提供商 API 密钥。仅支持 stdio 传输。
consensus 工具
输入
{
"prompt": "Should an early-stage startup adopt microservices from day one?",
"maxRounds": 4, // optional, 1–10
"participantIds": ["grok", "domain"], // optional — subset of configured participants
"earlyStop": true, // optional
"judge": true, // optional — defaults to config.defaults.useJudge
"blindFirstRound": true, // optional
"randomizeOrder": true, // optional
"convergenceDelta": 3, // optional
"disagreementThreshold": 20, // optional
"participantTemperature": 0.7, // optional
"maxOutputTokens": 1500, // optional
"randomSeed": 42 // optional — deterministic round-order shuffle
}仅 prompt 是必需的。其他所有内容都会回退到配置的 defaults,然后再回退到引擎的默认值。
输出
每次成功调用都会产生两个工件:
content[0].text— 人类可读的 Markdown 摘要:最终得分、持续时间、停止原因
每轮得分表
最终轮回复,按角色 + 模型标记
裁判综合意见(如果
judge: true)
structuredContent— 完整的ConsensusResultJSON,供程序化消费者使用。
进度通知
每个结构化的引擎事件都会作为 MCP notifications/progress 消息转发。Token 级别的流式事件会被故意丢弃——因为它们会淹没通道。
引擎事件 | 进度消息示例 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
progress 在 roundComplete 和 synthesisComplete 时单调递增;total 为 maxRounds + (judge ? 1 : 0)。
错误
配置加载错误 在启动时是致命的,并会打印到 stderr,包含出错的字段路径。
工具输入错误 返回
{ isError: true, content: [{ type: "text", text: "…" }] }— 主机可以看到它们,但服务器保持运行。提供商错误(HTTP 非 2xx,空流)会被捕获到每个参与者的
response.error字段中,运行将继续处理剩余参与者。错误在进度流和最终结构化结果中均可见。取消。 当主机取消工具调用时,
AbortSignal会传播到每个正在进行的fetch,引擎将返回一个stopReason: "aborted"的ConsensusResult。
限制与非目标
无持久化。 每次工具调用都是一次全新的运行。如果你需要历史记录,请在主机端记录
structuredContent。无 HTTP 传输。 仅限 stdio。如需 HTTP/SSE,请直接封装
ai-consensus-core。无 Token 预算强制执行。
maxOutputTokens仅供每次调用参考;请在你的提供商仪表板上设置使用量提醒。无多运行调度。 每次调用运行一次,如果主机排队则按顺序执行。
如果这些中的任何一个成为你最需要的功能,核心库是进行扩展的正确位置——这个服务器被设计得非常小巧。
开发
git clone https://github.com/entropyvortex/ai-consensus-mcp.git
cd ai-consensus-mcp
npm install
npm run test # vitest — config loader + MCP handshake integration
npm run build
npm start -- --config ./consensus.config.json理念
核心库应该能够在任何地方运行——Next.js、CLI、Worker、Durable Object 或其他 MCP 服务器。这就是为什么它不知道什么是 LLM 提供商的原因。
这个包是大多数人首先关心的“任何地方”:一个可以放入 Claude Code、Cursor、Windsurf 或任何支持该协议的主机中的 stdio MCP 服务器。它被刻意保持得很小——加载配置、转发事件,仅此而已。如果你需要更多功能,核心库就在那里。
另请参阅
ai-consensus-core— 底层库。如果你需要 HTTP 传输、自定义调度程序或更深层的集成,请直接使用它。
许可证
MIT
entropyvortex 技术栈的一部分 — 由 Marcelo Ceccon 提供的实用、无废话的 AI 开源项目。
在巴西用 ❤️ 制作。
MIT 许可证 • 为交付而生。
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections. Dates show when Glama detected each change.
No tool schema history has been recorded yet.
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Connectors
MCP server for building and testing AI agents with multi-model experimentation and insights.
MCP server unifying ERPs, CRMs, APIs and knowledge base for Claude, ChatGPT and Gemini.
AI Reasoning Cache & Consensus Layer with 11 MCP tools via Streamable HTTP.
MCP server providing access to the Scorecard API to evaluate and optimize LLM systems.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceA Model Context Protocol server that enables collaborative debates between multiple AI agents, allowing them to discuss and reach consensus on user prompts.1MIT
- AlicenseBqualityDmaintenanceAn MCP server that enables multi-provider AI collaboration using models like DeepSeek, OpenAI, and Anthropic through strategies such as parallel execution and consensus building. It provides specialized tools for side-by-side content comparison, quality review, and iterative refinement across different AI providers.41MIT
- AlicenseAqualityCmaintenanceAn MCP server that enables users to query, compare, and synthesize responses from multiple local and cloud LLMs simultaneously using existing subscriptions. It provides tools for parallel model evaluation, consensus polling with an LLM-as-judge, and response synthesis across different model providers.8815MIT
- AlicenseNot gradedqualityDmaintenanceAn MCP server that orchestrates multiple AI agents in parallel to get diverse perspectives on a single topic, supporting debate, review, and quick modes.341Apache 2.0
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/entropyvortex/ai-consensus-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server