安装 CLI 工具
安装 Mopheus CLI、Claude CLI、SwissQL 等命令行工具。
安装 CLI 工具
安装 Mopheus CLI、Claude CLI、SwissQL 等命令行工具,用于管理 Mopheus 平台和执行智能体任务。
前提条件
| 要求 | 说明 |
|---|---|
| Mopheus 账户 | 需要先在 Web 界面注册账户 |
| 可访问 Mopheus 后端 | CLI 需要连接到 Mopheus 服务器 |
安装方式
方式一:从安装包安装
如果已部署 Mopheus 平台,可从安装包中安装 CLI 工具:
# 进入安装目录
cd /app/mopheus
# 安装并配置所有 CLI 工具(mopheus、claude、swissql、kimi-code)
./mopheus.sh install-cli
# 可选:不重新安装二进制,仅重新执行配置
./mopheus.sh init-cli在 Linux 和 macOS 上,安装会将 CLI 目录加入当前会话,并写入检测到的 Shell 配置文件(.zshrc、.bashrc 或 .profile)。如果配置文件无法写入,请根据提示手动添加 export PATH=...,然后重新加载配置文件。
方式二:在线安装
如果只需要 CLI 工具,可使用在线安装脚本。
Linux / macOS:
curl -fsSL https://mopheus.obs.cn-north-4.myhuaweicloud.com/tools/install-cli-online.sh | bashLinux / macOS 脚本支持以下选项:
# 仅安装 CLI 工具,不部署 SwissQL
curl -fsSL https://mopheus.obs.cn-north-4.myhuaweicloud.com/tools/install-cli-online.sh | bash -s -- --mode cli
# 指定服务器地址
curl -fsSL https://mopheus.obs.cn-north-4.myhuaweicloud.com/tools/install-cli-online.sh | bash -s -- --server-url http://your-server:8080
# 安装指定工具
curl -fsSL https://mopheus.obs.cn-north-4.myhuaweicloud.com/tools/install-cli-online.sh | bash -s -- --tools mopheus,swissqlWindows:
irm https://mopheus.obs.cn-north-4.myhuaweicloud.com/tools/install-cli-online.ps1 | iexWindows PowerShell 脚本默认只安装 mopheus CLI,不会部署 SwissQL,也不会安装 claude、swissql、kimi-code 等其他工具。安装完成后重新打开一个终端,让 PATH 更新生效。
验证安装
# Windows 默认只安装 mopheus CLI
mopheus --version
# 如果安装了其他工具,也可以验证
claude --version
swissql --version配置 CLI
配置服务器地址
如果使用自托管 Mopheus 实例,需要配置服务器地址:
mopheus config set server_url https://your-mopheus.example.com登录认证
# 方式一:交互输入 API Token(在 Web 界面 Settings → API Tokens 创建)
mopheus login --token
# 方式二:用邮箱密码登录,CLI 会自动创建长期 API Token
mopheus login --email your@email.com --password yourpassword验证登录是否成功:
mopheus workspace list如果列表正常返回(即使为空),说明连接成功。
Profile 配置
CLI 支持多个独立 Profile,适合同时管理不同 Mopheus 实例(如生产/测试环境):
# 为不同实例指定 Profile
mopheus --profile prod config set server_url https://prod.example.com
mopheus --profile staging config set server_url https://staging.example.comProfile 文件默认在 ~/.mopheus/config.json,命名 Profile 在 ~/.mopheus/profiles/{name}/config.json。
可通过环境变量 MOPHEUS_PROFILE 指定默认 Profile。
发现与查看 Profile
列出本机所有已配置的 Profile:
# 列出所有 Profile
mopheus profile list
# 简写别名
mopheus profile ls
# 以 JSON 格式输出
mopheus profile list -o json查看指定 Profile(或默认 Profile)的详细配置:
# 查看默认 Profile 配置
mopheus profile show
# 查看指定命名 Profile 配置
mopheus profile show prod
# 以 JSON 格式输出
mopheus profile show prod -o json输出中的 Token 敏感信息会自动进行掩码脱敏。要查看当前通过命令行参数或环境变量生效的配置,也可以运行:
mopheus config show