mcp-dispatch
Local inter-agent messaging for AI coding agents via filesystem relay.
README
mcp-dispatch
Local inter-agent messaging for AI coding agents via MCP.
Multiple Claude Code sessions (or any MCP-compatible agents) running on the same machine can send messages to each other through a shared filesystem relay. No server process, no ports, no network — just directories and JSON files with atomic writes.
Features
- Non-destructive messaging — Messages persist until explicitly acknowledged. No more lost messages from crashes or compaction.
- Threading — Group messages into conversations with
thread_idandreply_to. - Structured payloads — Attach machine-readable data alongside human-readable messages.
- TTL & must_read — Time-sensitive messages auto-expire. Critical messages survive until acknowledged.
- Delivery receipts —
peek()shows read/unread state of messages you've sent. - Config-driven — TOML config for agent rosters, directories, and limits. Or go dynamic with no roster.
- Zero infrastructure — Filesystem relay survives process crashes. No daemon to manage.
Quick Start
1. Install
Requires Python 3.11+ and uv.
git clone https://github.com/sophia-labs/mcp-dispatch.git
cd mcp-dispatch
uv sync
For real-time stderr alerts when messages arrive (optional):
uv sync --extra watch
2. Configure Claude Code
Add to your ~/.claude.json:
{
"mcpServers": {
"dispatch": {
"type": "stdio",
"command": "uv",
"args": ["run", "--directory", "/path/to/mcp-dispatch", "python", "server.py"],
"env": {
"MCP_DISPATCH_AGENT_ID": "alice"
}
}
}
}
Each Claude Code window needs a unique MCP_DISPATCH_AGENT_ID.
3. Send messages
From any Claude Code session:
Agent alice: dispatch("Hey bob, I pushed the fix", target="bob")
Agent bob: peek() → sees alice's message
Agent bob: ack(["msg-abc12345"]) → message removed
Tools
| Tool | Description |
|---|---|
dispatch(message, target, ...) |
Send a message to one agent or all |
peek(thread_id?, include_read?) |
Read messages and delivery receipts for sent messages |
ack(message_ids) |
Acknowledge and delete processed messages |
who() |
List connected agents |
dispatch
dispatch(
message="Deployed to staging",
target="all", # or a specific agent name
priority="normal", # "normal" or "urgent"
thread_id="deploy-123", # optional: group into conversation
reply_to="msg-abc", # optional: reference specific message
payload={"commit": "abc123", "env": "staging"}, # optional: structured data
ttl=3600, # optional: expire after 1 hour
must_read=True, # optional: survive TTL, require explicit ack
)
peek
peek() # new (unread) messages only
peek(include_read=True) # all unacknowledged messages
peek(thread_id="deploy-123") # filter by thread
ack
ack(message_ids=["msg-abc", "msg-def"]) # delete specific messages
Configuration
Create ~/.config/mcp-dispatch/config.toml:
# Agent roster (omit for dynamic registration — any name accepted)
agents = ["alice", "bob", "carol"]
# Message directory (default: ~/.config/mcp-dispatch/messages)
dispatch_dir = "~/.config/mcp-dispatch/messages"
# Maximum message size in bytes (default: 65536)
max_message_bytes = 65536
# Default TTL in seconds (0 = no expiry)
default_ttl = 0
# Custom MCP instructions template (optional)
# Placeholders: {agent_id}, {agent_list}
# instructions = "You are {agent_id}. Available agents: {agent_list}."
Environment Variables
| Variable | Description |
|---|---|
MCP_DISPATCH_AGENT_ID |
Agent identity (required in dynamic mode) |
MCP_DISPATCH_CONFIG |
Config file path (default: ~/.config/mcp-dispatch/config.toml) |
MCP_DISPATCH_DIR |
Override dispatch directory from config |
Dynamic Mode
When no agents roster is configured, any agent name is accepted. Inbox directories are created on demand. This is more flexible but less safe (typos create phantom agents).
How It Works
- Each agent gets an inbox directory (
{dispatch_dir}/{agent_name}/) - Messages are JSON files written atomically (tmp + rename)
- Presence is tracked via PID files in
{dispatch_dir}/.presence/ - Messages have states:
pending→read→ acknowledged (deleted) - Piggyback delivery: pending messages are attached to every tool response
- TTL cleanup runs lazily on read operations
- Optional watchdog prints stderr alerts for the human operator
Message Format
{
"id": "msg-a1b2c3d4",
"from": "alice",
"to": "bob",
"timestamp": "2026-02-17T20:30:00Z",
"priority": "normal",
"content": "Deployed to staging",
"payload": {"commit": "abc123"},
"thread_id": "deploy-123",
"reply_to": null,
"ttl": 3600,
"must_read": false,
"state": "pending"
}
License
MIT — see LICENSE.
推荐服务器
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 模型以安全和受控的方式获取实时的网络信息。