Skip to main content
Glama

teammate-mcp

Claude CodeとOpenAI Codexが、iTermのペインを通じて互いに質問できるようにします。デーモンは不要。プロジェクトごとに手動で編集する.configもありません。2つのペインを開くだけで、彼らは会話を始められます。

┌──────────── iTerm window ─────────────┐
│ claude  (left)        codex  (right)  │
│ ───────────────────   ─────────────── │
│ > implement quoter    > [teammate-mcp │
│   I'll ask Codex...     ASK ... what  │
│   ⏺ Codex answered:     is 2+2?]      │
│      4                  • 4           │
└───────────────────────────────────────┘

teammate-mcpは、それを読み込むCLIに対して2つのツールを提供する小さなMCPサーバーです:

  • mcp__teammate__ask_codex(question, timeout) — Claudeから呼び出し

  • mcp__teammate__ask_claude(question, timeout) — Codexから呼び出し

このサーバーはiTerm2 Python APIを使用して、質問をもう一方のペインに送信し、返信を読み取ります。ターゲットのペインは実行中のプロセスによって自動的に検出されるため、タブにラベルを付けたり、プロジェクトごとに事前設定したりする必要はありません。

なぜこれが必要か?

既存のマルチエージェント用ハーネスは、大きく分けて2つのキャンプに分かれています:

  1. 重量級: デーモン、プロジェクトごとの設定ファイル、不透明なセッション状態。午前2時に何かが壊れて原因がわからなくなるまでは素晴らしいものです。

  2. 単一プロセス: 1つのモデルが内部でサブエージェントを調整するため、ユーザーには最終的な回答しか見えません。

teammate-mcpは第3の選択肢を目指しています。2つのエージェントがターミナル上で隣り合って目に見える形で動作し、両方のやり取りをリアルタイムで読むことができ、唯一の「インフラ」はテキストを送信して画面を読み取る数百行のPythonコードだけです。

Related MCP server: claude-mux-iterm

検証済みの双方向ラウンドトリップ

macOS 14、iTerm 3.6.8、Claude Code 2.1.119 + Opus 4.7、Codex 0.125.0の開発中にライブキャプチャ:

{"event":"ask.enqueue","id":"…c5d085","from_":"claude","to":"codex","len":49}
{"event":"ask.send",   "id":"…c5d085","to":"codex","session_id":"7E39032F-…"}
{"event":"ask.complete","id":"…c5d085","answer_len":3}

「2足す2は?数字のみで答えて」というプロンプトに対するask.send → ask.completeの間隔は3.0秒でした。その大部分はブリッジの処理時間ではなく、Codexの思考時間です。5回連続の実行で、すべて1.5〜4.5秒でループが完了しました。

tests/results/にキャプチャされた6つの独立したタイミングレポートがリポジトリに含まれているため、ご自身で数値を確認できます。


クイックスタート

1. インストール

git clone https://github.com/jonghklee/teammate-mcp.git
cd teammate-mcp
uv venv
uv pip install -e .

2. 両方のCLIにサーバーを登録

# Claude Code
claude mcp add teammate -s user -- $PWD/.venv/bin/teammate-mcp serve

# Codex
codex  mcp add teammate           -- $PWD/.venv/bin/teammate-mcp serve

3. ペインを開く

2つの選択肢があります:

オプションA — bin/teamに新しいiTermウィンドウを開かせる:

./bin/team

オプションB — すでに開いているiTermウィンドウを使用する。1つのペインでclaudeを、もう1つのペインでcodexを実行するだけです。teammate-mcpはプロセス名でそれらを見つけるため、ラベルは不要です。

4. (初回のみ)エージェントに動作ルールを渡す

templates/AGENTS.mdをプロジェクトのルートに配置します。Claude CodeとCodexの両方が自動的にそれを読み取ります(これは両者が従う慣習です)。このファイルは、いつ、どのように互いを呼び出すかを彼らに伝えます。

5. 試してみる

Claudeのペインで以下のように入力します:

Ask Codex what timezone library it prefers in Python and tell me what
it said.

Claudeがmcp__teammate__ask_codexを呼び出し、右側のペインに質問が表示され、Codexが応答し、Claudeがその回答を中継する様子が見られます。


仕組み

┌──────────────────────────────────────────────────────┐
│  Claude pane              Codex pane                  │
│  ─────────────            ─────────────               │
│   user prompt              [teammate-mcp ASK …]       │
│        │ tool call              ▲                     │
│        ▼                        │ async_send_text     │
│  ┌──────────────┐               │                     │
│  │ teammate-mcp │  ─────────────┘                     │
│  │  (FastMCP)   │  ◄────── async_get_screen_contents  │
│  └──────────────┘                                     │
│        │                                              │
│        └─► returns extracted answer to Claude         │
└──────────────────────────────────────────────────────┘

各ask_codex(またはask_claude)呼び出しに対して:

  1. 一意のマーカーを生成し、ディスク上のキューにメッセージをエンキューします(pending/ → inflight/へのアトミックなリネーム)。

  2. ターゲットのペインを特定します:

    • TEAMMATE_<UPPER>_SESSION_ID環境変数のオーバーライドを優先

    • それ以外の場合は、すべてのライブプロセスを列挙(psスタイル)し、claudeまたはcodexプロセスを見つけ、そのTERM_SESSION_ID環境変数を読み取り、iTermのセッションリストと照合します。これはtmux、ログインシェル、pyenvラッパー越しでも機能します — 環境変数が継承される場所であればどこでも動作します。

    • フォールバックとして、作業ディレクトリ(cwd)を優先したjobName / commandLineのマッチングを行います。

  3. プロンプト + マーカーで返信を終了するリクエストをasync_send_textで送信します。

  4. マーカーを求めてasync_get_screen_contentsをポーリングします。入力したプロンプト自体にマーカーテキストが含まれている(ペインにエコーされる)ため、サーバーは返信が完了したと判断する前に、マーカーが2回出現することを要求します。

  5. 2つのマーカーの間の回答を切り出し、ask.completeをログに記録し、呼び出し元に回答を返します。

「設定不要」の真の意味

設定が必要なのは(一度だけ)、上記のステップ2におけるMCP登録のみです。その後は、claudeとcodexのペインを持つiTermウィンドウであれば、teammate-mcpをインストールする前に開いていたウィンドウを含め、すべてそのまま動作します。

.teammate.tomlを書く必要も、teammate startを実行する必要も、どのセッションIDがどれかを覚える必要もありません。

テスト

uv pip install -e ".[dev]"
pytest                              # 18 unit + integration tests
python scripts/auto_demo.py         # full end-to-end demo (spawns iTerm)

ユニットテストは、キュー、ANSI/マーカー処理、サーバーモジュールのインポート、およびモックを使用したiTermセッション検出ロジックをカバーしています。エンドツーエンドのデモは実際のiTermウィンドウを開き、Claude → Codex → Claudeのラウンドトリップを実行します。これには両方のCLIへのログインが必要であり、通常のAPI料金が発生します。

実行ごとのタイミングレポートはtests/results/*.jsonlに書き込まれます。リポジトリにコミット済みのものは合成ではなく、実際のデータです。

トラブルシューティング

「iTerm Python API is not enabled」 — 設定 → 一般 → マジック → 「Python APIを有効にする」にチェックを入れてください。teammate-mcpが最初に接続する際、iTermは許可を求めますので、「許可」をクリックしてください。

「asyncio.run() cannot be called from a running event loop」 — 0.1.0より古いteammate-mcpを使用しています。mainをプルしてください。ツールは現在asyncとして宣言されています。

「ツールが自分のプロンプトエコーのみを返した」 — プロンプトのターゲットペインで間違ったCLIが実行されています(例:ルックアップが同じプロセスを実行している隣接ペインを選択した)。ペインを明示的に固定してください:

export TEAMMATE_CLAUDE_SESSION_ID=<unique id from iTerm>
export TEAMMATE_CODEX_SESSION_ID=<unique id from iTerm>

(各ペインのunique idは、ウィンドウメニュー → ウィンドウ設定 → 識別子、またはAppleScriptから読み取ることができます。)

「タイムアウト内にマーカーが検出されなかった」 — 相手側のエージェントが<<DONE_…>>を出力し忘れています。AGENTS.mdに明示的なリマインダーを追加してください。同梱のテンプレートにはすでに含まれています。

ライセンス

MIT — LICENSEを参照してください。

謝辞

このプロジェクトは、2026年におけるClaude CodeとCodexの運用方法に関する公開研究に基づいた議論から生まれました:

  • AnthropicのPlan-Generate-VerifyおよびInitializer + Coding Agentハーネスに関する論文(Rajasekaran 2026-03; Justin Young 2025-11)。

  • IndyDevDanのclaude-code-hooks-mastery(可観測性パターンについて)。

  • OthmanAdiのplanning-with-files(「構造化ファイルがチャット履歴ではなくセッションをブリッジする」というアイデアについて)。

  • Boris ChernyのHow I use Claude Codeスレッドにおける「検証ループ」ルール。

  • Geoffrey HuntleyのRalph Wiggumループ(「ターンごとに新鮮なコンテキスト」という直感について)。

実装におけるiTerm Python APIのパターンは、https://iterm2.com/python-api/のiTerm2ドキュメントに負うところが大きいです。


韓国語要약

CCBのような事前設定なしでclaude / codexが互いに質問できるようにする小さなMCPサーバーです。

  • iTermの2つのペインにclaudeとcodexを起動するだけです。ラベルも、configも、デーモンもありません。

  • iTerm Python APIで相手のペインを自動検知(実行プロセス + 環境変数TERM_SESSION_IDマッチング)します — tmux内で起動しても動作します。

  • メッセージはpush、応答はpollingで受け取り、すべてのラウンドトリップは~/.teammate-mcp/logs/<日付>.jsonlに記録されます。

  • 実測ラウンドトリップ時間: 2 + 2 = 4の質問基準でsend → complete 3.0秒 (大部分はCodexの思考時間)。

インストールは上記の英語のクイックスタート1〜3段階、使い方は普段通りClaudeに「Codexに聞いてみて」と指示するだけです。

Available Tools

4 tools
ask_claudeA

Ask the Claude pane a question and return its answer.

Use this from Codex when you want Claude's plan, design feedback, or a sanity check.

ParametersJSON Schema
NameRequiredDescriptionDefault
questionYes
timeoutNo

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

A3.6/5.0
Behavior2/5

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

No annotations are provided, so the description must carry full burden. It only states it returns an answer, but does not disclose potential side effects, timeout behavior, or whether it is a read-only operation. The agent lacks critical behavioral context.

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 concise with only two short sentences, no redundant information, and the primary action is front-loaded. Every word adds value.

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?

The tool is simple with 2 parameters and an output schema, but the description lacks detail on the output format and usage constraints. An agent can infer basic usage but may miss nuances like timeout meaning or question style expectations.

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

Parameters2/5

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

Schema coverage is 0%, yet the description adds no information about the 'question' or 'timeout' parameters beyond what the schema provides. For a tool with 2 parameters and no enum constraints, the description should compensate but fails to do so.

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 verb 'Ask' and the resource 'Claude pane', specifying that it returns an answer. The sibling tool 'ask_codex' helps differentiate, making the purpose unambiguous.

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

Usage Guidelines4/5

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

The description explicitly recommends using this tool for 'plan, design feedback, or a sanity check' from Codex, providing clear context. However, it does not mention when to avoid using this tool in favor of alternatives.

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

ask_codexB

Ask the Codex pane a question and return its answer.

Use this from Claude when you want Codex's opinion, a code review, or to delegate execution to it.

ParametersJSON Schema
NameRequiredDescriptionDefault
questionYes
timeoutNo

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

B3.4/5.0
Behavior2/5

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

No annotations provided, and the description lacks behavioral details such as side effects, authentication requirements, rate limits, or any constraints. Merely states it returns an answer without elaboration.

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

Conciseness4/5

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

Three sentences, no fluff. First sentence is clear; second adds usage guidance. Could be slightly more efficient, but overall well-structured for a simple tool.

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?

Lacks details on return value format despite having an output schema. No information on how Codex processes the question or what happens with the timeout. Minimal guidance for an agent to use effectively.

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

Parameters1/5

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

Schema description coverage is 0%, meaning no parameter descriptions in schema. The description does not explain the 'question' or 'timeout' parameters at all, adding zero value beyond the parameter names.

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?

Clearly states the verb 'ask' and the resource 'Codex pane', with explicit mention of returning an answer. Distinguishes from sibling 'ask_claude' by naming Codex specifically.

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

Usage Guidelines5/5

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

Explicitly says 'Use this from Claude when you want Codex's opinion, a code review, or to delegate execution to it', providing clear context and implicitly contrasting with alternatives.

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

broadcastB

Push a message to both panes without waiting for a reply.

ParametersJSON Schema
NameRequiredDescriptionDefault
messageYes

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

B3.4/5.0
Behavior3/5

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

Without annotations, the description carries the burden. It discloses the key behavior of not waiting for a reply, but omits other behavioral traits like side effects, required permissions, or whether the message is stored. This is adequate for a simple tool but not comprehensive.

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 with no extraneous words. It is appropriately sized and front-loaded with the key action.

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?

Given the tool's simplicity (1 parameter, output schema exists), the description is minimally complete. It covers the core action and behavioral note, but does not explain 'both panes' or provide any usage context. It meets the minimum viability for a simple tool.

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

Parameters2/5

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

Schema description coverage is 0%, so the description must compensate. It says 'message' but adds no detail beyond the schema's type string. It does not explain format, constraints, or expected values, which is insufficient for a parameter with no description in the schema.

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 pushes a message to both panes without waiting for a reply, using a specific verb and resource. This distinguishes it from sibling tools like ask_claude and ask_codex, which likely expect replies, and queue_status for status checks.

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

Usage Guidelines2/5

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

The description provides no guidance on when to use this tool over alternatives. It does not mention when not to use it or compare it to sibling tools, leaving the agent to infer usage.

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

queue_statusA

Return queue counts + recent completions (debugging).

ParametersJSON Schema
NameRequiredDescriptionDefault

No parameters

TDQS

A4.2/5.0
Behavior4/5

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

No annotations are provided, but the description clearly indicates it is a non-destructive read (returning counts and completions). There is no behavior beyond what is described, and no contradictions. A slight deduction for not explicitly stating read-only nature.

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 extremely concise: a single sentence that immediately states the tool's purpose and context. No fluff or redundant information.

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

Completeness4/5

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

Given zero parameters and no output schema, the description sufficiently describes the tool's output. It could be considered complete for a simple status check, though mentioning any authentication or availability requirements would improve completeness.

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

Parameters4/5

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

The input schema has no parameters (0 params, 100% coverage). The description adds value by specifying the return content (queue counts + recent completions). Baseline 4 is appropriate since the schema carries no burden.

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 returns queue counts and recent completions, with 'debugging' context. It identifies the specific resource (queue status) and verb (return). It is well distinguished from siblings like ask_claude, ask_codex, and broadcast.

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 implies usage for debugging via the parenthetical '(debugging)'. It does not explicitly state when to use vs. alternatives or when not to use, but the siblings are sufficiently different, so the guidance is adequate but minimal.

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. 4 tool updatesv0.1.0
    • First observedask_claude
    • First observedask_codex
    • First observedbroadcast
    • First observedqueue_status

TDQS

A4/5.0

Scored across 4 tools

Disambiguation5/5

Each tool has a distinct purpose: ask_claude and ask_codex target specific panes, broadcast sends to both without waiting, and queue_status provides debugging info. No overlap.

Naming Consistency5/5

All tool names use lowercase with underscores and follow a consistent verb_noun pattern (ask_claude, ask_codex, queue_status) or are a clear verb (broadcast).

Tool Count5/5

4 tools is well-scoped for the server's purpose of inter-pane communication, covering questioning each pane, broadcasting, and status monitoring.

Completeness4/5

Core workflows are covered, but a minor gap exists: there is no tool to send a one-way message to a specific pane without expecting a reply (only broadcast to both).

Maintenance

ActivitySlowing
ResponsivenessNo issues

Related MCP Connectors

Related MCP Servers