Wrap openclaw acp into a standard stdio ACP server.
Project description
OpenClaw ACP Stdio Wrapper
将 openclaw acp 包装为标准 stdio ACP 服务器的桥接工具。
背景
openclaw acp 是 OpenClaw 的 ACP (Agent Client Protocol) 桥接进程,但它不是标准的ACP协议。本项目通过 stdio 包装层,将其转化为了标准的 ACP 消息处理能力,使其能够被 Clawdboz 等 ACP 客户端正常调用。
功能
- Gateway 管理:自动检测并启动
openclaw gateway(端口18789) - ACP 桥接:启动并管理
openclaw acp子进程 - 协议翻译:自动转换
initialize请求的protocolVersion - Agent Fallback:当
openclaw acp不支持某些方法(如session/prompt、tools/call)时,直接调用openclaw agentCLI 获取真实回复 - 流式通知:为
session/prompt提供标准的 ACP 流式响应(thinking→agent_message_chunk→stopReason) - 自动建 Session:每次启动自动分配全新 session,对话上下文相互隔离
安装
pip install openclaw-acp
或从源码安装:
git clone https://github.com/Dr-Lv/openclaw-acp
cd openclaw-acp
pip install -e .
依赖
- Python >= 3.10
- OpenClaw CLI (
openclaw命令需在 PATH 中) - 运行中的 OpenClaw Gateway(wrapper 会自动启动,也可提前手动运行)
使用
安装后会暴露 openclaw-acp 命令:
# 基本启动
openclaw-acp
# 指定 openclaw 二进制路径
openclaw-acp --openclaw-bin /opt/homebrew/bin/openclaw
环境变量
| 变量 | 说明 | 默认值 |
|---|---|---|
OPENCLAW_SESSION_ID |
强制使用指定 session ID(留空则每次启动自动新建) | 自动生成 UUID |
作为 MCP/ACP 服务器配置
在支持 stdio ACP 的客户端(如 Cursor、Claude Desktop)中配置:
{
"mcpServers": {
"openclaw": {
"command": "openclaw-acp"
}
}
}
工作原理
┌─────────────┐ Content-Length/NDJSON ┌──────────────────────┐ NDJSON ┌─────────────┐
│ ACP 客户端 │ ────────────────────────────> │ openclaw-acp-wrapper │ ──────────────> │ openclaw acp│
│ (Clawdboz) │ │ │ │ │
│ │ <──────────────────────────── │ - 协议翻译 │ <─────────────│ bridge │
│ │ NDJSON (session/update) │ - Agent fallback │ │ │
└─────────────┘ │ - 流式通知 │ └─────────────┘
└──────────────────────┘
│
│ 启动/管理
▼
┌──────────────────────┐
│ openclaw gateway │
│ (127.0.0.1:18789) │
└──────────────────────┘
协议说明
Wrapper 的输入支持两种格式:
- Content-Length 分帧(标准 MCP/ACP)
- 换行分隔 JSON(newline-delimited JSON)
输出统一使用 换行分隔 JSON,与 clawdboz 等客户端兼容。
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file openclaw_acp-0.1.0.tar.gz.
File metadata
- Download URL: openclaw_acp-0.1.0.tar.gz
- Upload date:
- Size: 14.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9efbf7e7a646f55e6cb252d449fcb26e8ffd1a34d6ed46c43695613ec7adbb09
|
|
| MD5 |
f6e273662c976dfde4eca76df0e762e1
|
|
| BLAKE2b-256 |
73a18c9aed0d7c2d294ff632c7427159e718b0ae2887dd1e58bdf58e4565831b
|
File details
Details for the file openclaw_acp-0.1.0-py3-none-any.whl.
File metadata
- Download URL: openclaw_acp-0.1.0-py3-none-any.whl
- Upload date:
- Size: 33.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b625d71f0288541bcf14f849a810eac65bef206cc20c2324c4f659ae0f68c1ce
|
|
| MD5 |
31dd7b63ad263c08990e1173896e1fd4
|
|
| BLAKE2b-256 |
6dd3a016d96cd5325851ce915c65e786f6ce5aee7325c7572e38911fd10f7e4d
|