setup-cloudbase-openclaw

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Setup 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

快速设置概览

StepActionPurpose
1Check installation dirsFind where OpenClaw/Moltbot is installed
2Locate workspaceIdentify the agent workspace directory
3Configure MCPSet up CloudBase MCP with credentials
4Update AGENTS.mdAdd CloudBase development rules
5Install skill-enhancer plugin (optional)Install plugin to enforce skill usage
6Install skillsInstall CloudBase-related skills
7Copy app template (optional)Copy CloudBase React template to workspace
8Apply changesUse /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
undefined

Check 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 detect
This 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
undefined

Read 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:
  1. Environment ID (EnvId) - Your CloudBase environment identifier
  2. SecretId - Tencent Cloud API Secret ID
  3. SecretKey - Tencent Cloud API Secret Key
How to get them:
  1. EnvId: Go to CloudBase Console
    • Select your environment
    • Copy the Environment ID from the top-left corner
  2. SecretId & SecretKey: Go to CAM API Key Management
    • Create a new API key or use existing
    • Copy both SecretId and SecretKey
您需要三个值:
  1. 环境ID(EnvId) - 您的CloudBase环境标识符
  2. SecretId - 腾讯云API密钥ID
  3. SecretKey - 腾讯云API密钥
获取方式:
  1. EnvId:访问CloudBase控制台
    • 选择您的环境
    • 从左上角复制环境ID
  2. 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.json
:
bash
undefined
在您的工作区目录中,创建或更新
config/mcporter.json
bash
undefined

First, 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 才能正常调用云开发:
如何获取:
  • TENCENTCLOUD_SECRETID / TENCENTCLOUD_SECRETKEY:登录 腾讯云控制台 → 访问管理 API 密钥 → 创建或查看密钥,得到 SecretId 与 SecretKey。
  • CLOUDBASE_ENV_ID:登录 云开发控制台 → 选择环境 → 在「概览」或「设置」中查看「环境 ID」(形如
    xxx-xxxxx
    )。
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 才能正常调用云开发:
如何获取:
  • TENCENTCLOUD_SECRETID / TENCENTCLOUD_SECRETKEY:登录 腾讯云控制台 → 访问管理 API 密钥 → 创建或查看密钥,得到 SecretId 与 SecretKey。
  • CLOUDBASE_ENV_ID:登录 云开发控制台 → 选择环境 → 在「概览」或「设置」中查看「环境 ID」(形如
    xxx-xxxxx
    )。

3.3 Verify MCP Configuration

3.3 验证MCP配置

Test that mcporter can load the configuration:
bash
cd <workspace>
npx mcporter list
You should see
cloudbase-mcp
in the list of available MCP servers.

测试mcporter是否能加载配置:
bash
cd <workspace>
npx mcporter list
您应该会在可用MCP服务器列表中看到
cloudbase-mcp

Step 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.md
Add the following CloudBase section:
markdown
undefined
在工作区的AGENTS.md中添加CloudBase开发规则。
若AGENTS.md不存在,请创建它:
bash
nano <workspace>/AGENTS.md
添加以下CloudBase章节:
markdown
undefined

CloudBase Development

CloudBase开发

When working with CloudBase projects, the agent MUST:
  1. Read skills first - Before writing any code, read the relevant CloudBase skills:
    • cloudbase-guidelines
      - Essential development guidelines
    • web-development
      - For web apps with static hosting
    • miniprogram-development
      - For WeChat mini programs
    • cloud-functions
      - For cloud function development
    • auth-web-cloudbase
      - For web authentication
    • cloudbase-document-database-web-sdk
      - For document database operations
  2. 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)
  3. Prefer SDK + security rules - If the requirement can be satisfied with the document database SDK and security rules alone, do NOT introduce cloud functions.
  4. The workspace includes a CloudBase + React template (
    app/
    directory) that you can copy as a starting point for new projects.
  5. Deploy to subdirectory (mandatory) - When deploying web apps to static hosting, you MUST use a subdirectory path (e.g.,
    /my-app/
    ), not the root, unless the user explicitly asks otherwise.
  6. Auto-deploy web apps - After completing a web application, automatically deploy it to CloudBase static hosting using MCP tools.

---
处理CloudBase项目时,Agent必须:
  1. 先读取技能 - 编写任何代码之前,先阅读相关的CloudBase技能:
    • cloudbase-guidelines
      - 核心开发指南
    • web-development
      - 适用于带静态托管的Web应用
    • miniprogram-development
      - 适用于微信小程序
    • cloud-functions
      - 适用于云函数开发
    • auth-web-cloudbase
      - 适用于Web身份验证
    • cloudbase-document-database-web-sdk
      - 适用于文档数据库操作
  2. 使用MCP而非CLI - 所有CloudBase操作必须通过CloudBase MCP工具执行:
    • 通过MCP查询环境
    • 通过MCP配置数据库
    • 通过MCP部署云函数
    • 请勿使用CloudBase CLI(它需要交互式登录)
  3. 优先使用SDK+安全规则 - 如果需求仅通过文档数据库SDK和安全规则即可满足,则无需引入云函数。
  4. 工作区包含一个CloudBase + React模板
    app/
    目录),您可以将其复制作为新项目的起点。
  5. 必须部署到子目录 - 将Web应用部署到静态托管时,必须使用子目录路径(例如
    /my-app/
    ),除非用户明确要求使用根目录。
  6. 自动部署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-plugin
What it does:
  • Detects your OpenClaw/Moltbot installation directory (
    ~/.openclaw/
    ,
    ~/.clawdbot/
    , or
    ~/.moltbot/
    )
  • Creates
    extensions/skill-enhancer/
    directory in the installation directory
  • Copies plugin files (
    openclaw.plugin.json
    and
    index.ts
    ) from the skill package
  • Creates or updates
    openclaw.json
    to enable the plugin
  • 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
cloudbase-guidelines
skill FIRST before writing any code.
插件会在每轮对话前向模型的上下文注入指令:
  • 列出可用技能 可用于当前请求的技能
  • 说明调用理由 调用每个技能的原因
  • 防止跳过技能 - 要求在编写代码前阅读相关技能
示例: 处理CloudBase项目时,模型会被要求先读取
cloudbase-guidelines
技能,然后再编写任何代码。

5.3 Restart Gateway

5.3 重启网关

After installation, restart the gateway to load the plugin:
bash
undefined
安装完成后,重启网关以加载插件:
bash
undefined

For 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
undefined

Option 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 cloudbase
You should see skills like:
  • cloudbase-guidelines
  • web-development
  • miniprogram-development
  • cloud-functions
  • auth-web-cloudbase
  • etc.

npx skills add tencentcloudbase/skills -y --workdir ~/.clawdbot/skills

**验证安装:**

```bash
ls skills/ | grep cloudbase
您应该会看到如下技能:
  • cloudbase-guidelines
  • web-development
  • miniprogram-development
  • cloud-functions
  • auth-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:
  1. Check MCP is available:
    Ask the agent: "List available MCP tools"
    Should see CloudBase-related tools
  2. Check skills are loaded:
    Ask the agent: "What CloudBase skills do you have?"
    Should list cloudbase-guidelines, web-development, etc.
  3. Test a CloudBase query:
    Ask the agent: "Check my CloudBase environment info"
    Should use MCP to query environment details
  4. 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

要验证所有配置是否正常工作:
  1. 检查MCP是否可用:
    向Agent提问:"列出可用的MCP工具"
    应显示CloudBase相关工具
  2. 检查技能是否加载:
    向Agent提问:"你有哪些CloudBase技能?"
    应列出cloudbase-guidelines、web-development等
  3. 测试CloudBase查询:
    向Agent提问:"检查我的CloudBase环境信息"
    应使用MCP查询环境详情
  4. 验证插件是否工作(若已安装):
    向Agent提问:"创建一个简单的CloudBase Web应用"
    应在编写代码前列出可用技能(如cloudbase-guidelines、web-development)

Troubleshooting

故障排除

MCP not showing up

MCP未显示

  1. Verify mcporter.json syntax is valid JSON
  2. Check that credentials are correct (no extra spaces)
  3. Restart the gateway after config changes
  4. Run
    npx mcporter list
    to verify MCP servers
  1. 验证mcporter.json语法是否为有效的JSON
  2. 检查凭证是否正确(无多余空格)
  3. 修改配置后重启网关
  4. 运行
    npx mcporter list
    验证MCP服务器

Skills not loading

技能未加载

  1. Check that skills are in the correct directory
  2. Verify SYMLINKS are created correctly in
    <workspace>/skills/
  3. Restart the gateway after installing skills
  4. Check file permissions on skill directories
  1. 检查技能是否在正确的目录中
  2. 验证
    <workspace>/skills/
    中是否正确创建了SYMLINKS
  3. 安装技能后重启网关
  4. 检查技能目录的文件权限

Workspace not found

工作区未找到

  1. Verify the workspace path in your config file
  2. Ensure AGENTS.md exists in the workspace root
  3. Check that the agent has read/write permissions
  1. 验证配置文件中的工作区路径
  2. 确保AGENTS.md存在于工作区根目录
  3. 检查Agent是否有读写权限

Plugin not working

插件未工作

  1. Verify plugin files exist in
    ~/.openclaw/extensions/skill-enhancer/
    (or equivalent for your installation)
  2. Check that
    openclaw.json
    has the plugin enabled:
    "skill-enhancer": { "enabled": true }
  3. Restart the gateway after installation
  4. Check gateway logs for plugin loading errors
  5. Ensure you're using a version of OpenClaw that supports plugins

  1. 验证插件文件是否存在于
    ~/.openclaw/extensions/skill-enhancer/
    (或对应您的安装目录)
  2. 检查
    openclaw.json
    是否已启用插件:
    "skill-enhancer": { "enabled": true }
  3. 安装后重启网关
  4. 检查网关日志中的插件加载错误
  5. 确保您使用的OpenClaw版本支持插件

Reference: OpenClaw Skills Loading

参考:OpenClaw技能加载机制

OpenClaw loads skills from multiple locations, in priority order:
  1. Workspace skills (
    <workspace>/skills/
    ) - Highest priority, single workspace
  2. Managed skills (
    ~/.openclaw/skills/
    or
    ~/.clawdbot/skills/
    ) - All agents
  3. Bundled skills - Installation default, lowest priority
Tip: Install CloudBase skills to managed skills (
~/.openclaw/skills/
) to make them available to all agents on the system.

OpenClaw会从多个位置加载技能,优先级如下:
  1. 工作区技能
    <workspace>/skills/
    ) - 优先级最高,仅当前工作区可用
  2. 托管技能
    ~/.openclaw/skills/
    ~/.clawdbot/skills/
    ) - 所有Agent可用
  3. 内置技能 - 安装默认技能,优先级最低
提示: 将CloudBase技能安装到托管技能目录(
~/.openclaw/skills/
),可使本机所有Agent都能使用。

Need Help?

需要帮助?