
Product
Socket Now Protects the Firefox Extension Ecosystem
Socket is bringing experimental protection to Firefox, scanning 97,000+ extensions in Mozilla's official directory for malware and risky updates.
@mearl/cloud-server
Advanced tools
云端 WebSocket Server,用于中转云端 Agent 请求到本地连接器。
推荐通过 setup 安装完整的云端 Agent 环境(cloud-server、统一 client 与 Agent Skill):
npx @mearl/setup --cloud
Qoder Cloud Agent 使用同一套包和 server 命令,只在 setup 时选择配对模式:
npx @mearl/setup --qoder-cloud --yes
在 Docker 或自定义进程托管等只需要 Server 包的场景,可单独安装 @mearl/cloud-server。
Server 默认以后台守护进程方式运行,启动后立即返回,并打印本地机器需要执行的连接命令。
Qoder 模式保持相同的 start/status/restart/stop/logs 交互;start 和 restart 生成新的
pair/connector 信息后退出,不监听端口或创建守护进程。
mearl-cloud-server [command] [options]
子命令:
start - 后台启动 server(默认,不写也等价于 start)stop - 停止后台 serverrestart - 重启后台 serverstatus - 查看运行状态及连接信息logs - 打印 server 日志末尾选项:
--foreground / -f - 前台运行(不守护化,适合 systemd / Docker / PM2)--port <port> - 服务器端口(默认 8080)--path <path> - WebSocket 路径(默认 /ws)--token <token> - 鉴权密钥(未指定时自动生成)--heartbeat <seconds> - 心跳超时时间(默认 90 秒)--max-connections <n> - 最大连接数(默认 100)示例:
# 后台启动(自动生成 token),打印连接命令后立即返回
mearl-cloud-server
# 查看状态与连接信息
mearl-cloud-server status
# 停止 / 重启
mearl-cloud-server stop
mearl-cloud-server restart
# 自定义端口和鉴权
mearl-cloud-server start --port 9000 --token your-secret-token
# 前台运行(交给外部进程管理器托管)
mearl-cloud-server --foreground
后台启动后会打印供本地机器使用的连接命令,例如:
[CloudServer] Started in background (pid 12345)
[CloudServer] Logs: ~/.mearl/cloud-server.log
Connect from your local machine:
npx @mearl/cloud-connector start "ws://10.0.1.100:8080/ws?token=xxx"
运行时文件位于 ~/.mearl/:
cloud-server.json - 连接配置(含 server URL、pid、端口等),统一 @mearl/client 自动读取cloud-server-mode.json - setup 在 Qoder 模式下写入的标识;普通 --cloud 会删除它cloud-server.log - 后台进程日志(logs 子命令读取,或 tail -f 跟踪);超过 5MB 会在下次启动时滚动为 cloud-server.log.1守护进程的启停、状态、日志滚动等生命周期逻辑由共享包
@mearl/daemon-core提供(与 cloud-connector 复用同一套实现)。
关于 token:
--token 时会自动生成。restart 会沿用当前 token,因此之前打印的连接命令重启后仍然有效。stop 后再 start 属于全新启动,会重新生成 token;若希望连接命令长期固定,请显式传入 --token 或设置 MEARL_TOKEN。环境变量:
MEARL_TOKEN - 鉴权密钥(覆盖 --token 选项)CLOUD_SERVER_HOST - 公网主机名(默认自动获取)import { CloudServer } from '@mearl/cloud-server';
const server = new CloudServer({
port: 8080,
path: '/ws',
token: 'your-secret-token',
heartbeatTimeout: 90,
maxConnections: 100,
maxMessageSize: 10 * 1024 * 1024,
});
await server.start();
// 获取统计信息
const stats = server.getStats();
console.log(stats);
// { connections: 2, agents: 1, connectors: 1, pendingRequests: 0 }
// 优雅关闭
await server.stop();
Qoder 模式只复用 cloud-server CLI 作为建联入口。配对完成后的 action 继续通过 Qoder
Client-Side mearl 工具、Session API 和本地 connector 转发,不会连接一个本地
cloud-server 端口。
云端 Agent
↓
@mearl/client
↓ (WebSocket)
@mearl/cloud-server (本进程)
↓ (WebSocket)
@mearl/cloud-connector (本地)
↓ (Unix Socket)
@mearl/native-host
↓
Chrome Extension / CDP
Server 接受两种类型的连接:
两类客户端建连后会分别发送 agent_hello 和 connector_hello。Connector 会注册
稳定 ID、名称和版本;同一 ID 重连时,新连接会替换旧连接。
只有一个 Connector 在线时,Server 自动选择它。多个 Connector 同时在线时,Agent
先调用 connector_list 获取清单,再在请求中传 connector;未指定目标时
Server 会拒绝请求,避免把浏览器操作发到错误机器。
{
"id": "unique-id",
"action": "get_requests",
"data": { "count": 5 },
"connector": "work-mac",
"version": "1.30.0"
}
connector 接受 connector ID 或可唯一匹配的名称。connector_list 是
Server 内置命令,不会转发到浏览器侧。
{
"id": "unique-id",
"success": true,
"data": { ... },
"versionWarning": "..."
}
{ "type": "ping", "timestamp": 1234567890 }
{ "type": "pong", "timestamp": 1234567890 }
设置 token 后,所有连接必须携带正确的 token:
# Agent 连接
ws://server.com/ws?token=your-secret-token
# Connector 连接
ws://server.com/ws?token=your-secret-token
交给外部进程管理器(systemd / Docker / PM2)托管时,请加
--foreground,让 server 在前台运行,由管理器负责守护与重启。
[Unit]
Description=Mearl Cloud Server
After=network.target
[Service]
Type=simple
User=your-user
ExecStart=/usr/bin/mearl-cloud-server --foreground --port 8080 --token your-token
Restart=always
RestartSec=5
[Install]
WantedBy=multi-user.target
FROM node:20-alpine
RUN npm install -g @mearl/cloud-server
EXPOSE 8080
CMD ["mearl-cloud-server", "--foreground", "--token", "your-token"]
pm2 start mearl-cloud-server --name mtop-cloud-server -- --foreground --port 8080 --token your-token
maxConnections 限制资源占用token 鉴权保护服务安全FAQs
Cloud WebSocket server for Mearl — bridges cloud agents to local connectors
The npm package @mearl/cloud-server receives a total of 450 weekly downloads. As such, @mearl/cloud-server popularity was classified as not popular.
We found that @mearl/cloud-server demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 2 open source maintainers collaborating on the project.

Product
Socket is bringing experimental protection to Firefox, scanning 97,000+ extensions in Mozilla's official directory for malware and risky updates.

Research
/Security News
Three compromised Rust crates pulled in a malicious dependency that downloaded and executed cross-platform malware during Cargo builds.

Research
/Security News
Socket uncovered 77 linked Firefox extensions, including 40 that steal wallet secrets or credentials and 37 deceptive sports-score shells.