claude-session-bus
Enables Claude Code sessions sharing a project root to broadcast short messages to each other via a JSONL mailbox, with sending as an MCP tool and receiving as a prompt hook.
README
claude-session-bus
A tiny Claude Code plugin that lets separate Claude sessions working the same project pass each other short messages: "holding the dev server on :1420", "editing dynamics.rs", "branch X pushed, safe to rebase".
- Send = an MCP tool (
broadcast) the calling session invokes. - Receive = a
UserPromptSubmithook that prepends new peer messages to the other session's context before its next turn. - Transport = one append-only JSONL mailbox per project, under
${CLAUDE_PROJECT_DIR}/.claude/.session-bus/.
Broadcast-to-all, one-way, fire-and-forget. Advisory: it announces, it does not enforce. Project-agnostic - the same install only ever bridges sessions that share a project root.
Full design: docs/specs/2026-06-29-claude-session-bus-design.md.
Layout
claude-session-bus/
├── .claude-plugin/
│ ├── plugin.json # plugin manifest: hooks + mcpServers
│ └── marketplace.json # lets you add this dir as a local marketplace
├── server/index.mjs # MCP stdio server: broadcast(), inbox()
├── scripts/drain.mjs # UserPromptSubmit hook (the receive half)
├── scripts/selftest.mjs # offline smoke test of the mailbox primitives
├── lib/bus.mjs # shared: paths, identity, locking, message shape
├── hooks/hooks.json # declares the UserPromptSubmit hook
└── package.json # type:module, no runtime deps
Quick start
-
Clone the repo:
git clone https://github.com/exalsch/claude-session-bus.git cd claude-session-bus -
Smoke-test the primitives (no Claude needed):
node scripts/selftest.mjs # expect: selftest OK - { ... } -
Install as a local plugin, then enable it:
/plugin marketplace add /path/to/claude-session-bus # the directory you just cloned /plugin install claude-session-bus@session-bus-devRestart Claude Code so the MCP server + hook load. Verify the
broadcastandinboxtools appear, and that thesession-busMCP server is connected. -
Use it. From any session:
broadcast("holding the dev server on :1420", kind="lock")inbox()to re-read peer messages on demand.
The other session in the same project sees the message prepended to its context the next time you submit a prompt there.
End-to-end test
Open two terminals, both cd into the same project (e.g. ~/projects/your-app):
- In session A: ask it to
broadcast("test from A"). - In session B: submit any prompt. B should report a
[session-bus]line from A. - In session A: submit any prompt. A should not see its own message (origin filter).
If A does see its own message, the ppid correlation did not hold (see Risks in the
spec) - the fallback is to render own posts tagged "(you)" instead of filtering them.
Config
SESSION_BUS_BACKFILL_MIN(default0) - minutes of backlog a session sees on its first prompt.0= forward-only (a new session only sees what arrives after it joins).- Retention (
MAX_LINES,MAX_AGE_MS) lives inlib/bus.mjs.
Status & next steps
v0.1. The headline risk - ppid correlation on Windows - was tested and did not
hold: Claude Code spawns the UserPromptSubmit hook through a shell, so the hook's
parent PID is a transient shell, never the directly-spawned MCP server's PID. Sessions
now correlate on CLAUDE_CODE_SESSION_ID (an env var both halves inherit from
claude.exe) instead of process.ppid, with a ppid fallback where that var is
absent. Verified end-to-end across two live sessions and covered by
scripts/test-origin.mjs (unit) and scripts/test-drain.mjs (integration);
npm test runs the full suite.
Out of scope today: cross-project messaging. The mailbox lives inside each project
(${CLAUDE_PROJECT_DIR}/.claude/.session-bus/), so only sessions sharing a project root
bridge. A global bus would need a shared mailbox path plus a proj field per message.
This is dev tooling - it must never live inside a product repo.
推荐服务器
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 模型以安全和受控的方式获取实时的网络信息。