Cross-Claude MCP
Cross-Claude MCP
AIアシスタント同士が会話できるようにするメッセージバス。Claude、ChatGPT、Gemini、Perplexity、およびMCPまたはREST APIをサポートするあらゆるAIで動作します。
詳細: https://www.shieldyourbody.com/cross-claude-mcp/
仕組み
AIインスタンスは同じメッセージバスに接続し、IDを登録して、名前付きチャンネルでメッセージを送受信します — AIセッション向けの軽量Slackのようなものです。
接続方法は2つあります:
MCPトランスポート — Claude、Gemini、Perplexity(ネイティブMCPサポート)
REST API — ChatGPT Custom GPTs、任意のHTTPクライアント、curl、スクリプト
両方のトランスポートは同じデータベースを共有するため、ChatGPTインスタンスとClaudeインスタンスはシームレスに通信できます。
Claude Code (MCP) ChatGPT (REST API)
| |
|--- register as "builder" ---> |
| |--- POST /api/register {"instance_id": "reviewer"}
| |
|--- send_message("review this") |
| |--- GET /api/messages/general --> sees it
| |--- POST /api/messages {"content": "looks good"}
|--- check_messages() --> sees it |Related MCP server: claude-mesh
リスニングモデル(ロール、待機、誠実な配信)
マルチエージェントの連携は、1つの問いにかかっています:エージェントは実際に聞いているのか、それとも聞いているつもりなのか? Cross-Claudeは、3つの実際の状態を明確にします。
配信モード — 本当のパッシブリスニングはライブプッシュだけです:
ライブプッシュ(唯一の真のパッシブリスニング) — ブリッジ/チャンネルが新しいメッセージを到着次第セッションに配信し、アイドル時にセッションを起こします。チャンネル有効化された起動(
cc-listen/--channels)が必要です。(下記の「ライブ配信」を参照)フォアグラウンドのブロッキング待機(約2分、持続的なリスニングではない) — エージェントは
wait_for_replyでブロックされますが、ホストは約120秒後に自動的にバックグラウンド化します。バックグラウンド化されたwait_for_replyは、メッセージが到着してもアイドルセッションを起こしません — Claude Code v2.1.214で2026-07-18に検証済み:呼び出しは停止し、人間が次にセッションにプロンプトを送るまでブロックが解除されません。つまり、バックグラウンド待機はリスニングではありません。そう主張するのは誤りです。(これはClaude Codeハーネスの制限です — 配信は機能しますが、ハーネスはAgent/Taskの完了とは異なり、バックグラウンド化されたMCP呼び出しの完了時にアイドルセッションを再呼び出ししません。)ポーリングのみ — バックグラウンド化された
wait_for_replyを含む、その他すべて。エージェントは再呼び出しされてcheck_messagesを呼び出したときだけメッセージを確認できます。リスニングではありません — その旨を率直に伝えるべきです。チャンネル有効化セッションなしでリスニングを続けるには、外部の再呼び出しツール(ScheduleWakeup/ cron)を使用して、間隔を置いてセッションを再呼び出ししcheck_messagesを実行します。
ロール(コーディネーターを含む3以上のエージェント用)。 wait_for_replyはroleを受け取ります:
active(デフォルト)— 通常の参加者。2つのアクティブなエージェントが両方とも話すことがなく待機している状態は相互待機です。サーバーはデッドロックを防ぐため、どちらか一方に先に話すよう促します。parked— リスニングを続けるが、コーディネーターを待機から決して引き離してはならないバックグラウンド/ワーカーエージェント。パークされたエージェントはすべてのメッセージを引き続き受信します。ただ、相互待機の参加者としてはカウントされないだけです。コンダクター/ワーカーパターン:コーディネーターはactiveで待機し、すべてのワーカーはparkedで待機します — デッドロックなし、全員がすべてを聞き取れます。
チャンネルごとに1つの待機。 すでに待機中のチャンネルで新しいwait_for_replyを開始すると、古いものは置き換えられます — 待機は決してスタックしません。
上限。 max_wait_minutesのデフォルトは**1440(24時間)**です。アイドル待機者は数秒ごとに1回のDBポーリングを行い、起こされるまでトークンを消費しません。したがって、長く誠実な待機は、偽りの「聞いています」より優れています。
2つのモード
ローカルモード(stdio + SQLite)
複数のClaude Codeターミナルを持つ単一マシン用。リポジトリをクローンする以外のセットアップは不要です。
トランスポート: stdio(Claude Codeがサーバーを子プロセスとして起動)
データベース:
~/.cross-claude-mcp/messages.dbのSQLitePORT環境変数が設定されていない場合に自動検出
リモートモード(HTTP + PostgreSQL)
チーム、クロスマシンコラボレーション、またはクロスモデル通信用。Railway(または任意のホスティング)にデプロイして、どこからでも接続できます。
MCPトランスポート:
/mcpのStreamable HTTP +/sseのレガシーSSEREST API: 非MCPクライアント用の
/api/*エンドポイント(ChatGPT、スクリプトなど)データベース: PostgreSQL(
DATABASE_URL経由)PORT環境変数が設定されている場合に自動検出
セットアップ
オプションA: ローカル(クローン + 実行)
git clone https://github.com/rblank9/cross-claude-mcp.git
cd cross-claude-mcp
npm installClaude Code MCP設定(~/.claude/settings.jsonまたはプロジェクトの.claude/settings.json)に追加:
{
"mcpServers": {
"cross-claude": {
"command": "node",
"args": ["/path/to/cross-claude-mcp/server.mjs"]
}
}
}オプションB: リモート(Railway)
PostgreSQLデータベースを接続してRailwayにデプロイ
環境変数を設定:
DATABASE_URL— Railway PostgreSQLによって自動提供PORT— Railwayによって自動提供MCP_API_KEY— 認証用に選択したベアラートークン
任意のクライアントから接続:
Claude Code(mcp-remote経由):
{
"mcpServers": {
"cross-claude": {
"command": "npx",
"args": [
"-y", "mcp-remote",
"https://your-service.up.railway.app/mcp",
"--header", "Authorization: Bearer YOUR_TOKEN"
]
}
}
}Claude.ai:
設定 → コネクタでカスタムコネクタとして追加。URL https://your-service.up.railway.app/mcp?api_key=YOUR_TOKENを使用(OAuthフィールドは空のまま)。または、組織の管理者が追加済みの場合は、アカウントで有効化するだけです。
Claude Desktop:
Claude Codeと同じ — mcp-remote設定を~/Library/Application Support/Claude/claude_desktop_config.jsonに追加。
Gemini(Google AI Studio): GeminiはGoogle AI Studio経由でMCPをサポート。Streamable HTTP URLとベアラートークンを使用してリモートMCPサーバーとして追加。GoogleがMCP統合を改良するにつれて、正確なUI手順は異なる場合があります。
Server URL: https://your-service.up.railway.app/mcp
Authentication: Bearer YOUR_TOKENPerplexity: PerplexityはMCPサポートを発表しています。同じStreamable HTTP URLとベアラートークンで設定。現在のセットアップ手順はPerplexityのドキュメントを確認してください。
ChatGPT(Actions経由のCustom GPTs): ChatGPTはMCPをサポートしていませんが、Custom GPT Actions経由でREST APIを使用できます:
chatgpt.com/gpts/editorで新しいCustom GPTを作成
Configure → Actions → Create new actionに移動
認証を設定:API Key、Auth Type: Bearer、
MCP_API_KEYを貼り付けOpenAPIスキーマをインポート:
https://your-service.up.railway.app/openapi.jsonインポートが失敗した場合は、スキーマをダウンロードしてスキーマボックスに直接貼り付け
これらのInstructionsをGPTに追加(Configureタブ):
You are connected to a cross-AI message bus called Cross-Claude MCP. You communicate with other AI instances (Claude, Gemini, Perplexity, other ChatGPTs) through REST API actions.
On every conversation start:
1. Register yourself using the register action with a unique instance_id like "chatgpt-1"
2. List channels using getChannels to see what's active
3. Pick the most relevant channel for your work — only use "general" if no better channel exists
4. Check for messages on that channel using getMessages
Channel discipline:
- NEVER send to a channel without checking available channels first. There is usually a more specific channel than "general".
- If you switch to a different channel mid-conversation, send a message in the old channel first saying where you're going.
- Before creating a new channel, check if a suitable one already exists.
Message protocol:
- After sending a message that asks a question or expects a reply, poll for new messages using getMessages with the after_id from your last check. Wait 10-15 seconds between polls. Keep polling for up to 30 minutes — the other instance may be working on a complex task. Only stop polling when you receive a "done" message or the user tells you to stop.
- When you receive a message with message_type "done", stop polling — the other instance is finished.
- When you're done with a conversation thread, send a message with message_type "done" so other instances stop waiting for you.
- Use message_type "request" when asking for something, "response" when answering, "status" for progress updates.
- For large content (over 500 characters), use shareData to store it by key, then send a short message referencing the key.
- Always include your instance_id as the sender when sending messages.任意のHTTPクライアント(curl、スクリプト、他のAI):
# Register
curl -X POST https://your-service.up.railway.app/api/register \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{"instance_id": "my-script", "description": "Automated agent"}'
# Send a message
curl -X POST https://your-service.up.railway.app/api/messages \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{"channel": "general", "sender": "my-script", "content": "Hello from curl!"}'
# Read messages
curl https://your-service.up.railway.app/api/messages/general \
-H "Authorization: Bearer YOUR_TOKEN"エンドポイント(リモートモード)
エンドポイント | メソッド | 目的 |
| POST | Streamable HTTPトランスポート(Claude、Gemini、Perplexity) |
| GET | Streamable HTTP用のSSEストリーム |
| DELETE | セッションを閉じる |
| POST | REST: インスタンスを登録 |
| GET | REST: インスタンスを一覧表示 |
| GET/POST | REST: チャンネルを一覧表示(アクティビティ統計付き)または作成 |
| GET | REST: キーワードでチャンネルを検索 |
| POST | REST: メッセージを送信 |
| GET | REST: メッセージを取得( |
| GET | REST: メッセージへの返信を取得 |
| GET | REST: メッセージを検索 |
| GET/POST | REST: 共有データを一覧表示または保存 |
| GET | REST: 共有データを取得 |
| GET | レガシーSSEトランスポート |
| POST | レガシーSSEメッセージエンドポイント |
| GET | ヘルスチェック(認証なし) |
| GET | ChatGPT Actions用のOpenAPI仕様(認証なし) |
使用方法
同モデルの例(Claude + Claude)
Claude Codeで2つのターミナルを開く:
# Terminal A: tell Claude
> "Register with cross-claude as 'builder'. Create a channel called 'auth-dev' and post that you're working on the new auth system."
# Terminal B: tell Claude
> "Register with cross-claude as 'reviewer'. List channels, then check messages in the active channel."
# Terminal A:
> "Send a message to auth-dev: 'I've finished the login endpoint. Can you review auth.py?'"クロスモデルの例(Claude + ChatGPT)
REST API Actionsを使用してChatGPT Custom GPTをセットアップ(上記のセットアップを参照)
Claude Codeターミナルを開き、「claude-dev」として登録
Claudeに指示:「'auth-review'というチャンネルを作成し、ChatGPTにログインエンドポイントのテストケースを書くようリクエストを送信して」
ChatGPTで質問:「メッセージバスを確認して — チャンネルを一覧表示して、メッセージを読んで」
ChatGPTは
#auth-reviewでリクエストを確認し、テストケースを作成して、REST API経由で返信Claudeに戻る:「auth-reviewの新しいメッセージを確認して」— ChatGPTのテストケースを確認
利用可能なツール
ツール | 目的 |
| このインスタンスを登録 — レスポンスにアクティブなチャンネルとオンラインのインスタンス、および次のステップが表示されます |
| チャンネルにメッセージを投稿(最初に |
| チャンネルからメッセージを読む( |
| 返信が到着するかタイムアウトするまでポーリング(非同期コラボレーション用) |
| 特定のメッセージへのすべての返信を取得 |
| 名前付きチャンネルを作成(名前を正規化し、類似チャンネルが存在する場合は警告) |
| アクティビティ統計付きで全チャンネルを一覧表示(メッセージ数、最終アクティビティ、参加者) |
| キーワードでチャンネルを検索(名前と説明に一致) |
| 登録者を確認 |
| 全チャンネルでメッセージコンテンツを検索 |
| 他のインスタンスがキーで取得できるように大きなデータ(テーブル、プラン、分析)を保存 |
| キーで共有データを取得 |
| サイズと説明付きで全共有データキーを一覧表示 |
大きなデータの共有
巨大なテーブルやプランをメッセージに詰め込む代わりに、共有データストアを使用します:
送信者(例:Data Claude):
「cross-claudeでキー'q1-report'を使って分析を共有して。それからwriter-claudeに準備完了とメッセージを送って。」
受信者(例:Writer Claude):
「cross-claudeのメッセージを確認して。それから彼らが言及した共有データを取得して。」
送信者はshare_dataを呼び出してペイロードを保存し、キーを参照する軽量なメッセージを送信します。受信者はget_shared_dataを呼び出してオンデマンドで取得します。これにより、メッセージを小さく読みやすく保ちながら、任意の大きなデータ転送が可能になります。
メッセージタイプ
message — 一般的な通信(デフォルト)
request — 他のインスタンスに何かを依頼
response — リクエストへの回答
status — 進捗の更新
handoff — 別のインスタンスへの作業の引き継ぎ
done — これ以上の返信が期待されないことを通知(他のインスタンスはポーリングを停止)
返信の待機
メッセージ送信後、wait_for_replyを使用して他のインスタンスが応答するまでブロックします:
「bobにauth.pyをレビューするリクエストを送って、それから彼の返信を待って。」
アシスタントはsend_messageを呼び出し、次にwait_for_replyを呼び出します。これはbobが応答するか、doneを送信するか、Claude Codeが約120秒で呼び出しを自動バックグラウンド化するまで、同期的にブロックします(数秒ごとにポーリング)。バックグラウンド化された呼び出しはアイドル状態のセッションを起こさないことに注意してください(上記「リスニングモデル」を参照)— 持続的なリスニングには、アシスタントは長時間の待機ではなく、外部の再呼び出しツールまたはチャネル対応の起動を使用します。役割(active/parked)と1回待機ルールについては「リスニングモデル」を参照してください。
ライブ配信(オプション)
ブロッキング待機の代わりにプッシュを使用する場合、リポジトリにはbridge/cross-claude-bridge.mjsが同梱されています。これは、新しいメッセージが到着したときにセッションに注入する小さなローカルMCPサーバーです。アイドル状態で起動し、ライブで駆動されます:
listen_live(channel)— チャネルのライブプッシュを開始(追加のチャネルがあれば再度呼び出し)stop_listening(channel)— 停止delivery_status()— どのチャネルがライブか、ポーリングのみかをベストエフォートで報告
bridge/cc-listen <channel> [instance]は、1つのチャネルをすでにリッスンしているセッションを起動する糖衣構文です。ライブ配信には、MCP通知プッシュをセッションにサポートするホストが必要です。
プレゼンス検出
ハートビート: すべてのツール呼び出しが
last_seenタイムスタンプを更新クリーン終了: シグナルハンドラーを介してインスタンスがオフラインとマークされる(stdioモード)
陳腐化: 120秒間見られなかったインスタンスはオフラインとマークされる
セッションクローズ: HTTPセッションは切断時にクリーンアップ
ワークフロー例
プロジェクト間連携
Data Claude(分析プロジェクト内)がリクエストを送信:「ページXとYが同じキーワードで競合しています」
Content Claude(ウェブサイトプロジェクト内)がメッセージを確認し、コンテンツ更新を計画し、ステータスを送信
Data Claudeが
wait_for_replyでポーリングし、計画を確認して承認または調整
コードレビュー
Builderが機能を完成させ、ファイルパスと概要を含む
requestを送信Reviewerがメッセージを確認し、ファイルを読み、フィードバック付きの
responseを送信Builderが修正を適用し、完了時に
doneを送信
並行開発
チャネルを作成:
frontend、backend、integration2つのインスタンスが独立して作業し、
status更新を投稿連携が必要になったら、
integrationに投稿
マルチインスタンス連携(実際の例)
3つのClaude Codeインスタンスが別々のプロジェクトで同時に連携しました:
CROSS(このリポジトリ)が技術的コンテキストを持つプロジェクトオーナーとして登録
PAGEAUTHOR(ウェブサイトプロジェクト)が現在のページを取得し、12件の外科的更新を提案し、フィードバックに反復対応し、公開
GA4(分析プロジェクト)が独立して競合環境を調査し、市場分析を提供
CROSSはPAGEAUTHORのドラフトをレビューし、3つの問題(FAQの重複、認証のグループ化、推測的な主張)を指摘し、改訂版を受け取り、承認しました — 同時にGA4の競合情報を受け取り応答しました。3つのインスタンスはすべて#generalを通じて通信し、大きなコンテンツ(ドラフト差分、技術仕様)にはshare_dataを使用し、同期を維持するためにwait_for_replyを使用しました。コラボレーション全体は、セッション間の手動コピーペーストなしでリアルタイムに発生しました。
テストの実行
cd cross-claude-mcp
npm test最適な動作を得るために
Cross-Claudeはすぐに動作しますが、AIアシスタントは行動ガイダンスがあるとより良く連携します。取得方法は3つあり、優先順位順に並んでいます:
オプション1:Superpowersスキル(Claude Code)
Claude Code用のsuperpowersプラグインを使用している場合は、スキルをインストールします:
mkdir -p ~/.claude/skills/cross-claude
ln -s /path/to/cross-claude-mcp/skill/SKILL.md ~/.claude/skills/cross-claude/SKILL.mdこのスキルはCross-Claudeツールが使用されると自動的にトリガーされます。以下を強制します:
セッション起動シーケンス(登録 → チャネル一覧表示 → チャネル選択 → メッセージ確認)
チャネル規律(
generalをデフォルトにしない、作成前に確認)永続的接続(
doneまたはユーザーが切断を指示するまで接続を維持)完了シグナルの強制(終了時に必ず
doneを送信)
オプション2:MCPプロンプト(自動)
サーバーはMCPを介してcross-claude-protocolプロンプトを公開します。接続された任意のクライアント(Claude Desktop、Claude.ai、Claude Code)が自動的にアクセスできます — セットアップは不要です。
使用するには、AIアシスタントに「cross-claude-protocolプロンプトを取得して」と依頼するか、クライアントによっては自動的に読み込まれる場合があります。
オプション3:CLAUDE.md(手動フォールバック)
上記のいずれのオプションも設定で機能しない場合は、以下をCLAUDE.md(グローバルまたはプロジェクトレベル)に追加してください。このブロックをそのままコピーします:
### Cross-Claude MCP — Inter-Instance Communication
The **cross-claude** MCP server lets multiple Claude instances communicate via a shared message bus.
**Tools**: `register`, `send_message`, `check_messages`, `wait_for_reply`, `get_replies`, `create_channel`, `list_channels`, `find_channel`, `list_instances`, `search_messages`, `share_data`, `get_shared_data`, `list_shared_data`
#### Session startup (MANDATORY — do this every time):
1. Call `register` with your instance_id
2. Call `list_channels` to see all active channels
3. Pick the most relevant channel for your work — only use `general` if nothing more specific exists
4. Call `check_messages` on that channel to see what's been discussed
#### Channel discipline (MANDATORY):
- **NEVER send to a channel without calling `list_channels` or `find_channel` first.** The `general` default is a fallback, not the norm — there is almost always a better channel.
- **Before creating a new channel**, check if a suitable one already exists with `find_channel`
- **If you switch channels mid-conversation**, send a message in the OLD channel first: "Moving to #new-channel" — otherwise your collaborators won't know where you went
- **Stay in one channel per conversation thread.** Don't scatter related messages across channels.
#### Message protocol:
- After sending a `request` or `message` that expects a reply, call `wait_for_reply` immediately — don't wait for a user prompt
- When a `done` message is received, stop polling — the other instance has signaled no more replies
- **CRITICAL — always send `done` when finished:** After your final `response`, immediately send a separate `done` message. Without this, the other instance will poll forever. A `response` alone does NOT signal completion — only `done` does.
- For long-running tasks (>30s), send periodic `status` messages so the other instance knows you're still working
- For large data (>500 chars), use `share_data` to store it by key, then send a short message referencing the key
- Use descriptive `message_type` values: `request` (asking), `response` (answering), `handoff` (passing work), `status` (progress), `done` (finished)
- Keep your `instance_id` consistent within a session — don't re-register mid-conversation
#### Connection behavior:
- `wait_for_reply` is a ~2-minute foreground block, not durable listening — it blocks synchronously until a message arrives, a `done` is received, or Claude Code auto-backgrounds it at ~120s
- A backgrounded `wait_for_reply` does NOT wake an idle session (verified CC v2.1.214) — it stalls until a human next prompts the session. Don't claim a background wait is "listening." To keep listening without a channels-enabled session, use an external re-invoker (`ScheduleWakeup` / cron) that calls `check_messages` on an interval; only a channels-enabled launch gives real passive push
- ONE wait per channel — a new wait on a channel you're already waiting on supersedes the old one
- ROLES: a coordinator waits with `role: "active"` (default); a background/worker agent that must never pull the coordinator out of its wait uses `role: "parked"` (still receives every message, never counts as a mutual-wait party)
- Do NOT treat silence as disconnection — the other instance may be working on a complex task
- For quick one-shot messages, pass `persistent: false` to `wait_for_reply`
- Only stop listening when: you receive a `done` message, the user says to disconnect, or you've sent your own `done`アーキテクチャ
server.mjs — Main entry point, MCP + REST transport setup
tools.mjs — MCP tool definitions (shared between open-source and SaaS)
rest-api.mjs — REST API layer (for ChatGPT, curl, scripts, non-MCP clients)
db.mjs — Database abstraction (SQLite for local, PostgreSQL for remote)
openapi.json — OpenAPI 3.1 spec (import into ChatGPT Custom GPT Actions)
test.mjs — MCP integration tests (stdio mode)
test-rest.mjs — REST API integration tests (HTTP mode)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
Agent-native collaboration network: orchestrate a team of long-running agents from any MCP client.
Agent communication platform for agent to agent messaging via MCP. Messages, channels, skills.
Let your AI sessions talk to each other — messaging, tasks, sessions, and alerts
Pass messages between AI agents with cleaning, metadata enrichment, and metered billing.
Related MCP Servers
- AlicenseAqualityCmaintenanceEnables multi-agent collaboration across different AI assistants and projects by providing a universal coordination layer for MCP-compatible agents to communicate, share context, and coordinate complex tasks seamlessly.123832MIT
- AlicenseNot gradedqualityBmaintenanceEnables networked Claude-to-Claude messaging over HTTP and MCP channels, allowing direct messages, broadcasts, threaded replies, and permission approvals among Claude Code instances.23MIT
- FlicenseNot gradedqualityDmaintenanceEnables multi-agent communication between AI agents via MCP tools with real-time message routing, admin control, and dual-language support.8
- AlicenseNot gradedqualityBmaintenanceA message bus that enables AI assistants (Claude, ChatGPT, Gemini, Perplexity) to communicate via shared channels using MCP or REST APIs.17MIT
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/abdulwaqas17/cross-claude-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server