claude-intercom
Enables real-time messaging between Claude Code instances, allowing agents to send, receive, and reply to messages instantly via file-based communication with auto-notification.
README
📡 claude-intercom
Real-time messaging between Claude Code instances. When one agent sends a message, the others get it instantly — no polling, no manual checks.
Built as an MCP server + filesystem watcher that wakes idle agents automatically via asyncRewake.
How it works
Terminal 1 Terminal 2
┌─────────────────────┐ ┌─────────────────────┐
│ claude (agent sgup) │ │ claude (agent 4jov) │
│ │ │ │
│ > send("4jov", │ ──JSON──▶ │ 📬 sgup: tu touches │
│ "tu touches │ file │ auth.ts ? │
│ auth.ts ?") │ │ │
│ │ ◀──JSON── │ > reply("Non, │
│ 📬 4jov: Non, │ file │ je suis sur │
│ je suis sur billing│ │ billing") │
└─────────────────────┘ └─────────────────────┘
- Each instance gets a unique 4-char code (e.g.
x7k2) on startup - Messages are JSON files in a shared
store/directory - A
fs.watchwatcher detects new files instantly and wakes the receiving agent - Dead agents are auto-cleaned via PID checking
Install
# Clone
git clone https://github.com/sanztheo/claude-intercom.git ~/.claude/mcp-intercom
# Install deps
cd ~/.claude/mcp-intercom && bun install
1. Register the MCP server
Add to ~/.mcp.json:
{
"mcpServers": {
"intercom": {
"type": "stdio",
"command": "bun",
"args": ["~/.claude/mcp-intercom/src/server.ts"]
}
}
}
2. Add the auto-notification hooks
Add to ~/.claude/settings.json under "hooks":
{
"hooks": {
"PreToolUse": [
{
"hooks": [
{
"type": "command",
"command": "bun ~/.claude/mcp-intercom/src/hook.ts",
"timeout": 3000
}
]
}
],
"Stop": [
{
"hooks": [
{
"type": "command",
"command": "bun ~/.claude/mcp-intercom/src/watcher.ts",
"asyncRewake": true,
"timeout": 300000
}
]
}
],
"SessionStart": [
{
"hooks": [
{
"type": "command",
"command": "bun ~/.claude/mcp-intercom/src/watcher.ts",
"asyncRewake": true,
"timeout": 300000
}
]
}
]
}
}
3. (Optional) Add the skill
Copy skill/SKILL.md to ~/.claude/skills/intercom/SKILL.md so agents proactively coordinate.
MCP Tools
| Tool | Description |
|---|---|
who |
List active agents (filtered by project by default) |
send |
Send a message to an agent or broadcast to "all" |
reply |
Reply to a message (auto-acks the original) |
peek |
Check inbox for unread messages |
ack |
Acknowledge and delete a message |
ack_all |
Clear entire inbox |
Auto-notification
Three layers ensure agents never miss a message:
| Layer | When | How |
|---|---|---|
Watcher (SessionStart + Stop) |
Agent is idle | fs.watch on inbox dir → exit(2) → asyncRewake wakes the model |
Hook (PreToolUse) |
Agent is working | Checks inbox before every tool call |
| Skill (always active) | Agent makes decisions | Guides agent to announce work and check messages |
Architecture
~/.claude/mcp-intercom/
├── src/
│ ├── server.ts # MCP server — 6 tools, auto-generated agent codes
│ ├── store.ts # Filesystem store — presence, messages, sessions
│ ├── hook.ts # PreToolUse hook — checks inbox on every tool call
│ └── watcher.ts # fs.watch — instant detection, asyncRewake push
├── skill/
│ └── SKILL.md # Always-active skill for proactive coordination
└── store/ # Runtime data (gitignored)
├── presence/ # {code}.json — agent registration + PID
├── messages/ # {code}/*.json — per-agent inboxes
└── sessions/ # {pid}.code — PID-to-agent-code mapping
Session linking (how the hook finds "its" agent)
The MCP server and hooks both run as children of the same Claude Code process. On startup, the server writes its agent code to sessions/{pid}.code for each PID in its ancestor chain. The hook walks up its own ancestor chain and matches against these files — the common ancestor (Claude Code) is the link.
Requirements
- Bun runtime
- Claude Code v2.1+
- macOS or Linux
License
MIT
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。