setup-cloudbase-openclaw
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseSetup CloudBase for OpenClaw/Moltbot
为OpenClaw/Moltbot配置CloudBase
This skill guides you through configuring your OpenClaw/Moltbot installation for CloudBase full-stack development.
本技能将引导您完成OpenClaw/Moltbot的安装配置,以适配CloudBase全栈开发。
Prerequisites
前提条件
Before starting, ensure you have:
- A Tencent Cloud account with CloudBase enabled
- Access to your CloudBase environment ID and credentials
开始之前,请确保您已具备:
- 已启用CloudBase的腾讯云账号
- 可访问您的CloudBase环境ID和凭证
Quick Setup Overview
快速设置概览
| Step | Action | Purpose |
|---|---|---|
| 1 | Check installation dirs | Find where OpenClaw/Moltbot is installed |
| 2 | Locate workspace | Identify the agent workspace directory |
| 3 | Configure MCP | Set up CloudBase MCP with credentials |
| 4 | Update AGENTS.md | Add CloudBase development rules |
| 5 | Install skill-enhancer plugin (optional) | Install plugin to enforce skill usage |
| 6 | Install skills | Install CloudBase-related skills |
| 7 | Copy app template (optional) | Copy CloudBase React template to workspace |
| 8 | Apply changes | Use /new to start a new session |
| 步骤 | 操作 | 目的 |
|---|---|---|
| 1 | 检查安装目录 | 查找OpenClaw/Moltbot的安装位置 |
| 2 | 定位工作区 | 识别Agent工作区目录 |
| 3 | 配置MCP | 使用凭证设置CloudBase MCP |
| 4 | 更新AGENTS.md | 添加CloudBase开发规则 |
| 5 | 安装skill-enhancer插件(可选) | 安装插件以强制使用技能 |
| 6 | 安装技能 | 安装CloudBase相关技能 |
| 7 | 复制应用模板(可选) | 将CloudBase React模板复制到工作区 |
| 8 | 应用更改 | 使用/new启动新会话 |
Step 1: Check Installation Directories
步骤1:检查安装目录
First, identify which directory your installation uses:
bash
undefined首先,确认您的安装使用的是哪个目录:
bash
undefinedCheck for OpenClaw directory
检查OpenClaw目录
ls -la ~/.openclaw/
ls -la ~/.openclaw/
Or check for Moltbot directory
或检查Moltbot目录
ls -la ~/.clawdbot/
ls -la ~/.clawdbot/
Or check for standard moltbot config
或检查标准moltbot配置
ls -la ~/.moltbot/
**What to look for:**
- Configuration file: `moltbot.json` or `config.json`
- Workspace path defined in the config
- Existing `skills/` directory
**Run the setup script to auto-detect:**
```bash
npx @cloudbase/setup-openclaw detectThis command automatically downloads and runs the latest version of the setup script from npm.
ls -la ~/.moltbot/
**需要查找的内容:**
- 配置文件:`moltbot.json`或`config.json`
- 配置中定义的工作区路径
- 已存在的`skills/`目录
**运行设置脚本自动检测:**
```bash
npx @cloudbase/setup-openclaw detect该命令会自动从npm下载并运行最新版本的设置脚本。
Step 2: Locate Workspace Directory
步骤2:定位工作区目录
The workspace is where your agent reads/writes files and where AGENTS.md lives.
Find it in your config:
bash
undefined工作区是Agent读写文件以及AGENTS.md所在的位置。
在配置文件中查找它:
bash
undefinedRead config and find workspace
读取配置并查找工作区
cat ~/.openclaw/moltbot.json | grep '"workspace"'
cat ~/.openclaw/moltbot.json | grep '"workspace"'
or
或
cat ~/.clawdbot/moltbot.json | grep '"workspace"'
cat ~/.clawdbot/moltbot.json | grep '"workspace"'
or
或
cat ~/.moltbot/moltbot.json | grep '"workspace"'
**Common default workspaces:**
- `~/clawd/` - Default for many installations
- `~/.openclaw/workspace/` - OpenClaw default
- Custom path specified in your config
**Note this path** — you'll need it for Step 4.
---cat ~/.moltbot/moltbot.json | grep '"workspace"'
**常见默认工作区:**
- `~/clawd/` - 许多安装的默认路径
- `~/.openclaw/workspace/` - OpenClaw默认路径
- 配置中指定的自定义路径
**请记录此路径** —— 步骤4会用到它。
---Step 3: Configure CloudBase MCP
步骤3:配置CloudBase MCP
3.1 Get Your CloudBase Credentials
3.1 获取CloudBase凭证
You need three values:
- Environment ID (EnvId) - Your CloudBase environment identifier
- SecretId - Tencent Cloud API Secret ID
- SecretKey - Tencent Cloud API Secret Key
How to get them:
-
EnvId: Go to CloudBase Console
- Select your environment
- Copy the Environment ID from the top-left corner
-
SecretId & SecretKey: Go to CAM API Key Management
- Create a new API key or use existing
- Copy both SecretId and SecretKey
您需要三个值:
- 环境ID(EnvId) - 您的CloudBase环境标识符
- SecretId - 腾讯云API密钥ID
- SecretKey - 腾讯云API密钥
获取方式:
-
EnvId:访问CloudBase控制台
- 选择您的环境
- 从左上角复制环境ID
-
SecretId & SecretKey:访问CAM API密钥管理
- 创建新的API密钥或使用现有密钥
- 复制SecretId和SecretKey
3.2 Create or Update mcporter Config
3.2 创建或更新mcporter配置
In your workspace directory, create or update :
config/mcporter.jsonbash
undefined在您的工作区目录中,创建或更新:
config/mcporter.jsonbash
undefinedFirst, create the config directory if it doesn't exist
首先,若配置目录不存在则创建
mkdir -p <workspace>/config
mkdir -p <workspace>/config
Then create the mcporter.json file
然后创建mcporter.json文件
nano <workspace>/config/mcporter.json
**Add the following configuration:**
```json
{
"mcpServers": {
"cloudbase-mcp": {
"description": "CloudBase MCP",
"command": "npx",
"args": ["@cloudbase/cloudbase-mcp@latest"],
"env": {
"TENCENTCLOUD_SECRETID": "your_secret_id_here",
"TENCENTCLOUD_SECRETKEY": "your_secret_key_here",
"CLOUDBASE_ENV_ID": "your_env_id_here"
}
}
}
}用户必须提供以下三项并替换占位符,MCP 才能正常调用云开发:
如何获取:
nano <workspace>/config/mcporter.json
**添加以下配置:**
```json
{
"mcpServers": {
"cloudbase-mcp": {
"description": "CloudBase MCP",
"command": "npx",
"args": ["@cloudbase/cloudbase-mcp@latest"],
"env": {
"TENCENTCLOUD_SECRETID": "your_secret_id_here",
"TENCENTCLOUD_SECRETKEY": "your_secret_key_here",
"CLOUDBASE_ENV_ID": "your_env_id_here"
}
}
}
}用户必须提供以下三项并替换占位符,MCP 才能正常调用云开发:
如何获取:
3.3 Verify MCP Configuration
3.3 验证MCP配置
Test that mcporter can load the configuration:
bash
cd <workspace>
npx mcporter listYou should see in the list of available MCP servers.
cloudbase-mcp测试mcporter是否能加载配置:
bash
cd <workspace>
npx mcporter list您应该会在可用MCP服务器列表中看到。
cloudbase-mcpStep 4: Update AGENTS.md
步骤4:更新AGENTS.md
Add CloudBase development rules to your workspace's AGENTS.md.
If AGENTS.md doesn't exist, create it:
bash
nano <workspace>/AGENTS.mdAdd the following CloudBase section:
markdown
undefined在工作区的AGENTS.md中添加CloudBase开发规则。
若AGENTS.md不存在,请创建它:
bash
nano <workspace>/AGENTS.md添加以下CloudBase章节:
markdown
undefinedCloudBase Development
CloudBase开发
When working with CloudBase projects, the agent MUST:
-
Read skills first - Before writing any code, read the relevant CloudBase skills:
- - Essential development guidelines
cloudbase-guidelines - - For web apps with static hosting
web-development - - For WeChat mini programs
miniprogram-development - - For cloud function development
cloud-functions - - For web authentication
auth-web-cloudbase - - For document database operations
cloudbase-document-database-web-sdk
-
Use MCP, not CLI - All CloudBase operations must go through CloudBase MCP tools:
- Environment queries via MCP
- Database configuration via MCP
- Cloud function deployment via MCP
- Do NOT use the CloudBase CLI (it requires interactive login)
-
Prefer SDK + security rules - If the requirement can be satisfied with the document database SDK and security rules alone, do NOT introduce cloud functions.
-
The workspace includes a CloudBase + React template (directory) that you can copy as a starting point for new projects.
app/ -
Deploy to subdirectory (mandatory) - When deploying web apps to static hosting, you MUST use a subdirectory path (e.g.,), not the root, unless the user explicitly asks otherwise.
/my-app/ -
Auto-deploy web apps - After completing a web application, automatically deploy it to CloudBase static hosting using MCP tools.
---处理CloudBase项目时,Agent必须:
-
先读取技能 - 编写任何代码之前,先阅读相关的CloudBase技能:
- - 核心开发指南
cloudbase-guidelines - - 适用于带静态托管的Web应用
web-development - - 适用于微信小程序
miniprogram-development - - 适用于云函数开发
cloud-functions - - 适用于Web身份验证
auth-web-cloudbase - - 适用于文档数据库操作
cloudbase-document-database-web-sdk
-
使用MCP而非CLI - 所有CloudBase操作必须通过CloudBase MCP工具执行:
- 通过MCP查询环境
- 通过MCP配置数据库
- 通过MCP部署云函数
- 请勿使用CloudBase CLI(它需要交互式登录)
-
优先使用SDK+安全规则 - 如果需求仅通过文档数据库SDK和安全规则即可满足,则无需引入云函数。
-
工作区包含一个CloudBase + React模板(目录),您可以将其复制作为新项目的起点。
app/ -
必须部署到子目录 - 将Web应用部署到静态托管时,必须使用子目录路径(例如),除非用户明确要求使用根目录。
/my-app/ -
自动部署Web应用 - 完成Web应用开发后,自动使用MCP工具将其部署到CloudBase静态托管。
---Step 5: Install Skill Enhancer Plugin (Optional)
步骤5:安装Skill Enhancer插件(可选)
The skill-enhancer plugin automatically instructs the model to list available skills and justify their usage before responding, ensuring skills are properly considered before writing code.
skill-enhancer插件会自动指示模型在响应前列出可用技能并说明使用理由,确保在编写代码前充分考虑相关技能。
5.1 Install the Plugin
5.1 安装插件
bash
npx @cloudbase/setup-openclaw install-pluginWhat it does:
- Detects your OpenClaw/Moltbot installation directory (,
~/.openclaw/, or~/.clawdbot/)~/.moltbot/ - Creates directory in the installation directory
extensions/skill-enhancer/ - Copies plugin files (and
openclaw.plugin.json) from the skill packageindex.ts - Creates or updates to enable the plugin
openclaw.json - Provides instructions to restart the gateway
bash
npx @cloudbase/setup-openclaw install-plugin插件功能:
- 检测您的OpenClaw/Moltbot安装目录(、
~/.openclaw/或~/.clawdbot/)~/.moltbot/ - 在安装目录中创建目录
extensions/skill-enhancer/ - 从技能包中复制插件文件(和
openclaw.plugin.json)index.ts - 创建或更新以启用插件
openclaw.json - 提供重启网关的说明
5.2 Plugin Behavior
5.2 插件行为
The plugin injects instructions into the model's context before each turn:
- Lists available Skills that can be used for the request
- States the reason for calling each Skill
- Prevents skipping Skills - requires reading relevant skills before writing code
Example: When working with CloudBase projects, the model will be instructed to read skill FIRST before writing any code.
cloudbase-guidelines插件会在每轮对话前向模型的上下文注入指令:
- 列出可用技能 可用于当前请求的技能
- 说明调用理由 调用每个技能的原因
- 防止跳过技能 - 要求在编写代码前阅读相关技能
示例: 处理CloudBase项目时,模型会被要求先读取技能,然后再编写任何代码。
cloudbase-guidelines5.3 Restart Gateway
5.3 重启网关
After installation, restart the gateway to load the plugin:
bash
undefined安装完成后,重启网关以加载插件:
bash
undefinedFor Moltbot
适用于Moltbot
moltbot gateway restart
moltbot gateway restart
For OpenClaw
适用于OpenClaw
openclaw gateway restart
openclaw gateway restart
Or for Clawdbot
适用于Clawdbot
clawdbot restart
**Verify plugin is loaded:**
After restarting, the plugin will automatically inject instructions into the model's context. You can verify this by asking the agent a question and checking if it lists available skills before responding.
---clawdbot restart
**验证插件是否加载:**
重启后,插件会自动向模型的上下文注入指令。您可以通过向Agent提问并检查它是否在响应前列出可用技能来验证。
---Step 6: Install CloudBase Skills
步骤6:安装CloudBase技能
Install the CloudBase skills package to make all CloudBase-related skills available:
bash
undefined安装CloudBase技能包,使所有CloudBase相关技能可用:
bash
undefinedOption 1: Install to workspace skills (single workspace)
选项1:安装到工作区技能(仅当前工作区可用)
cd <workspace>
npx skills add tencentcloudbase/skills -y
cd <workspace>
npx skills add tencentcloudbase/skills -y
Option 2: Install to shared skills (all agents on this machine)
选项2:安装到共享技能(本机所有Agent可用)
npx skills add tencentcloudbase/skills -y --workdir ~/.openclaw/skills
npx skills add tencentcloudbase/skills -y --workdir ~/.openclaw/skills
or
或
npx skills add tencentcloudbase/skills -y --workdir ~/.clawdbot/skills
**Verify installation:**
```bash
ls skills/ | grep cloudbaseYou should see skills like:
cloudbase-guidelinesweb-developmentminiprogram-developmentcloud-functionsauth-web-cloudbase- etc.
npx skills add tencentcloudbase/skills -y --workdir ~/.clawdbot/skills
**验证安装:**
```bash
ls skills/ | grep cloudbase您应该会看到如下技能:
cloudbase-guidelinesweb-developmentminiprogram-developmentcloud-functionsauth-web-cloudbase- 等
Step 7: Apply Changes
步骤7:应用更改
Use /new to start a new session so the agent picks up the updated configuration (AGENTS.md, MCP, skills).
使用**/new**启动新会话,使Agent获取更新后的配置(AGENTS.md、MCP、技能)。
Verification
验证
To verify everything is working correctly:
-
Check MCP is available:
Ask the agent: "List available MCP tools" Should see CloudBase-related tools -
Check skills are loaded:
Ask the agent: "What CloudBase skills do you have?" Should list cloudbase-guidelines, web-development, etc. -
Test a CloudBase query:
Ask the agent: "Check my CloudBase environment info" Should use MCP to query environment details -
Verify plugin is working (if installed):
Ask the agent: "Create a simple CloudBase web app" Should list available skills (e.g., cloudbase-guidelines, web-development) before writing code
要验证所有配置是否正常工作:
-
检查MCP是否可用:
向Agent提问:"列出可用的MCP工具" 应显示CloudBase相关工具 -
检查技能是否加载:
向Agent提问:"你有哪些CloudBase技能?" 应列出cloudbase-guidelines、web-development等 -
测试CloudBase查询:
向Agent提问:"检查我的CloudBase环境信息" 应使用MCP查询环境详情 -
验证插件是否工作(若已安装):
向Agent提问:"创建一个简单的CloudBase Web应用" 应在编写代码前列出可用技能(如cloudbase-guidelines、web-development)
Troubleshooting
故障排除
MCP not showing up
MCP未显示
- Verify mcporter.json syntax is valid JSON
- Check that credentials are correct (no extra spaces)
- Restart the gateway after config changes
- Run to verify MCP servers
npx mcporter list
- 验证mcporter.json语法是否为有效的JSON
- 检查凭证是否正确(无多余空格)
- 修改配置后重启网关
- 运行验证MCP服务器
npx mcporter list
Skills not loading
技能未加载
- Check that skills are in the correct directory
- Verify SYMLINKS are created correctly in
<workspace>/skills/ - Restart the gateway after installing skills
- Check file permissions on skill directories
- 检查技能是否在正确的目录中
- 验证中是否正确创建了SYMLINKS
<workspace>/skills/ - 安装技能后重启网关
- 检查技能目录的文件权限
Workspace not found
工作区未找到
- Verify the workspace path in your config file
- Ensure AGENTS.md exists in the workspace root
- Check that the agent has read/write permissions
- 验证配置文件中的工作区路径
- 确保AGENTS.md存在于工作区根目录
- 检查Agent是否有读写权限
Plugin not working
插件未工作
- Verify plugin files exist in (or equivalent for your installation)
~/.openclaw/extensions/skill-enhancer/ - Check that has the plugin enabled:
openclaw.json"skill-enhancer": { "enabled": true } - Restart the gateway after installation
- Check gateway logs for plugin loading errors
- Ensure you're using a version of OpenClaw that supports plugins
- 验证插件文件是否存在于(或对应您的安装目录)
~/.openclaw/extensions/skill-enhancer/ - 检查是否已启用插件:
openclaw.json"skill-enhancer": { "enabled": true } - 安装后重启网关
- 检查网关日志中的插件加载错误
- 确保您使用的OpenClaw版本支持插件
Reference: OpenClaw Skills Loading
参考:OpenClaw技能加载机制
OpenClaw loads skills from multiple locations, in priority order:
- Workspace skills () - Highest priority, single workspace
<workspace>/skills/ - Managed skills (or
~/.openclaw/skills/) - All agents~/.clawdbot/skills/ - Bundled skills - Installation default, lowest priority
Tip: Install CloudBase skills to managed skills () to make them available to all agents on the system.
~/.openclaw/skills/OpenClaw会从多个位置加载技能,优先级如下:
- 工作区技能() - 优先级最高,仅当前工作区可用
<workspace>/skills/ - 托管技能(或
~/.openclaw/skills/) - 所有Agent可用~/.clawdbot/skills/ - 内置技能 - 安装默认技能,优先级最低
提示: 将CloudBase技能安装到托管技能目录(),可使本机所有Agent都能使用。
~/.openclaw/skills/