Cloudbase platform

From TencentCloudBase/CloudBase-MCP · View interactive version

Cloudbase platform is an AI agent skill from the GitHub repository TencentCloudBase/CloudBase-MCP. CloudBase platform overview and routing guide. This skill should be used when users need high-level capability selection, platform concepts, console navigation, realtime (broadcast / presence / live database changes), or cross-platform best practices before choosing a more specific implementation sk

How to use this skill

Skill file

Sibling skills (local only)

Sibling CloudBase skills ship beside this skill. Use local relative paths such as ../auth-tool-cloudbase/SKILL.md.

If a referenced sibling skill file is missing from this environment, ask the user to install the full CloudBase plugin (or the missing skill). Do not HTTP-fetch remote skill or protocol markdown into the agent context.

Cross-cutting protocols (required before code changes or deployments):

Post-deployment (optional, non-intrusive): after a deployment is verified successful, you may offer at most once to generate anonymized shareables (Deployment Share) — see references/protocols/deployment-share.md. Deliver the card, the copy and the case-wall entry in one reply; shareables only if that is all the user asked for. Never follow up if declined; never publish or submit on the user's behalf.

Activation Contract

Use this first when

Read before writing code if

Then also read

Do NOT use for

Common mistakes / gotchas

When to use this skill

Use this skill for CloudBase platform knowledge when you need to:

This skill provides foundational knowledge that applies to all CloudBase projects, regardless of whether they are Web, Mini Program, or backend services.


How to use this skill (for a coding agent)

  1. Understand platform differences
  1. Follow best practices
  1. Use correct SDKs and APIs
  1. Use the canonical CloudBase MCP setup from the main cloudbase guideline

CloudBase Platform Knowledge

Domain Management Tools: Clear Distinction

When working with domain-related tasks, use the correct tool based on the requirement:

| Requirement | Tool | Parameters | Purpose |

|-------------|------|------------|---------|

| Security Domain (安全域名) | manageEnv(action="addSecurityDomain" \| "removeSecurityDomain") | domains (array of host:port strings) | CORS/request source validation for browser uploads. No certificate involved. (Deprecated alias: envDomainManagement.) |

| Reuse existing Custom Domain | queryGateway(listCustomDomains) → manageGateway(createRoute) | domain = existing custom domain; route fields | Expose a service/path on an already-bound custom domain. No certificateId. Prefer this when a custom domain already exists. |

| Bind new Custom Domain (自定义域名) | manageGateway(action="bindCustomDomain") | domain (string), certificateId (string) | First-time bind of a new public HTTPS domain. Requires certId from SSL console. |

| Delete Custom Domain | manageGateway(action="deleteCustomDomain") | domain (string) | Remove custom domain binding (only after routes on that domain are deleted). |

| Disable / enable gateway route | manageGateway(action="disableRoute" \| "enableRoute") | path (required), prefer explicit domain | Toggle Routes[].Enable via ModifyHTTPServiceRoute (not ModifyGatewayRoute). |

| Disable static hosting default domain | queryGateway(listRoutes) → manageGateway(disableRoute) | domain = *.tcloudbaseapp.com (DomainType=STATIC_STORE, IsDefault=true), usually path="/" | Turns off public access on the shared hosting CDN default host. Do not use manageHosting. |

Key indicators for choosing the right tool:

Error Code Troubleshooting: Route Through Official Docs

When a CloudBase tool call fails and the error message contains a specific error code (pattern Category.Code, e.g. OperationDenied.FreePackageDenied, ResourceNotFound.*), always route through the official docs before acting — do not guess the meaning, do not hardcode fix recipes here:

  1. Extract the error code from the error message.
  2. Look it up: searchKnowledgeBase(mode="docs", action="searchDocs", query="<错误码>") — official docs search covers error-code pages. Act on the documented meaning and the fix steps the doc prescribes (plan limits → upgrade guidance, misconfiguration → config fix, etc.).
  3. If docs search returns nothing, fall back to the canonical error-code pages:
  1. Never assert capability-per-plan or error-code semantics from memory — official docs and the console plan comparison are the only authoritative sources. Example: for Web 安全域名 plan requirements, cite https://cloud.tencent.com/document/product/876/127357 rather than assuming which tier unlocks it.

Billing and service-stop codes are a special case: the code's own reading is misleading, so diagnose before acting. When a failure is InsufficientBalance (a cloud function answers it with HTTP 410), EXCEED_REQUEST_LIMIT, or a service that is simply down, InsufficientBalance reads as an account problem and is not one: what runs out is the environment's resource points, which are drawn down ahead of any account balance (plan quota → resource packs → pay-as-you-go) and are not restored by a top-up. The official status-code table for the serverless service says "top up and retry", so a reader who follows the text sends the user to the account and the failure stays.

Diagnose first, then advise — four causes need four different answers (free-trial points exhausted / paid plan points exhausted / plan expired / account genuinely in arrears), and only the last one involves topping up. Run manageEnv(action="usage") for the environment's credit usage for the current cycle and read the account balance alongside it (callCloudApi, billing), both read-only; the decision table, per-plan remedies and the console entries are in credits-exhaustion. Two facts to carry into any advice: a free trial cannot buy resource packs or enable pay-as-you-go (upgrading to a paid plan is the only path), and the plan names are exactly 免费体验版 / 个人版 / 标准版 / 企业版 / 企业高级版.

Recording Operation Results

When a task explicitly requires recording operation steps or results to a file (e.g., RESULT.json): perform the tool calls first, then write a complete record containing every attempt (action, success/failure, message) plus a summary with total / succeeded / failed counts. Do not write the file from memory before the calls finish.

Storage and Hosting

  1. Static Hosting vs Cloud Storage:
  1. Static Hosting Domain:
  1. Cloud Storage Public URL:

1. Call queryEnv(action=info) to get environment details

2. Extract the storage CDN domain from EnvInfo.Storages[0].CdnDomain (e.g., your-env-id.tcb.qcloud.la)

3. Construct the public URL: https://{CdnDomain}/{cloudPath}

  1. Shared-Bucket (ExternalStorage) Environments:

Environment and Authentication

  1. SDK Initialization:
  1. Environment Management (via manageEnv):

The manageEnv tool provides full lifecycle management for CloudBase environments.

| Action | Description | Key Parameters |

|--------|-------------|----------------|

| listPackages | Query available plans | (none) |

| create | Create new environment (needs confirm) | alias, packageId, resources, duration, region, externalStorage |

| modifyPlan | Change plan (upgrade/downgrade, needs confirm) | envId, packageId |

| renew | Renew environment (needs confirm) | envId, duration |

Creating an environment with specific resources:

```

manageEnv(action="create", alias="my-env", packageId="baas_personal",

resources=["storage","function","postgresql"], confirm="yes")

```

```

manageEnv(action="create", alias="tenant-a", packageId="baas_personal",

externalStorage={ bucketName: "shared-bucket-1250000000", region: "ap-shanghai", basePath: "tenant-a" },

confirm="yes")

```

Querying available packages before creating:

```

manageEnv(action="listPackages")

```

Changing plan (use a packageId from listPackages):

```

manageEnv(action="modifyPlan", envId="your-env-id", packageId="<packageId>", confirm="yes")

```

Renewing an environment:

```

manageEnv(action="renew", envId="your-env-id", duration=1, confirm="yes")

```

Authentication Best Practices

Important: Authentication methods for different platforms are completely different, must strictly distinguish!

Web Authentication

Mini Program Authentication

Cloud Functions

  1. Node.js Cloud Functions:

Database Permissions

⚠️ CRITICAL: Always configure permissions BEFORE writing database operation code!

  1. Permission Model:
  1. Platform Compatibility (CRITICAL):
  1. Configuration Workflow:

```

Create collection → Configure security rules → Write code → Test

```

Compatibility note:

  1. Common Scenarios:
  1. Cross-Collection Operations:

Role Management (MCP)

CloudBase MCP provides role management via queryPermissions and managePermissions (CLI equivalent: tcb role). See each tool's schema for the full action list.

⚠️ CRITICAL: Role policies and resource permissions are two independent systems with NO automatic synchronization.

Query (queryPermissions): listRoles, getRole (by roleId / roleIdentity / roleName).

Manage (managePermissions): createRole, updateRole, deleteRoles, addRoleMembers, removeRoleMembers, addRolePolicies, removeRolePolicies.

managePermissions(action="createRole", roleName="Developer", roleIdentity="developer",
                  policies=["FunctionsAccess"], memberUids=["user-uid-1"])

⚠️ Only custom roles can be deleted. System roles are read-only.

See also: CLI equivalent commands in cloudbase-cli/references/permission.md

  1. Cloud Function Optimization:

Data Models

  1. Get Data Model Operation Object:
  1. Data Model Query:
  1. MySQL Data Model Invocation Rules:

Console Management

After creating/deploying resources, provide corresponding console links. All console URLs follow the pattern: https://tcb.cloud.tencent.com/dev?envId=${envId}#/{path} — replace ${envId} with the real EnvId resolved via queryEnv (resolve aliases first; see Environment and Authentication below), and resource names with actual values.

The CloudBase console is updated frequently. If a live, logged-in console shows a different hash path from this list, prefer the live console path over stale documentation and then update this skill to match.

Entry points (one line each)

For configuration pages (like login management), guide users through the setup process rather than only dropping a link.

Reference index

All packaged reference files (required for skill lint reachability):

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.