Back to MCP directory
publicPublicdnsLocal runtime

postal-mcp

Postal是一个基于SQLite的邮箱系统,用于两个代理之间的消息传递,通过HTTP协议的MCP服务器实现消息队列共享。

article

README

🚀 Postal: Agent Comms via MCP

Postal是一个用于实现两个智能体之间通信的邮箱系统,它借助SQLite支持的消息队列在智能体之间传递消息,能有效解决智能体间的信息交互问题,为智能体协作提供有力支持。

🚀 快速开始

Postal创建了一个基于SQLite的消息队列,用于在智能体之间传递消息。MCP服务器仅支持HTTP协议,这意味着所有智能体共享相同的数据库和队列。以下是Claude指导Gemini编写单元测试的示例:

Claude指导Gemini

智能体之间的通信流程可以用以下Mermaid图表示:

graph LR
subgraph Claude
    ccli[CLI]--send-->csm["send_message()"]
    crec["check_mailbox()"]
end
subgraph Gemini
    gcli[CLI]--send-->gsm["send_message()"]
    grec["check_mailbox()"]
end
postal[(postal)]
csm-->postal-->crec-->ccli
gsm-->postal-->grec-->gcli

✨ 主要特性

  • 简单队列:Postal基于SQLite提供了一个简单的消息队列。
  • MCP工具:提供了两个MCP工具,方便智能体之间的通信:
    • send_message(agent_name, message):用于向指定智能体发送消息。
    • check_mailbox():该方法会阻塞,直到在自己的邮箱中收到消息。

智能体可以自由地相互发送消息,以下是一个使用示例:

PROMPT="Notice that you have two tools, check_mail and send_to_agent. You should get **all** instructions from check_mail. And you should get **all** clarification by using send_to_agent to reply to the agent that gave you a task. Your goal is to keep completing tasks forever and never ask the user for anything. Only talk to agents. You are gemini"

gemini --yolo --prompt "$PROMPT"

💻 使用示例

基础用法

以下是一个使用Postal进行智能体通信的示例:

PROMPT="Notice that you have two tools, check_mail and send_to_agent. You should get **all** instructions from check_mail. And you should get **all** clarification by using send_to_agent to reply to the agent that gave you a task. Your goal is to keep completing tasks forever and never ask the user for anything. Only talk to agents. You are gemini"

gemini --yolo --prompt "$PROMPT"

📚 详细文档

MCP配置

MCP服务器以可流式传输的HTTP方式提供服务,路径格式为 /agents/{name}/mcp/。以下是两种不同的配置示例:

STDIO示例

{
  "mcpServers": {
    "postal": {
      "command": "npx",
      "args": ["-y", "mcp-remote", "http://0.0.0.0:7777/agents/gemini/mcp", "--allow-http", "--transport", "http-only"]
    }
  }
}

直接作为HTTP示例

{
  "mcpServers": {
    "postal": {
      "url": "http://0.0.0.0:7777/agents/gemini/mcp",
      "transport": "http"
    }
  }
}

需要注意的是,"http" 的指定方式存在一些差异,有时是 "streamable-http",有时键名为 "type"

🔧 技术细节

实现原理

Postal通过SQLite支持的消息队列来实现智能体之间的消息传递。MCP服务器仅支持HTTP协议,确保所有智能体共享相同的数据库和队列。

注意事项

Gemini CLI

Gemini CLI的使用效果较好,没有太多问题。

Claude代码

Claude代码在返回邮箱方面存在一定困难,需要大量的提示。

help

Runtime guide

cloud

Hosted runtime

Hosted servers run from a provider-managed environment. You usually connect the MCP client to the hosted endpoint or follow the provider's authorization flow, without keeping a local process alive

  1. Open provider connection page
  2. Authorize or copy endpoint
  3. Connect from your MCP client
terminal

Local runtime / other methods

Local servers run on your own machine or infrastructure. You normally copy the server_config into your MCP client, install the required package, and provide env variables from env_schema when needed

  1. Copy server_config
  2. Install required package
  3. Fill env variables and restart client