MCP Agent Bridge
MCP Agent Bridge
一个轻量级的 MCP (Model Context Protocol) 桥接服务器,使 Hermes Agent 和 OpenClaw 能够共享工具和内存,从而形成协作式多智能体系统。
架构
┌─────────────┐ ┌──────────────────┐ ┌─────────────┐
│ Hermes │ MCP │ Agent Bridge │ CLI/ │ OpenClaw │
│ Agent │◄───────►│ (FastMCP SSE) │◄───────►│ CLI │
│ │ client │ Port :18900 │ HTTP │ │
│ Feishu/WX │ │ │ │ Image/Web │
│ Memory/Plan │ │ Shared Memory │ │ TTS/Video │
└─────────────┘ └──────────────────┘ └─────────────┘Hermes 提供消息通道(飞书、微信、Telegram……)及其规划/推理能力。
OpenClaw 提供 AI 图像生成、网页搜索、TTS 和视频生成能力。
Bridge 通过标准的 MCP 工具调用以及基于 SQLite 的共享内存存储,使每个智能体的优势能够被对方所用。
Related MCP server: ACP-MCP-Server
暴露的工具
工具 | 方向 | 描述 |
| OC → Hermes | 通过 OpenClaw 进行 AI 图像生成 |
| OC → Hermes | 通过 OpenClaw 进行网页搜索 |
| OC → Hermes | 通过 OpenClaw 提取 URL 内容 |
| OC → Hermes | 通过 OpenClaw 进行文本转语音 |
| Hermes → OC | 通过 Hermes 的平台发送消息 |
| Hermes → OC | 将任务委托给 Hermes 的 AI 智能体 |
| 双向 | 从共享键值存储中读取 |
| 双向 | 写入共享键值存储 |
| 双向 | 列出带有可选过滤器的内存键 |
| 双向 | 删除内存键 |
| — | 健康检查及已注册模块列表 |
快速开始
前置要求
Python 3.11+
已启用 API Server 的 Hermes Agent
已安装并配置的 OpenClaw CLI
pip install "mcp[cli]>=1.0" aiohttp pyyaml
安装
git clone https://github.com/fkdt01/mcp-agent-bridge.git
cd mcp-agent-bridge
pip install -e .配置
cp config.example.yaml config.yaml
# Edit config.yaml — fill in your API keys and paths关键设置:
openclaw:
cli_path: "openclaw" # or full path like /usr/local/bin/openclaw
image_provider: "openai" # default image gen provider
web_search_provider: "duckduckgo"
hermes:
api_url: "http://127.0.0.1:8888"
api_key: "" # or set HERMES_API_KEY env var
default_channel: "feishu"
memory:
backend: "sqlite"
db_path: "data/bridge_memory.db"运行
# Start the bridge server
python -m bridge.server
# With custom options
python -m bridge.server --config /path/to/config.yaml --port 18900 --log-level DEBUG连接 Hermes
添加到 ~/.hermes/config.yaml:
mcp_servers:
agent-bridge:
transport: sse
url: http://127.0.0.1:18900/sse连接 OpenClaw
添加到 ~/.openclaw/openclaw.json → mcpServers:
{
"mcpServers": {
"agent-bridge": {
"transport": "sse",
"url": "http://127.0.0.1:18900/sse"
}
}
}使用示例
Hermes 通过 OpenClaw 生成图像
当 Hermes 需要生成图像时(例如来自飞书聊天),它会调用:
oc_image_generate({
prompt: "A futuristic city at sunset, cyberpunk style",
aspect_ratio: "16:9",
model: "openai"
})→ Bridge 运行 openclaw capability image generate --prompt "..." --json
→ 将图像路径/元数据返回给 Hermes
→ Hermes 将图像发送给用户
OpenClaw 通过 Hermes 发送飞书消息
hermes_send_message({
message: "✅ Image generation complete!",
target: "feishu"
})→ Bridge 向 Hermes API /v1/chat/completions 发送 POST 请求
→ Hermes 将消息发送到飞书频道
智能体间的共享内存
Hermes 写入项目上下文:
shared_memory_write({
key: "project.math-game.pet-design",
value: "算术小喵: 草原主题, 绿色配色",
source: "hermes"
})OpenClaw 稍后读取它:
shared_memory_read({ key: "project.math-game.pet-design" })
→ { value: "算术小喵: 草原主题, 绿色配色", source: "hermes", updated_at: 1745631000 }添加自定义工具
在 bridge/tools/ 中创建一个新文件,遵循命名约定:
oc_*.py— OpenClaw 支持的工具hermes_*.py— Hermes 支持的工具shared_*.py— 共享/双向工具
每个模块必须暴露一个 register(mcp, config) 函数:
"""My custom tool."""
from mcp.server.fastmcp import FastMCP
from typing import Any
def register(mcp: FastMCP, config: dict[str, Any]) -> None:
@mcp.tool()
async def my_custom_tool(param: str) -> dict[str, Any]:
"""Tool description — this becomes the MCP tool description."""
# Your implementation here
return {"result": "ok"}该工具会在服务器启动时自动发现并注册。
作为 systemd 服务运行
cat > ~/.config/systemd/user/mcp-agent-bridge.service << 'EOF'
[Unit]
Description=MCP Agent Bridge Server
After=network.target
[Service]
Type=simple
WorkingDirectory=/path/to/mcp-agent-bridge
ExecStart=/usr/bin/python -m bridge.server
Restart=on-failure
RestartSec=5
Environment=HERMES_API_KEY=your_key_here
[Install]
WantedBy=default.target
EOF
systemctl --user daemon-reload
systemctl --user enable --now mcp-agent-bridge项目结构
mcp-agent-bridge/
├── bridge/
│ ├── __init__.py
│ ├── __main__.py
│ ├── server.py # FastMCP server entry point
│ ├── config.py # YAML + env-var config loader
│ ├── openclaw_runner.py # Shared async CLI subprocess runner
│ ├── memory.py # SQLite-backed shared memory store
│ └── tools/
│ ├── __init__.py # Auto-discovery & registration
│ ├── oc_image.py # Image generation
│ ├── oc_web.py # Web search & fetch
│ ├── oc_tts.py # Text-to-speech
│ ├── hermes_messaging.py # Message sending
│ ├── hermes_chat.py # Task delegation
│ └── shared_memory.py # Shared memory tools
├── config.example.yaml
├── .gitignore
├── LICENSE
├── README.md
└── pyproject.toml许可证
MIT
This server cannot be deployed
Maintenance
Related MCP Connectors
The Remote MCP server acts as a standardized bridge between LLM applications (like Claude, ChatGPT, and Cursor) and external services, enabling AI agents to access external tools and resources. Its primary capability is providing a centralized search tool to discover other MCP servers and their respective tools. Unlike local implementations, it runs remotely with OAuth authentication and permission controls for security.
An MCP memory server. One memory your agents share — across models, devices and apps.
Shared memory and mail for your AI agents. Verified with Claude Code; other MCP clients in testing.
MCP server unifying ERPs, CRMs, APIs and knowledge base for Claude, ChatGPT and Gemini.
Related MCP Servers
- AlicenseAqualityFmaintenanceA bridge server that enables MCP-compatible AI assistants like Claude to seamlessly discover, communicate with, and manage A2A protocol agents.733 PyPI147Apache 2.0
- AlicenseBqualityFmaintenanceA bridge server that connects Agent Communication Protocol (ACP) agents with Model Context Protocol (MCP) clients, enabling seamless integration between ACP-based AI agents and MCP-compatible tools like Claude Desktop.16125 PyPI24MIT
- AlicenseNot gradedqualityDmaintenanceAn MCP server and local HTTP bridge designed to integrate remote upstream MCP tools into OpenClaw skills or local environments. It enables users to generate skill wrappers and proxy tool calls via a local HTTP bridge for use in Claude Desktop, Cursor, or OpenClaw.Apache 2.0
- AlicenseNot gradedqualityDmaintenanceBridges OpenClaw and Hermes Agent, enabling multi-turn conversations, messaging via Hermes channels, and health checks through MCP tools.12 npmMIT