Claude Peers Mcp

作者 reason-machines2384a003145a無授權條款83 個星標收錄於 2026年10月8日更新於 2026年10月8日儲存庫3 個月前更新

Enable multiple Claude Code instances to discover each other and exchange messages in real-time via a local broker daemon and MCP server.

僅含說明AI & Agents
AI 產生的概覽

架設 MCP 伺服器與本機代理,讓多個 Claude Code 工作階段互相探索並即時交換訊息。

功能
這個技能說明如何安裝與設定 claude-peers,這是一套 MCP 伺服器,可讓同一台機器上的多個 Claude Code 執行個體互相探索並即時收發訊息。本機代理常駐程式使用 SQLite 與 localhost 上的 HTTP 處理同儕註冊與訊息路由,每個工作階段的 MCP 伺服器會把收到的訊息推送至 Claude 通道。內容也涵蓋用來檢視同儕、傳送訊息與停止代理的命令列指令,以及設定與疑難排解。
適用情境
當你希望同一台機器上的多個 Claude Code 工作階段協同作業時使用,例如跨專案或跨工作樹。適合需要列出同儕、分享目前工作內容,或在工作階段之間傳送任務與問題的情境。
執行需求
需要 Bun 執行環境、Claude Code v2.1.80 或更新版本,以及 claude.ai 登入,因為通道不支援 API 金鑰驗證。它使用 localhost 7899 連接埠上的本機代理與 SQLite 資料庫,並可選用 OpenAI API 金鑰來產生自動摘要。這個技能僅為說明文件,不附帶指令碼。

claude-peers-mcp

Skill by ara.so — Daily 2026 Skills collection.

claude-peers is an MCP server that lets multiple Claude Code instances running on the same machine discover each other and exchange messages in real-time. A local broker daemon (SQLite + HTTP on localhost:7899) handles peer registration and message routing; each session's MCP server pushes inbound messages directly into the Claude channel so they appear instantly.

Installation

1. Clone and install dependencies

bash
git clone https://github.com/louislva/claude-peers-mcp.git ~/claude-peers-mcpcd ~/claude-peers-mcpbun install

2. Register as a global MCP server

bash
claude mcp add --scope user --transport stdio claude-peers -- bun ~/claude-peers-mcp/server.ts

Adjust the path if you cloned elsewhere.

3. Launch Claude Code with the channel enabled

bash
claude --dangerously-skip-permissions --dangerously-load-development-channels server:claude-peers

Add a shell alias to avoid typing it every time:

bash
# ~/.bashrc or ~/.zshrcalias claudepeers='claude --dangerously-load-development-channels server:claude-peers'

The broker daemon starts automatically on first use. No manual daemon management needed.

Requirements

  • Bun runtime
  • Claude Code v2.1.80+
  • claude.ai login (channels require it — API key auth does not work)

Architecture

                    ┌───────────────────────────┐                    │  broker daemon            │                    │  localhost:7899 + SQLite  │                    └──────┬───────────────┬────┘                           │               │                      MCP server A    MCP server B                      (stdio)         (stdio)                           │               │                      Claude A         Claude B
  • Each Claude Code session spawns its own server.ts MCP process over stdio
  • MCP servers register with the broker and poll every second
  • Inbound messages are pushed via the claude/channel protocol for instant delivery
  • The broker auto-cleans dead peers and is localhost-only

MCP Tools Reference

ToolDescription
list_peersDiscover other Claude Code instances; scope: machine, directory, or repo
send_messageSend a message to a peer by ID — delivered instantly via channel push
set_summarySet a description of what this instance is working on
check_messagesManually poll for messages (fallback without channel mode)

Example prompts to Claude

List all peers on this machine
Send a message to peer abc123: "what files are you editing right now?"
Set your summary to: "refactoring the authentication module"
Check for any new messages from peers

CLI Usage

Inspect and interact with the broker directly from the terminal:

bash
cd ~/claude-peers-mcp
# Show broker status and all registered peersbun cli.ts status
# List peers in a tablebun cli.ts peers
# Send a message into a specific Claude sessionbun cli.ts send <peer-id> "your message here"
# Stop the broker daemonbun cli.ts kill-broker

Configuration

Set these environment variables before starting Claude Code:

VariableDefaultDescription
CLAUDE_PEERS_PORT7899Port the broker listens on
CLAUDE_PEERS_DB~/.claude-peers.dbPath to the SQLite database
OPENAI_API_KEY—Enables auto-summary via gpt-4o-mini on startup
bash
export CLAUDE_PEERS_PORT=7899export CLAUDE_PEERS_DB=~/.claude-peers.dbexport OPENAI_API_KEY=$OPENAI_API_KEY  # optional — enables auto-summary

Auto-Summary Feature

With OPENAI_API_KEY set, each instance generates a brief summary on startup describing what you're likely working on (based on working directory, git branch, recent files). Other peers see this in list_peers output. Without the key, Claude sets its own summary via set_summary.

Common Patterns

Cross-project coordination

Start two sessions in different project directories:

bash
# Terminal 1 — in ~/projects/backendclaudepeers
# Terminal 2 — in ~/projects/frontendclaudepeers

Ask Claude in Terminal 1:

List peers scoped to machine, then ask the peer in the frontend project what API endpoints it needs

Scope-filtered peer discovery

List peers scoped to repo

Shows only instances running in the same git repository — useful when you have worktrees or split terminals on the same codebase.

Scripted message injection via CLI

bash
# Inject a task into a running Claude session from a shell scriptPEER_ID=$(bun ~/claude-peers-mcp/cli.ts peers | grep 'backend' | awk '{print $1}')bun ~/claude-peers-mcp/cli.ts send "$PEER_ID" "run the test suite and report failures"

Polling fallback (no channel mode)

If you launch without --dangerously-load-development-channels, Claude can still receive messages by calling check_messages explicitly:

Check for any new peer messages

Troubleshooting

Broker not starting

bash
# Check if something is already on port 7899lsof -i :7899
# Kill a stuck broker and restartbun ~/claude-peers-mcp/cli.ts kill-broker# Then relaunch Claude Code

Peers not appearing in list_peers

  • Ensure both sessions were started with --dangerously-load-development-channels server:claude-peers
  • Confirm both use the same CLAUDE_PEERS_PORT (default 7899)
  • Run bun cli.ts status to verify the broker sees both registrations

Messages not arriving instantly

  • Channel push requires claude.ai login; API key auth won't work
  • Fall back to check_messages tool if channels are unavailable

Auto-summary not generating

  • Verify OPENAI_API_KEY is exported in the shell where Claude Code was launched: echo $OPENAI_API_KEY
  • The feature uses gpt-4o-mini; confirm your key has access

Database issues

bash
# Reset the database entirely (all peers/messages lost)rm ~/.claude-peers.dbbun ~/claude-peers-mcp/cli.ts kill-broker

MCP server not found after registration

bash
# Verify registrationclaude mcp list
# Re-register if missingclaude mcp add --scope user --transport stdio claude-peers -- bun ~/claude-peers-mcp/server.ts

來源與署名

來源:reason-machines/trending-skills位於skills/claude-peers-mcp提交2384a00

授權條款: 無授權條款

內容歸原作者所有。SourceWeft 從公開儲存庫中收錄這些內容。

檢舉或申請下架