Skip to main content

Wrap openclaw acp into a standard stdio ACP server.

Project description

OpenClaw ACP Stdio Wrapper

openclaw acp 包装为标准 stdio ACP 服务器的桥接工具。

背景

openclaw acpOpenClaw 的 ACP (Agent Client Protocol) 桥接进程,但它不是标准的ACP协议。本项目通过 stdio 包装层,将其转化为了标准的 ACP 消息处理能力,使其能够被 Clawdboz 等 ACP 客户端正常调用。

功能

  • Gateway 管理:自动检测并启动 openclaw gateway(端口 18789
  • ACP 桥接:启动并管理 openclaw acp 子进程
  • 协议翻译:自动转换 initialize 请求的 protocolVersion
  • Agent Fallback:当 openclaw acp 不支持某些方法(如 session/prompttools/call)时,直接调用 openclaw agent CLI 获取真实回复
  • 流式通知:为 session/prompt 提供标准的 ACP 流式响应(thinkingagent_message_chunkstopReason
  • 自动建 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

openclaw_acp-0.1.0.tar.gz (14.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

openclaw_acp-0.1.0-py3-none-any.whl (33.8 kB view details)

Uploaded Python 3

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

Hashes for openclaw_acp-0.1.0.tar.gz
Algorithm Hash digest
SHA256 9efbf7e7a646f55e6cb252d449fcb26e8ffd1a34d6ed46c43695613ec7adbb09
MD5 f6e273662c976dfde4eca76df0e762e1
BLAKE2b-256 73a18c9aed0d7c2d294ff632c7427159e718b0ae2887dd1e58bdf58e4565831b

See more details on using hashes here.

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

Hashes for openclaw_acp-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b625d71f0288541bcf14f849a810eac65bef206cc20c2324c4f659ae0f68c1ce
MD5 31dd7b63ad263c08990e1173896e1fd4
BLAKE2b-256 6dd3a016d96cd5325851ce915c65e786f6ce5aee7325c7572e38911fd10f7e4d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page