Skip to main content
Glama

mutual-review-mcp

PyPI version License: MIT Python: 3.10+ MCP

📖 解説記事 (日本語): 自作MCPサーバーを書いて公開するまで

Claude × GPT-4o 相互コードレビュー MCP サーバー

2つの LLM がそれぞれ独立にコードをレビューし、Claude が両方の指摘を統合した最終レポートを返す MCP (Model Context Protocol) サーバーです。

30秒で読める要約

  • Claude Desktop / Claude Code / 任意の MCP クライアントから呼べる

  • review_file / review_code / review_diff の 3 ツール

  • 拡張子から言語自動推定 (.py → python, .ts → typescript, ...)

  • API キーは環境変数で渡す

  • コスト追跡はオプション (ENABLE_COST_TRACKING=1 で有効化)

Related MCP server: Claude Code Review MCP

クイックスタート (Claude Code)

claude mcp add mutual-review -- uvx mutual-review-mcp

事前に ANTHROPIC_API_KEYOPENAI_API_KEY を環境変数に設定してください。

インストール

pip install mutual-review-mcp
# または、インストールせず一時実行:
uvx mutual-review-mcp

詳細

A. uvx (推奨・一時実行)

uvx mutual-review-mcp              # MCPサーバー起動 (stdio)
uvx --from mutual-review-mcp mutual-review path/to/foo.py  # CLI

B. pip

pip install mutual-review-mcp
mutual-review-mcp                  # MCP サーバー起動
mutual-review path/to/foo.py       # 単発 CLI

C. git clone (開発用)

git clone https://github.com/miharu8686/mutual-review-mcp
cd mutual-review-mcp
pip install -e .[dev]
pytest

Claude Desktop 設定

%APPDATA%/Claude/claude_desktop_config.json (macOS は ~/Library/Application Support/Claude/claude_desktop_config.json) に:

{
  "mcpServers": {
    "mutual-review": {
      "command": "uvx",
      "args": ["mutual-review-mcp"],
      "env": {
        "ANTHROPIC_API_KEY": "sk-ant-...",
        "OPENAI_API_KEY": "sk-..."
      }
    }
  }
}

完全な例は examples/claude_desktop_config.json を参照。

Claude Code 設定

claude mcp add mutual-review -- uvx mutual-review-mcp

または .mcp.json を手書き:

{
  "mcpServers": {
    "mutual-review": {
      "command": "uvx",
      "args": ["mutual-review-mcp"]
    }
  }
}

ツール一覧

review_file

ファイルをディスクから読んで両モデルでレビュー。

引数

必須

説明

path

string

yes

レビュー対象ファイルの絶対パス

language

string

no

言語ヒント。省略時は拡張子から自動推定

context

string

no

コードの背景情報

synthesize

boolean

no

統合レポート生成 (default: true)

呼び出し例:

review_file(path="/repo/src/auth.py", context="OAuth2 callback handler")

review_code

コードスニペットを直接渡してレビュー。

引数

必須

説明

code

string

yes

レビュー対象コード

language

string

no

言語ヒント

filename

string

no

文脈用ファイル名

context

string

no

背景情報

synthesize

boolean

no

統合レポート生成 (default: true)

review_diff

unified diff 文字列を直接渡してレビュー。v0.1 では git 実行は行わない。 呼び出し側で git diff の出力を取得して渡す:

git diff HEAD~1 | mutual-review --diff -

引数

必須

説明

diff

string

yes

unified diff テキスト

context

string

no

背景情報

synthesize

boolean

no

統合レポート生成 (default: true)

v0.2 で review_diff_git(repo_path, ref) を追加予定。詳細は docs/ROADMAP.md

CLI

MCP を経由せず直接実行する CLI も同梱:

# ファイルレビュー (拡張子から言語自動推定)
mutual-review path/to/foo.py

# スニペット
mutual-review --code "def foo(): pass" --language python

# 標準入力から diff
git diff HEAD~1 | mutual-review --diff -

# 統合レポートを省略
mutual-review path/to/foo.py --no-synth

動作のしくみ

              [ Code / File / Diff ]
                       |
            +----------+----------+
            |                     |
            v                     v
   +-----------------+   +-----------------+
   | Claude reviewer |   |  GPT reviewer   |   (並列実行)
   +-----------------+   +-----------------+
            |                     |
            +----------+----------+
                       |
                       v
              +------------------+
              | Claude synthesizer|   (両レビューを統合)
              +------------------+
                       |
                       v
                 [ Final Report ]

統合レポートには以下が含まれます:

  1. 両モデルが合意した指摘 (高優先度)

  2. 各モデル固有の発見

  3. 優先順位付きアクションアイテム

  4. 総合判定 (Ready / Needs Minor Work / Needs Major Work)

コスト目安

multi_agent.py (520 行・約 7,000 文字) を 1 ファイルレビュー (統合あり) した実測値:

モデル構成

合計トークン (in/out)

1ファイルあたり

claude-haiku-4-5 + gpt-4o-mini

16,130 / 4,489

約 $0.025 (約 ¥4)

claude-sonnet-4-6 + gpt-4o

16,161 / 4,204

約 $0.105 (約 ¥16)

1 USD = 155 円換算・2026-05 時点。価格は reviewer.py の PRICING で管理しています。

--no-synth で 3 回中 1 回 (統合呼び出し) を省略でき、Sonnet/gpt-4o 構成で約 30% コスト削減できます。

モデル変更は環境変数で:

MUTUAL_REVIEW_CLAUDE_MODEL=claude-haiku-4-5-20251001
MUTUAL_REVIEW_GPT_MODEL=gpt-4o-mini

環境変数一覧

変数

デフォルト

説明

ANTHROPIC_API_KEY

(必須) Anthropic API キー

OPENAI_API_KEY

(必須) OpenAI API キー

MUTUAL_REVIEW_CLAUDE_MODEL

claude-sonnet-4-6

Claude モデル名

MUTUAL_REVIEW_GPT_MODEL

gpt-4o

GPT モデル名

ENABLE_COST_TRACKING

0

1/true でコスト追跡ログ出力

COST_LOG_PATH

OS依存 (XDG 準拠)

コストログの出力先 (usage.jsonl)

MUTUAL_REVIEW_CONFIG

OS依存

JSON 設定ファイルパス (APIキーフォールバック)

設定ファイル (オプション)

環境変数の代わりに JSON 設定ファイルから API キーを読むこともできます。

デフォルトパス:

  • Windows: %APPDATA%\mutual-review-mcp\config.json

  • macOS: ~/Library/Application Support/mutual-review-mcp/config.json

  • Linux: ~/.config/mutual-review-mcp/config.json

内容:

{
  "anthropic_api_key": "sk-ant-...",
  "openai_api_key": "sk-..."
}

エラーメッセージ

エラーメッセージは日英併記です:

ANTHROPIC_API_KEY が設定されていません / ANTHROPIC_API_KEY is not set. ...
Anthropic API への接続に失敗しました: ... / Failed to call Anthropic API: ...

ライセンス

MIT

関連

Available Tools

3 tools
review_codeA

Mutual code review on a code snippet. Claude and GPT-4o each review independently, then Claude synthesizes.

ParametersJSON Schema
NameRequiredDescriptionDefault
codeYesCode snippet to review
contextNoOptional context about the code
filenameNoOptional filename for context
languageNoLanguage hint (e.g. python)
synthesizeNoGenerate synthesis report (default true)

TDQS

A3.9/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations provided, so description carries full burden. It discloses the multi-model review process and synthesis step, providing useful behavioral context. However, it omits details like return format, side effects, or authorization needs.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single sentence that is front-loaded and contains zero wasted words. Every part conveys essential information about the tool's operation.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

With 5 parameters, no output schema, and sibling tools, the description explains the process but lacks usage context and return value information. It is adequate for a simple tool but has gaps in guiding selection among siblings.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so baseline is 3. The tool description does not add extra meaning beyond the schema descriptions for parameters like 'code', 'context', 'filename', 'language', and 'synthesize'.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool performs a mutual code review on a code snippet, specifying two models (Claude and GPT-4o) review independently then synthesize. It distinguishes from siblings 'review_diff' and 'review_file' by focusing on a code snippet rather than a diff or file.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No explicit guidance on when to use this tool versus alternatives. The description implies it is for standalone code snippets, but does not mention when not to use or provide criteria to differentiate from 'review_diff' or 'review_file'.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

review_diffB

Mutual code review on a unified diff string. Pass the diff text directly (no git invocation is performed).

ParametersJSON Schema
NameRequiredDescriptionDefault
diffYesUnified diff text
contextNoOptional context
synthesizeNoGenerate synthesis report (default true)

TDQS

B3.2/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden. It discloses that no git invocation is performed, but does not mention any side effects, authentication requirements, rate limits, or what the output (review comments) looks like.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Two sentences convey the core purpose and key usage note without any unnecessary words. The structure is front-loaded with the primary action.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool has three parameters and no output schema or annotations, the description omits important details such as expected output format, error conditions, prerequisites, and behavior when optional parameters are omitted. It is not sufficient for an agent to confidently invoke the tool.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100% with basic descriptions for all parameters. The description adds only minor clarification that 'diff' should be a unified diff string and that 'synthesize' generates a report. It does not significantly enhance understanding beyond the schema.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states it performs a mutual code review on a unified diff string. It differentiates from siblings like 'review_code' and 'review_file' by specifying that the diff text should be passed directly, not a file or code snippet.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description indicates when to use the tool (when a unified diff string is available) and clarifies that no git invocation is performed. However, it does not explicitly state when not to use it or provide alternatives to the siblings.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

review_fileA

Mutual code review on a file. Claude and GPT-4o each review independently, then Claude synthesizes the findings.

ParametersJSON Schema
NameRequiredDescriptionDefault
pathYesAbsolute path to the file
contextNoOptional context about the code
languageNoOptional language hint (e.g. python, typescript). Auto-detected from extension if omitted.
synthesizeNoGenerate synthesis report (default true)

TDQS

A3.7/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Description reveals the multi-model review process (Claude and GPT-4o) and synthesis, adding transparency beyond no annotations. However, it does not state whether the tool modifies the file or is read-only, nor does it mention any side effects.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Two sentences, front-loaded with purpose, efficient and clear with no wasted words.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Description explains the process but lacks detail on the output format or return value. Since no output schema exists, the agent needs more information about what the synthesis report looks like. Parameter coverage is good but completeness is moderate for a tool with four parameters.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, providing baseline 3. Description does not explain parameters beyond what schema already provides (e.g., what 'context' or 'synthesize' means in practice). No added value.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

Description clearly states 'Mutual code review on a file', specifying the action (review) and resource (file). It distinguishes from sibling tools like review_code and review_diff by focusing on file-level review.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Description implies use for file review but does not explicitly state when to choose this tool over review_code or review_diff. No direct guidance on prerequisites or exclusions.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Tool Schema Changelog

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

  1. 3 tool updatesv0.1.1
    • First observedreview_code
    • First observedreview_diff
    • First observedreview_file

TDQS

A3.9/5.0

Scored across 3 tools

Disambiguation5/5

Each tool targets a distinct input type (code snippet, diff string, file), with clear descriptions that prevent any ambiguity.

Naming Consistency5/5

All tools follow a consistent verb_noun pattern using 'review_' prefix followed by the input type, making them predictable and easy to understand.

Tool Count5/5

Three tools is perfectly scoped for a focused code review server, covering the essential input types without unnecessary bloat.

Completeness5/5

The tool set covers all common code review scenarios (snippet, diff, file), providing complete lifecycle coverage for the stated purpose.

Maintenance

ActivityMaintained
ResponsivenessNo issues

Related MCP Connectors

Related MCP Servers

  • F
    license
    A
    quality
    D
    maintenance
    An MCP server that connects Gemini 2.5 Pro to Claude Code, enabling users to generate detailed implementation plans based on their codebase and receive feedback on code changes.
    5
    14
    -
  • A
    license
    A
    quality
    B
    maintenance
    A multi-model AI orchestration MCP server for automated code review and LLM-powered analysis, integrating with Claude Code and OpenCode to orchestrate multiple AI models for code quality checks, security analysis, and multi-agent consensus.
    6
    35
    MIT