> ## Documentation Index
> Fetch the complete documentation index at: https://docs.trae.cn/llms.txt
> Use this file to discover all available pages before exploring further.

远程连接适用于在远程机器上启动一个长期运行的 app-server，再从本地客户端连接。典型场景是远程 SSH 终端不方便粘贴图片，或希望从本地工具连接远端工作区。

在远端机器上启动 app-server：

```Bash
traecli app-server --listen ws://0.0.0.0:4222
```

建议为远程连接配置认证 token，避免未授权访问：

```Bash
openssl rand -hex 32 > ~/.trae/ws-token
chmod 600 ~/.trae/ws-token

traecli app-server --listen ws://0.0.0.0:4222 \
  --ws-auth capability-token \
  --ws-token-file ~/.trae/ws-token
```

本地连接：

```Bash
traecli --remote ws://<remote-host>:4222
```

远程端口和网络访问策略由你的运行环境决定；不要把未加认证的 app-server 暴露到不可信网络。
