claude-peers-mcp
Enable multiple Claude Code instances to discover each other and exchange messages in real-time via a local broker daemon and MCP server.
What this skill does
# claude-peers-mcp
> Skill by [ara.so](https://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-mcp
cd ~/claude-peers-mcp
bun 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 ~/.zshrc
alias claudepeers='claude --dangerously-load-development-channels server:claude-peers'
```
The broker daemon starts automatically on first use. No manual daemon management needed.
## Requirements
- [Bun](https://bun.sh) 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
| Tool | Description |
|---|---|
| `list_peers` | Discover other Claude Code instances; scope: `machine`, `directory`, or `repo` |
| `send_message` | Send a message to a peer by ID — delivered instantly via channel push |
| `set_summary` | Set a description of what this instance is working on |
| `check_messages` | Manually 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 peers
bun cli.ts status
# List peers in a table
bun cli.ts peers
# Send a message into a specific Claude session
bun cli.ts send <peer-id> "your message here"
# Stop the broker daemon
bun cli.ts kill-broker
```
## Configuration
Set these environment variables before starting Claude Code:
| Variable | Default | Description |
|---|---|---|
| `CLAUDE_PEERS_PORT` | `7899` | Port the broker listens on |
| `CLAUDE_PEERS_DB` | `~/.claude-peers.db` | Path to the SQLite database |
| `OPENAI_API_KEY` | — | Enables auto-summary via `gpt-4o-mini` on startup |
```bash
export CLAUDE_PEERS_PORT=7899
export CLAUDE_PEERS_DB=~/.claude-peers.db
export 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/backend
claudepeers
# Terminal 2 — in ~/projects/frontend
claudepeers
```
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 script
PEER_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 7899
lsof -i :7899
# Kill a stuck broker and restart
bun ~/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.db
bun ~/claude-peers-mcp/cli.ts kill-broker
```
**MCP server not found after registration**
```bash
# Verify registration
claude mcp list
# Re-register if missing
claude mcp add --scope user --transport stdio claude-peers -- bun ~/claude-peers-mcp/server.ts
```
Related in AI Agents
skill-development
IncludedComprehensive meta-skill for creating, managing, validating, auditing, and distributing Claude Code skills and slash commands (unified in v2.1.3+). Provides skill templates, creation workflows, validation patterns, audit checklists, naming conventions, YAML frontmatter guidance, progressive disclosure examples, and best practices lookup. Use when creating new skills, validating existing skills, auditing skill quality, understanding skill architecture, needing skill templates, learning about YAML frontmatter requirements, progressive disclosure patterns, tool restrictions (allowed-tools), skill composition, skill naming conventions, troubleshooting skill activation issues, creating custom slash commands, configuring command frontmatter, using command arguments ($ARGUMENTS, $1, $2), bash execution in commands, file references in commands, command namespacing, plugin commands, MCP slash commands, Skill tool configuration, or deciding between skills vs slash commands. Delegates to docs-management skill for official documentation.
reprompter
IncludedTransform messy prompts into well-structured, effective prompts — single or multi-agent. Use when: "reprompt", "reprompt this", "clean up this prompt", "structure my prompt", rough text needing XML tags and best practices, "reprompter teams", "repromptception", "run with quality", "smart run", "smart agents", multi-agent tasks, audits, parallel work, anything going to agent teams. Don't use when: simple Q&A, pure chat, immediate execution-only tasks. See "Don't Use When" section for details. Outputs: Structured XML/Markdown prompt, quality score (before/after), optional team brief + per-agent sub-prompts, agent team output files. Success criteria: Single mode quality score ≥ 7/10; Repromptception per-agent prompt quality score 8+/10; all required sections present, actionable and specific.
adaptive-compaction
IncludedAdaptive add-on policy and recovery layer that decides WHEN to compact, prune, snapshot, or fork -- replacing fixed-percent auto-compaction across Claude Code, Codex, and MCP-capable hosts. Trigger on auto-compact timing or damage: "when should I compact", "is it safe to compact now or start a fresh session", "auto-compact fires too early/mid-task", "switching to an unrelated task but the window still has space", "context rot", "answers get worse the longer the session runs", "the agent forgot the plan or my decisions after it summarized", "add a layer on top that manages context without changing the agent", raising autoCompactWindow to give the policy room, or installing/tuning a cross-tool compaction policy or PreCompact hook -- even when "compaction" is never said but the problem is context-window pressure or post-summarization memory loss. Do NOT use to summarize a conversation, build RAG, write a summarization prompt (decides WHEN not HOW), or answer max-context-length trivia.
agent-skill-creator
IncludedCreate cross-platform agent skills from workflow descriptions. Activates when users ask to create an agent, automate a repetitive workflow, create a custom skill, or need advanced agent creation. Triggers on phrases like create agent for, automate workflow, create skill for, every day I have to, daily I need to, turn process into agent, need to automate, create a cross-platform skill, validate this skill, export this skill, migrate this skill. Supports single skills, multi-agent suites, transcript processing, template-based creation, interactive configuration, cross-platform export, and spec validation.
llm-wiki
IncludedUse when building or maintaining a persistent personal knowledge base (second brain) in Obsidian where an LLM incrementally ingests sources, updates entity/concept pages, maintains cross-references, and keeps a synthesis current. Triggers include "second brain", "Obsidian wiki", "personal knowledge management", "ingest this paper/article/book", "build a research wiki", "compound knowledge", "Memex", or whenever the user wants knowledge to accumulate across sessions instead of being re-derived by RAG on every query.
skill-master
IncludedAgent Skills authoring, evaluation, and optimization. Create, edit, validate, benchmark, and improve skills following the agentskills.io specification. Use when designing SKILL.md files, structuring skill folders (references, scripts, assets), ingesting external documentation into skills, running trigger evals, benchmarking skill quality, optimizing descriptions, or performing blind A/B comparisons. Keywords: agentskills.io, SKILL.md, skill authoring, eval, benchmark, trigger optimization.