Skip to main content
Glama

ai-consensus-mcp

Model Context Protocolの最小限のstdioサーバーであり、Consensus Validation Protocolを単一の consensus ツールとして公開します。 Claude Code、Cursor、Windsurf、またはその他のMCPホストに、本格的なマルチモデルの円卓会議機能を提供します。

npm license

ai-consensus-coreの薄いラッパーです。ツールは1つ、設定ファイルは1つ、面倒なことは一切ありません。

提供機能

  • MCPツール consensus: モデルとペルソナのリストを指定して、複数ラウンドの議論を実行します。

  • OpenAI互換プロバイダーに対応: xAI Grok、Anthropic(OpenAI互換エンドポイント経由)、OpenAI、Groq、Together、Fireworks、または独自のプライベートゲートウェイ。アダプターは1つで、参加者ごとに設定可能です。

  • ライブ進捗表示: エンジンの構造化イベントはすべてMCPの進捗通知として転送されます。ホスト側でラウンド、参加者、意見の相違、スコアの状況をリアルタイムで表示できます。

  • 依存関係が少ない: @modelcontextprotocol/sdkzodai-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を使用します。起動時に以下のような準備完了行が stderr に書き込まれます。

ai-consensus-mcp ready — 3 participant(s) from 2 provider(s), judge=grok-4 (config: /abs/consensus.config.json)

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、その他のホスト

関連するプロバイダーのAPIキーを環境変数に設定し、ai-consensus-mcp --config <path>/consensus.config.json を指定してください。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、次にエンジンのデフォルト値が使用されます。

出力

呼び出しが成功するたびに2つのアーティファクトが生成されます:

  1. content[0].text — 人間が読めるMarkdown形式の要約:

    • 最終スコア、所要時間、停止理由

    • ラウンドごとのスコア表

    • ペルソナとモデルでラベル付けされた最終ラウンドの回答

    • 判定者の統合結果(judge: true の場合)

  2. structuredContent — プログラムで利用するための完全な ConsensusResult (JSON形式)。

進捗通知

エンジンの構造化イベントはすべてMCPの notifications/progress メッセージとして転送されます。トークンレベルのストリーミングイベントは、チャンネルを溢れさせるため意図的に除外されています。

エンジンイベント

進捗メッセージの例

roundStart

Round 2/4 — Counterarguments (sequential) starting

participantStart

grok (grok-4) thinking…

participantComplete

grok done — confidence=72 (4132ms)

confidenceUpdate

running avg round 2: 74.5 (last: grok=72)

disagreementDetected

⚠ disagreement: Risk Analyst vs Optimistic Futurist (Δ=35)

roundComplete

Round 2 complete — score=71, avg=74.5, σ=7.0, disagreements=1

earlyStop

✓ Early stop at round 3: Consensus score delta 2.0 … is at or below …

synthesisStart

Judge synthesis starting (grok-4)…

synthesisComplete

Judge synthesis complete (confidence=84)

finalResult

Consensus complete — finalScore=76, rounds=3, stopReason=converged

progressroundComplete および synthesisComplete で単調増加します。totalmaxRounds + (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 を直接ラップしてください。

  • トークン予算の強制なし: maxOutputTokens は呼び出しごとのアドバイスです。使用量アラートはプロバイダーのダッシュボードで設定してください。

  • 複数実行のスケジューリングなし: 1呼び出しにつき1実行です。ホストがキューイングすれば順次実行されます。

これらが必要になった場合は、コアライブラリを拡張するのが最適です。このサーバーは意図的に小さく設計されています。

開発

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オープンソース。

ブラジルより愛を込めて。

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.

Maintenance

ActivityMaintained
ResponsivenessNo issues

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

Related MCP Servers

Latest Blog Posts

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