CloudBase Development Guidelines
💡 Recommended: MCP Installation
For enhanced CloudBase development experience, we recommend installing CloudBase MCP (Model Context Protocol).
CloudBase MCP provides essential tools for CloudBase development, including environment management, function deployment, database operations, and more. While not required, installing MCP will significantly improve your development workflow.
MCP Configuration Instructions
Most Coding Agents support project-level MCP configuration. The standard JSON configuration structure is:
{
"mcpServers": {
"cloudbase": {
"command": "npx",
"args": ["@cloudbase/cloudbase-mcp@latest"]
}
}
}
Project-level configuration file locations:
- Cursor:
.cursor/mcp.json
- Claude Code:
.mcp.json
- Windsurf:
~/.codeium/windsurf/mcp_config.json (user-level, no project-level JSON config)
- Cline: Check Cline settings for project-level MCP configuration file location
- GitHub Copilot Chat (VS Code): Check VS Code settings for MCP configuration file location
Format differences:
- Continue: Uses YAML format in
.continue/mcpServers/ folder:
name: CloudBase MCP
version: 1.0.0
schema: v1
mcpServers:
- uses: stdio
command: npx
args: ["@cloudbase/cloudbase-mcp@latest"]
Using mcporter (CLI) When MCP Is Not Available
In environments that do not support MCP (e.g. moltbot) or when users are unsure how to configure MCP, use mcporter as a CLI to call MCP tools. Confirm with the user that Secret ID, Secret Key, and Env ID are set in the mcporter config.
Config: Default ./config/mcporter.json (override with --config). Prefer --output json for machine-readable results.
{
"mcpServers": {
"cloudbase-mcp": {
"description": "CloudBase MCP",
"command": "npx",
"args": ["@cloudbase/cloudbase-mcp@latest"],
"env": {
"TENCENTCLOUD_SECRETID": "<your_secret_id>",
"TENCENTCLOUD_SECRETKEY": "<your_secret_key>",
"CLOUDBASE_ENV_ID": "<your_env_id>"
}
}
}
}
Quick start:
mcporter list — list servers/tools
mcporter list <server> --schema — show tool schema
mcporter call <server.tool> key=value — call a tool
Call examples:
- Selector:
mcporter call linear.list_issues team=ENG limit:5
- Function syntax:
mcporter call "linear.create_issue(title: \"Bug\")"
- JSON payload:
mcporter call <server.tool> --args '{"limit":5}'
Quick Reference
When Developing a Web Project:
- Platform: Read the
web-development skill for SDK integration, static hosting, and build configuration
- Authentication: Read the
auth-web and auth-tool skills - Use Web SDK built-in authentication
- Database:
- NoSQL:
no-sql-web-sdk skill
- MySQL:
relational-database-web and relational-database-tool skills
- UI Design (Recommended): Read the
ui-design skill for better UI/UX design guidelines
When Developing a Mini Program Project:
- Platform: Read the
miniprogram-development skill for project structure, WeChat Developer Tools, and wx.cloud usage
- Authentication: Read the
auth-wechat skill - Naturally login-free, get OPENID in cloud functions
- Database:
- NoSQL:
no-sql-wx-mp-sdk skill
- MySQL:
relational-database-tool skill (via tools)
- UI Design (Recommended): Read the
ui-design skill for better UI/UX design guidelines
When Developing a Native App Project (iOS/Android/Flutter/React Native/etc.):
- ⚠️ Platform Limitation: Native apps do NOT support CloudBase SDK - Must use HTTP API
- Required Skills:
http-api - HTTP API usage for all CloudBase operations
relational-database-tool - MySQL database operations (via tools)
auth-tool - Authentication configuration
- ⚠️ Database Limitation: Only MySQL database is supported. If users need MySQL, prompt them to enable it in console: CloudBase Console - MySQL Database
Core Capabilities
1. Authentication
Authentication Methods by Platform:
- Web Projects: Use CloudBase Web SDK built-in authentication, refer to the
auth-web skill
- Mini Program Projects: Naturally login-free, get
wxContext.OPENID in cloud functions, refer to the auth-wechat skill
- Node.js Backend: Refer to the
auth-nodejs skill
Configuration:
- When user mentions authentication requirements, read the
auth-tool skill to configure authentication providers
- Check and enable required authentication methods before implementing frontend code
2. Database Operations
Web Projects:
- NoSQL Database: Refer to the
no-sql-web-sdk skill
- MySQL Relational Database: Refer to the
relational-database-web skill (Web) and relational-database-tool skill (Management)
Mini Program Projects:
- NoSQL Database: Refer to the
no-sql-wx-mp-sdk skill
- MySQL Relational Database: Refer to the
relational-database-tool skill (via tools)
3. Deployment
Static Hosting (Web):
- Use CloudBase static hosting after build completion
- Refer to the
web-development skill for deployment process
- Remind users that CDN has a few minutes of cache after deployment
Backend Deployment:
- Cloud Functions: Refer to the
cloud-functions skill - Runtime cannot be changed after creation, must select correct runtime initially
- CloudRun: Refer to the
cloudrun-development skill - Ensure backend code supports CORS, prepare Dockerfile for container type
4. UI Design (Recommended)
For better UI/UX design, consider reading the ui-design skill which provides:
- Design thinking framework
- Frontend aesthetics guidelines
- Best practices for creating distinctive and high-quality interfaces
Platform-Specific Skills
Web Projects
web-development - SDK integration, static hosting, build configuration
auth-web - Web SDK built-in authentication
no-sql-web-sdk - NoSQL database operations
relational-database-web - MySQL database operations (Web)
relational-database-tool - MySQL database management
cloud-storage-web - Cloud storage operations
ai-model-web - AI model calling for Web apps
Mini Program Projects
miniprogram-development - Project structure, WeChat Developer Tools, wx.cloud
auth-wechat - Authentication (naturally login-free)
no-sql-wx-mp-sdk - NoSQL database operations
relational-database-tool - MySQL database operations
ai-model-wechat - AI model calling for Mini Program
Native App Projects
http-api - HTTP API usage (MANDATORY - SDK not supported)
relational-database-tool - MySQL database operations (MANDATORY)
auth-tool - Authentication configuration
Universal Skills
cloudbase-platform - Universal CloudBase platform knowledge
ui-design - UI design guidelines (recommended)
spec-workflow - Standard software engineering process
Professional Skill Reference
Platform Development Skills
- Web:
web-development - SDK integration, static hosting, build configuration
- Mini Program:
miniprogram-development - Project structure, WeChat Developer Tools, wx.cloud
- Cloud Functions:
cloud-functions - Cloud function development, deployment, logging, HTTP access
- CloudRun:
cloudrun-development - Backend deployment (functions/containers)
- Platform (Universal):
cloudbase-platform - Environment, authentication, services
Authentication Skills
- Web:
auth-web - Use Web SDK built-in authentication
- Mini Program:
auth-wechat - Naturally login-free, get OPENID in cloud functions
- Node.js:
auth-nodejs
- Auth Tool:
auth-tool - Configure and manage authentication providers
Database Skills
- NoSQL (Web):
no-sql-web-sdk
- NoSQL (Mini Program):
no-sql-wx-mp-sdk
- MySQL (Web):
relational-database-web
- MySQL (Tool):
relational-database-tool
Storage Skills
- Cloud Storage (Web):
cloud-storage-web - Upload, download, temporary URLs, file management
AI Skills
- AI Model (Web):
ai-model-web - Text generation and streaming via @cloudbase/js-sdk
- AI Model (Node.js):
ai-model-nodejs - Text generation, streaming, and image generation via @cloudbase/node-sdk ≥3.16.0
- AI Model (WeChat):
ai-model-wechat - Text generation and streaming with callbacks via wx.cloud.extend.AI
UI Design Skill
ui-design - Design thinking framework, frontend aesthetics guidelines (recommended for UI work)
Workflow Skills
- Spec Workflow:
spec-workflow - Standard software engineering process (requirements, design, tasks)
Core Behavior Rules
- Project Understanding: Read current project's README.md, follow project instructions
- Development Order: Prioritize frontend first, then backend
- Backend Strategy: Prefer using SDK to directly call CloudBase database, rather than through cloud functions, unless specifically needed
- Deployment Order: When there are backend dependencies, prioritize deploying backend before previewing frontend
- Authentication Rules: Use built-in authentication functions, distinguish authentication methods by platform
- Web Projects: Use CloudBase Web SDK built-in authentication (refer to
auth-web)
- Mini Program Projects: Naturally login-free, get OPENID in cloud functions (refer to
auth-wechat)
- Native Apps: Use HTTP API for authentication (refer to
http-api)
- Native App Development: CloudBase SDK is NOT available for native apps, MUST use HTTP API. Only MySQL database is supported.
Deployment Workflow
When users request deployment to CloudBase:
Check Existing Deployment:
- Read README.md to check for existing deployment information
- Identify previously deployed services and their URLs
- Determine if this is a new deployment or update to existing services
Backend Deployment (if applicable):
- Only for nodejs cloud functions: deploy directly using
createFunction tools
- Criteria: function directory contains
index.js with cloud function format export: exports.main = async (event, context) => {}
- For other languages backend server (Java, Go, PHP, Python, Node.js): deploy to Cloud Run
- Ensure backend code supports CORS by default
- Prepare Dockerfile for containerized deployment
- Use
manageCloudRun tool for deployment
- Set MinNum instances to at least 1 to reduce cold start latency
Frontend Deployment (if applicable):
- After backend deployment completes, update frontend API endpoints using the returned API addresses
- Build the frontend application
- Deploy to CloudBase static hosting using hosting tools
Display Deployment URLs:
- Show backend deployment URL (if applicable)
- Show frontend deployment URL with trailing slash (/) in path
- Add random query string to frontend URL to ensure CDN cache refresh
Update Documentation:
- Write deployment information and service details to README.md
- Include backend API endpoints and frontend access URLs
- Document CloudBase resources used (functions, cloud run, hosting, database, etc.)
- This helps with future updates and maintenance
CloudBase Console Entry Points
After creating/deploying resources, provide corresponding console management page links. All console URLs follow the pattern: https://tcb.cloud.tencent.com/dev?envId=${envId}#/{path}
Core Function Entry Points
- Overview (概览):
#/overview - Main dashboard
- Template Center (模板中心):
#/cloud-template/market - Project templates
- Document Database (文档型数据库):
#/db/doc - NoSQL collections: #/db/doc/collection/${collectionName}, Models: #/db/doc/model/${modelName}
- MySQL Database (MySQL 数据库):
#/db/mysql - Tables: #/db/mysql/table/default/
- Cloud Functions (云函数):
#/scf - Function detail: #/scf/detail?id=${functionName}&NameSpace=${envId}
- CloudRun (云托管):
#/platform-run - Container services
- Cloud Storage (云存储):
#/storage - File storage
- AI+:
#/ai - AI capabilities
- Static Website Hosting (静态网站托管):
#/static-hosting
- Identity Authentication (身份认证):
#/identity - Login: #/identity/login-manage, Tokens: #/identity/token-management
- Weida Low-Code (微搭低代码):
#/lowcode/apps
- Logs & Monitoring (日志监控):
#/devops/log
- Extensions (扩展功能):
#/apis
- Environment Settings (环境配置):
#/env
1---2name: cloudbase-guidelines3description: Essential CloudBase (TCB, Tencent CloudBase, 云开发, 微信云开发) development guidelines. MUST read when working with CloudBase projects, developing web apps, mini programs, or backend services using CloudBase platform.4---56# CloudBase Development Guidelines78## 💡 Recommended: MCP Installation910**For enhanced CloudBase development experience, we recommend installing CloudBase MCP (Model Context Protocol).**1112CloudBase MCP provides essential tools for CloudBase development, including environment management, function deployment, database operations, and more. While not required, installing MCP will significantly improve your development workflow.1314### MCP Configuration Instructions1516Most Coding Agents support project-level MCP configuration. The standard JSON configuration structure is:17```json18{19 "mcpServers": {20 "cloudbase": {21 "command": "npx",22 "args": ["@cloudbase/cloudbase-mcp@latest"]23 }24 }25}26```2728**Project-level configuration file locations:**2930- **Cursor**: `.cursor/mcp.json`31- **Claude Code**: `.mcp.json`32- **Windsurf**: `~/.codeium/windsurf/mcp_config.json` (user-level, no project-level JSON config)33- **Cline**: Check Cline settings for project-level MCP configuration file location34- **GitHub Copilot Chat (VS Code)**: Check VS Code settings for MCP configuration file location3536**Format differences:**3738- **Continue**: Uses YAML format in `.continue/mcpServers/` folder:39```yaml40name: CloudBase MCP41version: 1.0.042schema: v143mcpServers:44 - uses: stdio45 command: npx46 args: ["@cloudbase/cloudbase-mcp@latest"]47```4849### Using mcporter (CLI) When MCP Is Not Available5051In environments that do not support MCP (e.g. moltbot) or when users are unsure how to configure MCP, use **mcporter** as a CLI to call MCP tools. **Confirm with the user** that Secret ID, Secret Key, and Env ID are set in the mcporter config.5253**Config:** Default `./config/mcporter.json` (override with `--config`). Prefer `--output json` for machine-readable results.5455```json56{57 "mcpServers": {58 "cloudbase-mcp": {59 "description": "CloudBase MCP",60 "command": "npx",61 "args": ["@cloudbase/cloudbase-mcp@latest"],62 "env": {63 "TENCENTCLOUD_SECRETID": "<your_secret_id>",64 "TENCENTCLOUD_SECRETKEY": "<your_secret_key>",65 "CLOUDBASE_ENV_ID": "<your_env_id>"66 }67 }68 }69}70```7172**Quick start:**73- `mcporter list` — list servers/tools74- `mcporter list <server> --schema` — show tool schema75- `mcporter call <server.tool> key=value` — call a tool7677**Call examples:**78- Selector: `mcporter call linear.list_issues team=ENG limit:5`79- Function syntax: `mcporter call "linear.create_issue(title: \"Bug\")"`80- JSON payload: `mcporter call <server.tool> --args '{"limit":5}'`8182---8384## Quick Reference8586### When Developing a Web Project:871. **Platform**: Read the `web-development` skill for SDK integration, static hosting, and build configuration882. **Authentication**: Read the `auth-web` and `auth-tool` skills - Use Web SDK built-in authentication893. **Database**:90 - NoSQL: `no-sql-web-sdk` skill91 - MySQL: `relational-database-web` and `relational-database-tool` skills924. **UI Design** (Recommended): Read the `ui-design` skill for better UI/UX design guidelines9394### When Developing a Mini Program Project:951. **Platform**: Read the `miniprogram-development` skill for project structure, WeChat Developer Tools, and wx.cloud usage962. **Authentication**: Read the `auth-wechat` skill - Naturally login-free, get OPENID in cloud functions973. **Database**:98 - NoSQL: `no-sql-wx-mp-sdk` skill99 - MySQL: `relational-database-tool` skill (via tools)1004. **UI Design** (Recommended): Read the `ui-design` skill for better UI/UX design guidelines101102### When Developing a Native App Project (iOS/Android/Flutter/React Native/etc.):1031. **⚠️ Platform Limitation**: Native apps do NOT support CloudBase SDK - Must use HTTP API1042. **Required Skills**:105 - `http-api` - HTTP API usage for all CloudBase operations106 - `relational-database-tool` - MySQL database operations (via tools)107 - `auth-tool` - Authentication configuration1083. **⚠️ Database Limitation**: Only MySQL database is supported. If users need MySQL, prompt them to enable it in console: [CloudBase Console - MySQL Database](https://tcb.cloud.tencent.com/dev?envId=${envId}#/db/mysql/table/default/)109110---111112## Core Capabilities113114### 1. Authentication115116**Authentication Methods by Platform:**117- **Web Projects**: Use CloudBase Web SDK built-in authentication, refer to the `auth-web` skill118- **Mini Program Projects**: Naturally login-free, get `wxContext.OPENID` in cloud functions, refer to the `auth-wechat` skill119- **Node.js Backend**: Refer to the `auth-nodejs` skill120121**Configuration:**122- When user mentions authentication requirements, read the `auth-tool` skill to configure authentication providers123- Check and enable required authentication methods before implementing frontend code124125### 2. Database Operations126127**Web Projects:**128- NoSQL Database: Refer to the `no-sql-web-sdk` skill129- MySQL Relational Database: Refer to the `relational-database-web` skill (Web) and `relational-database-tool` skill (Management)130131**Mini Program Projects:**132- NoSQL Database: Refer to the `no-sql-wx-mp-sdk` skill133- MySQL Relational Database: Refer to the `relational-database-tool` skill (via tools)134135### 3. Deployment136137**Static Hosting (Web):**138- Use CloudBase static hosting after build completion139- Refer to the `web-development` skill for deployment process140- Remind users that CDN has a few minutes of cache after deployment141142**Backend Deployment:**143- **Cloud Functions**: Refer to the `cloud-functions` skill - Runtime cannot be changed after creation, must select correct runtime initially144- **CloudRun**: Refer to the `cloudrun-development` skill - Ensure backend code supports CORS, prepare Dockerfile for container type145146### 4. UI Design (Recommended)147148For better UI/UX design, consider reading the `ui-design` skill which provides:149- Design thinking framework150- Frontend aesthetics guidelines151- Best practices for creating distinctive and high-quality interfaces152153---154155## Platform-Specific Skills156157### Web Projects158- `web-development` - SDK integration, static hosting, build configuration159- `auth-web` - Web SDK built-in authentication160- `no-sql-web-sdk` - NoSQL database operations161- `relational-database-web` - MySQL database operations (Web)162- `relational-database-tool` - MySQL database management163- `cloud-storage-web` - Cloud storage operations164- `ai-model-web` - AI model calling for Web apps165166### Mini Program Projects167- `miniprogram-development` - Project structure, WeChat Developer Tools, wx.cloud168- `auth-wechat` - Authentication (naturally login-free)169- `no-sql-wx-mp-sdk` - NoSQL database operations170- `relational-database-tool` - MySQL database operations171- `ai-model-wechat` - AI model calling for Mini Program172173### Native App Projects174- `http-api` - HTTP API usage (MANDATORY - SDK not supported)175- `relational-database-tool` - MySQL database operations (MANDATORY)176- `auth-tool` - Authentication configuration177178### Universal Skills179- `cloudbase-platform` - Universal CloudBase platform knowledge180- `ui-design` - UI design guidelines (recommended)181- `spec-workflow` - Standard software engineering process182183---184185## Professional Skill Reference186187### Platform Development Skills188- **Web**: `web-development` - SDK integration, static hosting, build configuration189- **Mini Program**: `miniprogram-development` - Project structure, WeChat Developer Tools, wx.cloud190- **Cloud Functions**: `cloud-functions` - Cloud function development, deployment, logging, HTTP access191- **CloudRun**: `cloudrun-development` - Backend deployment (functions/containers)192- **Platform (Universal)**: `cloudbase-platform` - Environment, authentication, services193194### Authentication Skills195- **Web**: `auth-web` - Use Web SDK built-in authentication196- **Mini Program**: `auth-wechat` - Naturally login-free, get OPENID in cloud functions197- **Node.js**: `auth-nodejs`198- **Auth Tool**: `auth-tool` - Configure and manage authentication providers199200### Database Skills201- **NoSQL (Web)**: `no-sql-web-sdk`202- **NoSQL (Mini Program)**: `no-sql-wx-mp-sdk`203- **MySQL (Web)**: `relational-database-web`204- **MySQL (Tool)**: `relational-database-tool`205206### Storage Skills207- **Cloud Storage (Web)**: `cloud-storage-web` - Upload, download, temporary URLs, file management208209### AI Skills210- **AI Model (Web)**: `ai-model-web` - Text generation and streaming via @cloudbase/js-sdk211- **AI Model (Node.js)**: `ai-model-nodejs` - Text generation, streaming, and image generation via @cloudbase/node-sdk ≥3.16.0212- **AI Model (WeChat)**: `ai-model-wechat` - Text generation and streaming with callbacks via wx.cloud.extend.AI213214### UI Design Skill215- **`ui-design`** - Design thinking framework, frontend aesthetics guidelines (recommended for UI work)216217### Workflow Skills218- **Spec Workflow**: `spec-workflow` - Standard software engineering process (requirements, design, tasks)219220---221222## Core Behavior Rules2232241. **Project Understanding**: Read current project's README.md, follow project instructions2252. **Development Order**: Prioritize frontend first, then backend2263. **Backend Strategy**: Prefer using SDK to directly call CloudBase database, rather than through cloud functions, unless specifically needed2274. **Deployment Order**: When there are backend dependencies, prioritize deploying backend before previewing frontend2285. **Authentication Rules**: Use built-in authentication functions, distinguish authentication methods by platform229 - **Web Projects**: Use CloudBase Web SDK built-in authentication (refer to `auth-web`)230 - **Mini Program Projects**: Naturally login-free, get OPENID in cloud functions (refer to `auth-wechat`)231 - **Native Apps**: Use HTTP API for authentication (refer to `http-api`)2326. **Native App Development**: CloudBase SDK is NOT available for native apps, MUST use HTTP API. Only MySQL database is supported.233234## Deployment Workflow235236When users request deployment to CloudBase:2372380. **Check Existing Deployment**:239 - Read README.md to check for existing deployment information240 - Identify previously deployed services and their URLs241 - Determine if this is a new deployment or update to existing services2422431. **Backend Deployment (if applicable)**:244 - Only for nodejs cloud functions: deploy directly using `createFunction` tools245 - Criteria: function directory contains `index.js` with cloud function format export: `exports.main = async (event, context) => {}`246 - For other languages backend server (Java, Go, PHP, Python, Node.js): deploy to Cloud Run247 - Ensure backend code supports CORS by default248 - Prepare Dockerfile for containerized deployment249 - Use `manageCloudRun` tool for deployment250 - Set MinNum instances to at least 1 to reduce cold start latency2512522. **Frontend Deployment (if applicable)**:253 - After backend deployment completes, update frontend API endpoints using the returned API addresses254 - Build the frontend application255 - Deploy to CloudBase static hosting using hosting tools2562573. **Display Deployment URLs**:258 - Show backend deployment URL (if applicable)259 - Show frontend deployment URL with trailing slash (/) in path260 - Add random query string to frontend URL to ensure CDN cache refresh2612624. **Update Documentation**:263 - Write deployment information and service details to README.md264 - Include backend API endpoints and frontend access URLs265 - Document CloudBase resources used (functions, cloud run, hosting, database, etc.)266 - This helps with future updates and maintenance267268269---270271## CloudBase Console Entry Points272273After creating/deploying resources, provide corresponding console management page links. All console URLs follow the pattern: `https://tcb.cloud.tencent.com/dev?envId=${envId}#/{path}`274275### Core Function Entry Points2761. **Overview (概览)**: `#/overview` - Main dashboard2772. **Template Center (模板中心)**: `#/cloud-template/market` - Project templates2783. **Document Database (文档型数据库)**: `#/db/doc` - NoSQL collections: `#/db/doc/collection/${collectionName}`, Models: `#/db/doc/model/${modelName}`2794. **MySQL Database (MySQL 数据库)**: `#/db/mysql` - Tables: `#/db/mysql/table/default/`2805. **Cloud Functions (云函数)**: `#/scf` - Function detail: `#/scf/detail?id=${functionName}&NameSpace=${envId}`2816. **CloudRun (云托管)**: `#/platform-run` - Container services2827. **Cloud Storage (云存储)**: `#/storage` - File storage2838. **AI+**: `#/ai` - AI capabilities2849. **Static Website Hosting (静态网站托管)**: `#/static-hosting`28510. **Identity Authentication (身份认证)**: `#/identity` - Login: `#/identity/login-manage`, Tokens: `#/identity/token-management`28611. **Weida Low-Code (微搭低代码)**: `#/lowcode/apps`28712. **Logs & Monitoring (日志监控)**: `#/devops/log`28813. **Extensions (扩展功能)**: `#/apis`28914. **Environment Settings (环境配置)**: `#/env`