MCP谈话
通过模型上下文协议(MCP)进行代理间消息传递。
一个轻量级的消息传递系统,使AI代理(Claude、Codex、Gemini等)能够通过共享消息队列实时相互通信。
特性
- 简单的工具:
send,check,ack,broadcast,list,clean,reply - 基于文件的持久性:消息存储为JSON文件,便于调试
- 命名空间隔离:每个项目单独的消息队列
- 交叉代理:可与任何兼容MCP的AI助手配合使用
- 零依赖:只有Python 3.10+和MCP SDK
安装
# From PyPI (recommended)
pipx install mcp-talk
# Or with pip
pip install mcp-talk
# From source
git clone https://github.com/devinvenable/mcp-talk.git
cd mcp-talk
pipx install .配置
添加到MCP客户端配置中:
克劳德桌面/克劳德代码
{
"mcpServers": {
"mcp-talk": {
"command": "mcp-talk"
}
}
}使用uvx(无需安装)
{
"mcpServers": {
"mcp-talk": {
"command": "uvx",
"args": ["mcp-talk"]
}
}
}Codex命令行界面(~/.Codex/config.toml)
[mcp_servers.mcp-talk]
command = "mcp-talk"Gemini命令行界面(~/.ggemini/settings.json)
{
"mcpServers": {
"mcp-talk": {
"command": "mcp-talk"
}
}
}工具
send -发送直接消息
send(to="codex", message="Please review PR #123", from_agent="claude")check / chk -检查消息
check(agent="claude")
chk(agent="claude", include_body=true, auto_ack=true)默认情况下最多返回5条消息。使用 include_body=true 对于完整的消息文本, auto_ack=true 阅读后删除。
broadcast -发送给所有代理
broadcast(message="Standup in 5 minutes", from_agent="pm")ack -确认/删除消息
ack(id="20251126_143022_abc12345")reply -回复消息
reply(id="20251126_143022_abc12345", message="Done!", from_agent="gemini")自动向原始发件人发送响应并确认原始消息。
list -列出所有邮件(PM视图)
list(limit=10, include_body=true)clean -删除旧邮件
clean(hours=24)命名空间
使用隔离项目之间的消息 namespace 参数:
# Game project
send(to="gemini", message="Review level 3", namespace="game")
check(agent="gemini", namespace="game")
# Work project
send(to="gemini", message="Review PR #123", namespace="work")
check(agent="gemini", namespace="work")消息存储在单独的目录中:
~/.mcp_talk/q/ # default (no namespace)
~/.mcp_talk/q/game/ # namespace="game"
~/.mcp_talk/q/work/ # namespace="work"消息格式
消息以JSON文件存储在 ~/.mcp_talk/q/:
{
"id": "20251126_143022_abc12345",
"from": "claude",
"to": "codex",
"type": "direct",
"created": "2025-11-26T14:30:22+00:00",
"message": "Please review PR #123",
"namespace": "work"
}环境变量
| 变量 | 默认值 | 描述 |
|---|---|---|
MCP_TALK_QUEUE | ~/.mcp_talk/q/ | 消息队列目录 |
MCP_TALK_AUTO_CLEAN_HOURS | 24 | 自动删除超过N小时的邮件(0表示禁用) |
MCP_TALK_MAX_MESSAGE_CHARS | 2000 | 最大消息长度 |
多代理设置提示
教导代理检查消息
这 chk 快捷方式被设计成一个简单的关键字,您可以将其添加到代理指令中。添加到代理的系统提示或内存中:
双子座 (~/.gemini/instructions.md):
When I read new messages, I should investigate the topic, verify assertions, and contribute my own expertise to the team.克劳德 (项目中的CLAUDE.md):
When starting work, check for messages with: chk(agent="claude")法典 (~/.codex/instructions.md):
Before starting tasks, check the message queue for any team communications.建议使用带有环境覆盖的MCP配置
使用环境变量自定义每个代理的行为:
# ~/.codex/config.toml
[mcp_servers.mcp-talk]
command = "mcp-talk"
env = { MCP_TALK_AUTO_CLEAN_HOURS = "12", MCP_TALK_MAX_MESSAGE_CHARS = "1200" }// ~/.gemini/settings.json
{
"mcpServers": {
"mcp-talk": {
"command": "mcp-talk",
"env": {
"MCP_TALK_AUTO_CLEAN_HOURS": "12",
"MCP_TALK_MAX_MESSAGE_CHARS": "1200"
}
}
}
}工作流示例
- 克劳德 向Gemini发送任务:
send(to="gemini", message="Please review the authentication module", from_agent="claude")- 双子座 检查消息:
chk(agent="gemini")- 双子座 完成后回复:
reply(id="20251126_143022_abc12345", message="Review complete, LGTM!", from_agent="gemini")- 克劳德 收到回复:
chk(agent="claude")发展
# Clone and install in development mode
git clone https://github.com/devinvenable/mcp-talk.git
cd mcp-talk
pip install -e .
# Reinstall after changes (if using pipx)
pipx install --force .许可证
麻省理工学院
