CLI commands

附加命令列介面

openclaw attach 會啟動 Claude Code,並使用綁定到單一閘道工作階段的嚴格暫時 MCP 設定。

sh
openclaw attachopenclaw attach --session agent:main:telegram:123 --ttl 600000openclaw attach --print-config

選項:

  • --session <key> 會將授權綁定到一個閘道工作階段。預設為主要工作階段。
  • --ttl <ms> 會要求以毫秒為單位的正值授權 TTL。閘道會套用自己的上限。
  • --bin <path> 會選取 Claude Code 二進位檔。預設為 claude
  • --print-config 會寫入暫時的 .mcp.json、列印啟動命令與環境變數,並讓授權維持有效直到 TTL 到期。

Bearer 權杖會透過環境變數傳遞,而不是 argv。OpenClaw 會使用 --strict-mcp-config --mcp-config <path> 啟動 Claude Code,因此周圍環境中的 Claude MCP 伺服器不會加入已附加的工作階段。一般啟動會在 Claude Code 程序結束時撤銷授權。

另請參閱:閘道命令列介面MCP 命令列介面ACP 命令列介面

Was this useful?