Skip to main content
Glama

opus-advisor-mcp

Claude Codeがタスクの途中でOpusを戦略アドバイザーとして活用できるようにするMCPサーバーです。SonnetやHaikuでセッションを実行し、必要に応じてOpusに複雑な意思決定をエスカレーションできます。既存のClaude Codeサブスクリプションを使用するため、追加のAPIキーは不要です。

AnthropicのAdvisor Strategyに触発されています。

仕組み

┌─────────────────────────────────────────────┐
│  Claude Code (Sonnet)                       │
│                                             │
│  "I need to decide on the DB schema..."     │
│        │                                    │
│        ▼                                    │
│  calls consult_opus MCP tool                │
│        │                                    │
└────────┼────────────────────────────────────┘
         │
         ▼
┌─────────────────────────────────────────────┐
│  opus-advisor MCP server                    │
│                                             │
│  1. Reads prior consultation history        │
│  2. Reads requested files from disk         │
│  3. Pipes prompt to: claude -p --model opus │
│  4. Logs advice to advisor-log.md           │
│  5. Returns advice to Sonnet                │
└─────────────────────────────────────────────┘

APIキーは不要です。このサーバーは claude CLI を呼び出し、既存の認証情報を利用します。

Related MCP server: codex-bridge

インストール

npm install -g opus-advisor-mcp

または、クローンしてローカルでビルドします:

git clone https://github.com/Divinci-AI/opus-advisor-mcp.git
cd opus-advisor-mcp
npm install
npm run build

設定

プロジェクトの .mcp.json または ~/.claude/.mcp.json に追加します:

{
  "mcpServers": {
    "opus-advisor": {
      "command": "opus-advisor",
      "timeout": 180000
    }
  }
}

ローカルにインストールした場合(グローバルではない場合):

{
  "mcpServers": {
    "opus-advisor": {
      "command": "node",
      "args": ["/path/to/opus-advisor-mcp/dist/index.js"],
      "timeout": 180000
    }
  }
}

設定を追加した後、Claude Codeを再起動してください。

ツール

consult_opus

Opusに戦略的なアドバイスを求めます。

パラメータ

型

デフォルト

説明

question

string

必須

アドバイスが必要な質問や問題

context

string

オプション

追加のコンテキスト、制約、背景情報

files

string[]

オプション

コンテキストとして含めるファイルパス(プロジェクトルートからの相対パス)

effort

"low"

"medium"

"high"

"medium"

Opusの推論の努力レベル

include_history

boolean

true

継続性のために過去の相談履歴を含めるか

例:

{
  "question": "Is this database migration safe under concurrent writes?",
  "files": ["src/db/migration-042.ts", "src/db/schema.ts"],
  "effort": "high"
}

read_advisor_log

過去の呼び出しからの相談ログを読み取ります。

パラメータ

型

説明

last_n

number

返す最近の相談件数(省略した場合はすべて)

read_advisor_meta

構造化されたメタデータ(レイテンシ、トークン数、努力レベル)を読み取ります。

パラメータ

型

説明

last_n

number

返す最近のエントリ数(省略した場合はすべて)

clear_advisor_log

相談ログとメタデータをクリアして、新しく開始します。

機能

  • APIキー不要 — claude CLI経由で既存のClaude Codeサブスクリプションを使用

  • プロジェクトごとのログ — 相談履歴はプロジェクトごとに ~/.opus-advisor/<project>-<hash>/ に保存されます

  • コード認識コンテキスト — ファイルパスを直接渡すと、サーバーがそれを読み取り、ラベル付きコードブロックとして注入します

  • 相談の継続性 — 過去のアドバイスがコンテキストとしてフィードバックされるため、Opusは以前の決定に基づいて構築できます

  • トークン認識履歴 — 履歴はエントリ数(5件)とトークン予算(約6Kトークン)の両方で制限されます

  • メタデータ追跡 — レイテンシ、トークン見積もり、努力レベルを advisor-meta.jsonl で追跡

  • シグナル保護 — 終了したプロセスからの部分的な出力は破棄され、アドバイスとして返されません

  • パストラバーサルガード — ファイル読み取りはプロジェクトルート内に留まるよう検証されます

セキュリティ

  • パストラバーサル保護: files パラメータは、解決されたすべてのパスがプロジェクトルートディレクトリ内に留まることを検証します。../../etc/passwd のようなパスや、プロジェクト外の絶対パスは拒否されます。

  • バイナリファイルフィルタリング: 一般的なバイナリ拡張子(画像、実行ファイル、アーカイブなど)は自動的にスキップされます。

  • シェル実行なし: サーバーは配列引数で spawn を使用し、stdin経由でプロンプトをパイプします。シェル補間は発生しません。

  • ローカルのみ: MCPサーバーはstdio経由でローカルで実行されます。ネットワークポートは開かれません。

  • 相談ログ: ~/.opus-advisor/ にプレーンテキストで保存されます。これらには、相談内容のコードスニペットや質問が含まれる場合があります。機密コードが含まれている場合は、これらのファイルをコミットしたり共有したりしないでください。

環境変数

変数

説明

ADVISOR_LOG_DIR

ログディレクトリを上書きします(デフォルト: ~/.opus-advisor/<project>-<hash>/)

AnthropicのAdvisorツールとの比較

Anthropicの advisor_20260301 は、サーバーサイドのAPI機能であり、アドバイザーは単一のAPIリクエスト内で会話の全記録を参照します。このMCPサーバーは異なるアプローチをとっています:

Anthropic Advisorツール

opus-advisor-mcp

コンテキスト共有

全会話記録(サーバーサイド)

質問 + ファイル + 履歴(クライアントサイド)

認証

APIキーが必要

既存のClaude Codeサブスクリプションを使用

統合

APIレベル (tools 配列)

MCPツール(現在のClaude Codeで動作)

永続性

なし

Markdownログ + JSONLメタデータ

コスト

Opus料金でトークンごとに課金

サブスクリプションに含まれる

要件

  • Node.js >= 18

  • Claude Code CLIがインストールされ、認証されていること

ライセンス

MIT

Available Tools

4 tools
clear_advisor_logClear Advisor LogA
Destructive

Clear the consultation log and metadata to start fresh for this project.

Inputs: no named parameters.

consult_opusConsult Opus AdvisorA
Read-only

Consult Claude Opus 4.7 for strategic advice. Opus runs via the Claude Code CLI with your existing subscription — no API key needed. The advisor maintains a per-project consultation log for continuity across calls. History is capped by both entry count (5) and token budget (~6K tokens) to prevent context bloat. Use this for architecture decisions, complex debugging, code review, or any problem that benefits from deeper reasoning.

Inputs: question (required), context, effort, files, +1 more.

read_advisor_logRead Advisor LogA
Read-only

Read the consultation log from prior Opus advisor calls for this project. Useful for reviewing past advice or getting context on decisions already made.

Inputs: last_n.

read_advisor_metaRead Advisor MetadataA
Read-only

Read structured metadata (latency, token counts, effort levels) from all consultations. Useful for understanding cost and performance patterns.

Inputs: last_n.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A4.3/5.0

    Scored across 4 tools

    Disambiguation5/5

    Each tool has a uniquely defined purpose: clearing the log, consulting Opus, reading the log, and reading metadata. No two tools overlap in functionality, so an agent can easily distinguish them.

    Naming Consistency5/5

    All tools follow a consistent verb_noun pattern using snake_case (e.g., consult_opus, read_advisor_log). The naming convention is uniform across the entire set.

    Tool Count5/5

    Four tools is a well-scoped count for an advisor MCP server. Each tool addresses a distinct need (consultation, log management, metadata access) without unnecessary extras.

    Completeness4/5

    The tool set covers the core operations: consultation, log reading/clearing, and metadata inspection. A minor gap is the lack of a configuration tool to adjust Opus parameters, but the current surface is sufficient for most workflows.

    Maintenance

    ActivityInactive
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers