@cloudbase/cloudbase-mcp 2.0.0 → 2.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -1549,6 +1549,7 @@ const auth_js_1 = __webpack_require__(77291);
1549
1549
  const cloudbase_manager_js_1 = __webpack_require__(3431);
1550
1550
  const logger_js_1 = __webpack_require__(13039);
1551
1551
  const interactive_js_1 = __webpack_require__(3461);
1552
+ const rag_js_1 = __webpack_require__(64215);
1552
1553
  function registerEnvTools(server) {
1553
1554
  // 获取 cloudBaseOptions,如果没有则为 undefined
1554
1555
  const cloudBaseOptions = server.cloudBaseOptions;
@@ -1556,7 +1557,7 @@ function registerEnvTools(server) {
1556
1557
  // login - 登录云开发环境
1557
1558
  server.registerTool?.("login", {
1558
1559
  title: "登录云开发",
1559
- description: "登录云开发环境并选择要使用的环境",
1560
+ description: "登录云开发环境,在生成包含云开发 CloudBase 相关功能前**必须**先调用此工具进行登录。登录云开发环境并选择要使用的环境。",
1560
1561
  inputSchema: {
1561
1562
  forceUpdate: zod_1.z.boolean().optional().describe("是否强制重新选择环境")
1562
1563
  },
@@ -1578,10 +1579,23 @@ function registerEnvTools(server) {
1578
1579
  return { content: [{ type: "text", text: "用户取消了登录" }] };
1579
1580
  }
1580
1581
  if (selectedEnvId) {
1582
+ // Get CLAUDE.md prompt content
1583
+ let promptContent = "";
1584
+ try {
1585
+ promptContent = await (0, rag_js_1.getClaudePrompt)();
1586
+ }
1587
+ catch (promptError) {
1588
+ (0, logger_js_1.debug)("Failed to get CLAUDE prompt", { error: promptError });
1589
+ // Continue with login success even if prompt fetch fails
1590
+ }
1591
+ const successMessage = `✅ 登录成功,当前环境: ${selectedEnvId}`;
1592
+ const promptMessage = promptContent
1593
+ ? `\n\n⚠️ 重要提示:后续所有云开发相关的开发工作必须严格遵循以下开发规范和最佳实践:\n\n${promptContent}`
1594
+ : "";
1581
1595
  return {
1582
1596
  content: [{
1583
1597
  type: "text",
1584
- text: `✅ 登录成功,当前环境: ${selectedEnvId}`
1598
+ text: successMessage + promptMessage
1585
1599
  }]
1586
1600
  };
1587
1601
  }
@@ -1703,10 +1717,24 @@ function registerEnvTools(server) {
1703
1717
  default:
1704
1718
  throw new Error(`不支持的查询类型: ${action}`);
1705
1719
  }
1720
+ let responseText = JSON.stringify(result, null, 2);
1721
+ // For info action, append CLAUDE.md prompt content
1722
+ if (action === "info") {
1723
+ try {
1724
+ const promptContent = await (0, rag_js_1.getClaudePrompt)();
1725
+ if (promptContent) {
1726
+ responseText += `\n\n⚠️ 重要提示:后续所有云开发相关的开发工作必须严格遵循以下开发规范和最佳实践:\n\n${promptContent}`;
1727
+ }
1728
+ }
1729
+ catch (promptError) {
1730
+ (0, logger_js_1.debug)("Failed to get CLAUDE prompt in envQuery", { error: promptError });
1731
+ // Continue without prompt if fetch fails
1732
+ }
1733
+ }
1706
1734
  return {
1707
1735
  content: [{
1708
1736
  type: "text",
1709
- text: JSON.stringify(result, null, 2)
1737
+ text: responseText
1710
1738
  }]
1711
1739
  };
1712
1740
  }
@@ -134678,7 +134706,7 @@ class TelemetryReporter {
134678
134706
  const nodeVersion = process.version; // Node.js版本
134679
134707
  const arch = os_1.default.arch(); // 系统架构
134680
134708
  // 从构建时注入的版本号获取MCP版本信息
134681
- const mcpVersion = process.env.npm_package_version || "2.0.0" || 0;
134709
+ const mcpVersion = process.env.npm_package_version || "2.0.2" || 0;
134682
134710
  return {
134683
134711
  userAgent: `${osType} ${osRelease} ${arch} ${nodeVersion} CloudBase-MCP/${mcpVersion}`,
134684
134712
  deviceId: this.deviceId,
@@ -185151,12 +185179,15 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
185151
185179
  return (mod && mod.__esModule) ? mod : { "default": mod };
185152
185180
  };
185153
185181
  Object.defineProperty(exports, "__esModule", ({ value: true }));
185182
+ exports.downloadWebTemplate = downloadWebTemplate;
185183
+ exports.getClaudePrompt = getClaudePrompt;
185154
185184
  exports.registerRagTools = registerRagTools;
185155
- const zod_1 = __webpack_require__(21614);
185185
+ const adm_zip_1 = __importDefault(__webpack_require__(30283));
185186
+ const fs = __importStar(__webpack_require__(79748));
185156
185187
  const os = __importStar(__webpack_require__(21820));
185157
185188
  const path = __importStar(__webpack_require__(39902));
185158
- const fs = __importStar(__webpack_require__(79748));
185159
- const adm_zip_1 = __importDefault(__webpack_require__(30283));
185189
+ const zod_1 = __webpack_require__(21614);
185190
+ const claude_prompt_js_1 = __webpack_require__(68359);
185160
185191
  const logger_js_1 = __webpack_require__(13039);
185161
185192
  // 1. 枚举定义
185162
185193
  const KnowledgeBaseEnum = zod_1.z.enum(["cloudbase", "scf", "miniprogram"]);
@@ -185192,26 +185223,71 @@ function safeStringify(obj) {
185192
185223
  return "";
185193
185224
  }
185194
185225
  }
185195
- async function prepareKnowledgeBaseWebTemplate() {
185226
+ // Download and extract web template, return extract directory path
185227
+ // Implements caching: only downloads if extractDir doesn't exist
185228
+ async function downloadWebTemplate() {
185196
185229
  const baseDir = path.join(os.homedir(), ".cloudbase-mcp");
185197
185230
  const zipPath = path.join(baseDir, "web-cloudbase-project.zip");
185198
185231
  const extractDir = path.join(baseDir, "web-template");
185199
185232
  const url = "https://static.cloudbase.net/cloudbase-examples/web-cloudbase-project.zip";
185200
185233
  await fs.mkdir(baseDir, { recursive: true });
185201
- // 下载 zip 到指定路径(覆盖写入)
185234
+ // Check if extractDir already exists (cache hit)
185235
+ try {
185236
+ const stats = await fs.stat(extractDir);
185237
+ if (stats.isDirectory()) {
185238
+ // Directory exists, return it directly (use cache)
185239
+ return extractDir;
185240
+ }
185241
+ }
185242
+ catch (error) {
185243
+ // Directory doesn't exist, proceed with download
185244
+ }
185245
+ // Download zip to specified path (overwrite)
185202
185246
  const response = await fetch(url);
185203
185247
  if (!response.ok) {
185204
185248
  throw new Error(`下载模板失败,状态码: ${response.status}`);
185205
185249
  }
185206
185250
  const buffer = Buffer.from(await response.arrayBuffer());
185207
185251
  await fs.writeFile(zipPath, buffer);
185208
- // 清理并重建解压目录
185252
+ // Clean and recreate extract directory
185209
185253
  await fs.rm(extractDir, { recursive: true, force: true });
185210
185254
  await fs.mkdir(extractDir, { recursive: true });
185211
185255
  const zip = new adm_zip_1.default(zipPath);
185212
185256
  zip.extractAllTo(extractDir, true);
185257
+ return extractDir;
185258
+ }
185259
+ async function prepareKnowledgeBaseWebTemplate() {
185260
+ const extractDir = await downloadWebTemplate();
185213
185261
  return collectSkillDescriptions(path.join(extractDir, ".claude", "skills"));
185214
185262
  }
185263
+ // Get CLAUDE.md prompt content
185264
+ // Priority: 1. From downloaded template, 2. Fallback to embedded constant
185265
+ async function getClaudePrompt() {
185266
+ try {
185267
+ // Try to get from downloaded template
185268
+ const extractDir = await downloadWebTemplate();
185269
+ const claudePath = path.join(extractDir, "CLAUDE.md");
185270
+ try {
185271
+ const content = await fs.readFile(claudePath, "utf8");
185272
+ return content;
185273
+ }
185274
+ catch (error) {
185275
+ // CLAUDE.md not found in template, use fallback
185276
+ (0, logger_js_1.warn)("[getClaudePrompt] CLAUDE.md not found in template, using fallback", {
185277
+ error,
185278
+ path: claudePath,
185279
+ });
185280
+ return claude_prompt_js_1.FALLBACK_CLAUDE_PROMPT;
185281
+ }
185282
+ }
185283
+ catch (error) {
185284
+ // Template download failed, use fallback
185285
+ (0, logger_js_1.warn)("[getClaudePrompt] Template download failed, using fallback", {
185286
+ error,
185287
+ });
185288
+ return claude_prompt_js_1.FALLBACK_CLAUDE_PROMPT;
185289
+ }
185290
+ }
185215
185291
  async function registerRagTools(server) {
185216
185292
  // 联网搜索
185217
185293
  server.registerTool?.("searchWeb", {
@@ -194909,6 +194985,306 @@ const fallback = {
194909
194985
  module.exports = isUnicodeSupported() ? main : fallback;
194910
194986
 
194911
194987
 
194988
+ /***/ }),
194989
+
194990
+ /***/ 68359:
194991
+ /***/ ((__unused_webpack_module, exports) => {
194992
+
194993
+ "use strict";
194994
+
194995
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
194996
+ exports.FALLBACK_CLAUDE_PROMPT = void 0;
194997
+ // Fallback CLAUDE.md prompt content
194998
+ // This is used when template download fails or CLAUDE.md is not found in the template
194999
+ exports.FALLBACK_CLAUDE_PROMPT = `---
195000
+ description: CloudBase AI Development Rules Guide - Provides scenario-based best practices to ensure development quality
195001
+ globs: *
195002
+ alwaysApply: true
195003
+ ---
195004
+
195005
+ # CloudBase AI Development Rules Guide
195006
+
195007
+ ## Quick Reference for AI
195008
+
195009
+ **⚠️ CRITICAL: Read this section first based on your project type**
195010
+
195011
+ ### When Developing a Web Project:
195012
+ 1. **Environment Check**: Call \`envQuery\` tool first (applies to all interactions)
195013
+ 2. **⚠️ Template Download (MANDATORY for New Projects)**: **MUST call \`downloadTemplate\` tool FIRST when starting a new project** - Do NOT create files manually. Use \`downloadTemplate\` with \`template="react"\` or \`template="vue"\` to get the complete project structure. Only proceed with manual file creation if template download fails or user explicitly requests it.
195014
+ 3. **⚠️ UI Design (CRITICAL)**: **MUST read \`rules/ui-design/rule.md\` FIRST before generating any page, interface, component, or style** - This is NOT optional. You MUST explicitly read this file and output the design specification before writing any UI code.
195015
+ 4. **Core Capabilities**: Read Core Capabilities section below (especially UI Design and Database + Authentication for Web)
195016
+ 5. **Platform Rules**: Read \`rules/web-development/rule.md\` for platform-specific rules (SDK integration, static hosting, build configuration)
195017
+ 6. **Authentication**: Read \`rules/auth-web/rule.md\` - **MUST use Web SDK built-in authentication**
195018
+ 7. **Database**:
195019
+ - NoSQL: \`rules/no-sql-web-sdk/rule.md\`
195020
+ - MySQL: \`rules/relational-database-web/rule.md\` + \`rules/relational-database-mcp/rule.md\`
195021
+
195022
+ ### When Developing a Mini Program Project:
195023
+ 1. **Environment Check**: Call \`envQuery\` tool first (applies to all interactions)
195024
+ 2. **⚠️ Template Download (MANDATORY for New Projects)**: **MUST call \`downloadTemplate\` tool FIRST when starting a new project** - Do NOT create files manually. Use \`downloadTemplate\` with \`template="miniprogram"\` to get the complete project structure. Only proceed with manual file creation if template download fails or user explicitly requests it.
195025
+ 3. **⚠️ UI Design (CRITICAL)**: **MUST read \`rules/ui-design/rule.md\` FIRST before generating any page, interface, component, or style** - This is NOT optional. You MUST explicitly read this file and output the design specification before writing any UI code.
195026
+ 4. **Core Capabilities**: Read Core Capabilities section below (especially UI Design and Database + Authentication for Mini Program)
195027
+ 5. **Platform Rules**: Read \`rules/miniprogram-development/rule.md\` for platform-specific rules (project structure, WeChat Developer Tools, wx.cloud usage)
195028
+ 6. **Authentication**: Read \`rules/auth-wechat/rule.md\` - **Naturally login-free, get OPENID in cloud functions**
195029
+ 7. **Database**:
195030
+ - NoSQL: \`rules/no-sql-wx-mp-sdk/rule.md\`
195031
+ - MySQL: \`rules/relational-database-mcp/rule.md\` (via MCP tools)
195032
+
195033
+ ---
195034
+
195035
+ ## Core Capabilities (Must Be Done Well)
195036
+
195037
+ As the most important part of application development, the following four core capabilities must be done well, without needing to read different rules for different platforms:
195038
+
195039
+ ### 1. ⚠️ UI Design (CRITICAL - Highest Priority)
195040
+ **⚠️ MANDATORY: Must strictly follow \`rules/ui-design/rule.md\` rules for ALL design work**
195041
+
195042
+ **🚨 CRITICAL ENFORCEMENT: You MUST explicitly read the file \`rules/ui-design/rule.md\` before generating ANY UI code. This is NOT a suggestion - it is a MANDATORY requirement.**
195043
+
195044
+ **Before generating ANY page, interface, component, or style:**
195045
+ 1. **MUST FIRST explicitly read \`rules/ui-design/rule.md\` file** - Use file reading tools to read this file, do NOT skip this step
195046
+ 2. **MUST complete design specification output** before writing any code:
195047
+ - Purpose Statement
195048
+ - Aesthetic Direction (choose from specific options, NOT generic terms)
195049
+ - Color Palette (with hex codes, avoid forbidden colors)
195050
+ - Typography (specific font names, avoid forbidden fonts)
195051
+ - Layout Strategy (asymmetric/creative approach, avoid centered templates)
195052
+ 3. **MUST ensure** generated interfaces have distinctive aesthetic styles and high-quality visual design
195053
+ 4. **MUST avoid** generic AI aesthetics (common fonts, clichéd color schemes, templated designs)
195054
+
195055
+ **This applies to ALL tasks involving:**
195056
+ - Page generation
195057
+ - Interface creation
195058
+ - Component design
195059
+ - Style/visual effects
195060
+ - Any frontend visual elements
195061
+
195062
+ **⚠️ VIOLATION DETECTION: If you find yourself writing UI code without first reading \`rules/ui-design/rule.md\`, STOP immediately and read the file first.**
195063
+
195064
+ ### 2. Database + Authentication
195065
+ **Strengthen database and authentication capabilities**
195066
+
195067
+ **Authentication**:
195068
+ - **Web Projects**:
195069
+ - Must use CloudBase Web SDK built-in authentication, refer to \`rules/auth-web/rule.md\`
195070
+ - Platform development rules: Refer to \`rules/web-development/rule.md\` for Web SDK integration, static hosting deployment, and build configuration
195071
+ - **Mini Program Projects**:
195072
+ - Naturally login-free, get \`wxContext.OPENID\` in cloud functions, refer to \`rules/auth-wechat/rule.md\`
195073
+ - Platform development rules: Refer to \`rules/miniprogram-development/rule.md\` for mini program project structure, WeChat Developer Tools integration, and CloudBase capabilities
195074
+ - **Node.js Backend**: Refer to \`rules/auth-nodejs/rule.md\`
195075
+
195076
+ **Database Operations**:
195077
+ - **Web Projects**:
195078
+ - NoSQL Database: Refer to \`rules/no-sql-web-sdk/rule.md\`
195079
+ - MySQL Relational Database: Refer to \`rules/relational-database-web/rule.md\` (Web application development) and \`rules/relational-database-mcp/rule.md\` (Management via MCP tools)
195080
+ - Platform development rules: Refer to \`rules/web-development/rule.md\` for Web SDK database integration patterns
195081
+ - **Mini Program Projects**:
195082
+ - NoSQL Database: Refer to \`rules/no-sql-wx-mp-sdk/rule.md\`
195083
+ - MySQL Relational Database: Refer to \`rules/relational-database-mcp/rule.md\` (via MCP tools)
195084
+ - Platform development rules: Refer to \`rules/miniprogram-development/rule.md\` for mini program database integration and wx.cloud usage
195085
+ - **Data Model Creation** (Universal): Refer to \`rules/data-model-creation/rule.md\`
195086
+
195087
+ ### 3. Static Hosting Deployment (Web)
195088
+ **Refer to deployment process in \`rules/web-development/rule.md\`**
195089
+ - Use CloudBase static hosting after build completion
195090
+ - Deploy using \`uploadFiles\` tool
195091
+ - Remind users that CDN has a few minutes of cache after deployment
195092
+ - Generate markdown format access links with random queryString
195093
+
195094
+ ### 4. Backend Deployment (Cloud Functions or CloudRun)
195095
+ **Refer to \`rules/cloudrun-development/rule.md\`**
195096
+ - **Cloud Function Deployment**: Use \`getFunctionList\` to query, then call \`createFunction\` or \`updateFunctionCode\` to deploy
195097
+ - **CloudRun Deployment**: Use \`manageCloudRun\` tool for containerized deployment
195098
+ - Ensure backend code supports CORS, prepare Dockerfile (for container type)
195099
+
195100
+ ## Development Process Standards
195101
+
195102
+ **Important: To ensure development quality, AI must complete the following steps before starting work:**
195103
+
195104
+ ### 0. Environment Check (First Step)
195105
+ After user inputs any content, first check CloudBase environment status:
195106
+ - Ensure current CloudBase environment ID is known
195107
+ - If not present in conversation history, must call \`envQuery\` tool with parameter \`action=info\` to query current environment information and environment ID
195108
+ - **Important**: When environment ID configuration is involved in code later, automatically use the queried environment ID, no need for manual user input
195109
+
195110
+ ### 1. Scenario Identification
195111
+ Identify current development scenario type, mainly for understanding project type, but core capabilities apply to all projects:
195112
+ - **Web Projects**: React/Vue/native JS frontend projects
195113
+ - **WeChat Mini Programs**: Mini program CloudBase projects
195114
+ - **CloudRun Projects**: CloudBase Run backend service projects (supports any language: Java/Go/Python/Node.js/PHP/.NET, etc.)
195115
+ - **Database Related**: Projects involving data operations
195116
+ - **UI Design/Interface Generation**: Projects requiring interface design, page generation, prototype creation, component design, etc.
195117
+
195118
+ ### 2. Platform-Specific Quick Guide
195119
+
195120
+ **Web Projects - Required Rule Files:**
195121
+ - \`rules/web-development/rule.md\` - Platform development rules (SDK integration, static hosting, build configuration)
195122
+ - \`rules/auth-web/rule.md\` - Authentication (MUST use Web SDK built-in authentication)
195123
+ - \`rules/no-sql-web-sdk/rule.md\` - NoSQL database operations
195124
+ - \`rules/relational-database-web/rule.md\` - MySQL database operations (Web)
195125
+ - \`rules/relational-database-mcp/rule.md\` - MySQL database management (MCP tools)
195126
+ - \`rules/cloudbase-platform/rule.md\` - Universal CloudBase platform knowledge
195127
+
195128
+ **Mini Program Projects - Required Rule Files:**
195129
+ - \`rules/miniprogram-development/rule.md\` - Platform development rules (project structure, WeChat Developer Tools, wx.cloud)
195130
+ - \`rules/auth-wechat/rule.md\` - Authentication (naturally login-free, get OPENID in cloud functions)
195131
+ - \`rules/no-sql-wx-mp-sdk/rule.md\` - NoSQL database operations
195132
+ - \`rules/relational-database-mcp/rule.md\` - MySQL database operations (via MCP tools)
195133
+ - \`rules/cloudbase-platform/rule.md\` - Universal CloudBase platform knowledge
195134
+
195135
+ **Universal Rule Files (All Projects):**
195136
+ - **⚠️ \`rules/ui-design/rule.md\`** - **MANDATORY - HIGHEST PRIORITY** - Must read FIRST before any UI/page/component/style generation
195137
+ - \`rules/data-model-creation/rule.md\` - Data model creation and MySQL modeling
195138
+ - \`rules/spec-workflow/rule.md\` - Standard software engineering process (if needed)
195139
+
195140
+ ### 3. Development Confirmation
195141
+ Before starting work, suggest confirming with user:
195142
+ 1. "I identify this as a [scenario type] project"
195143
+ 2. "I will strictly follow core capability requirements and refer to relevant rule files"
195144
+ 3. "Please confirm if my understanding is correct"
195145
+
195146
+ ## Core Behavior Rules
195147
+ 1. **Tool Priority**: For Tencent CloudBase operations, must prioritize using CloudBase MCP tools
195148
+ 2. **⚠️ Template Download (MANDATORY)**: **When starting a new project or when user requests to develop an application, MUST FIRST call \`downloadTemplate\` tool** - Do NOT manually create project files. Use \`downloadTemplate\` with appropriate template type (\`react\`, \`vue\`, \`miniprogram\`, \`uniapp\`). Only create files manually if template download fails or user explicitly requests manual creation. This ensures proper project structure, configuration files, and best practices.
195149
+ 3. **Project Understanding**: First read current project's README.md, follow project instructions for development
195150
+ 4. **Directory Standards**: Before outputting project code in current directory, first check current directory files
195151
+ 5. **Development Order**: When developing, prioritize frontend first, then backend, ensuring frontend interface and interaction logic are completed first, then implement backend business logic
195152
+ 6. **⚠️ UI Design Rules Mandatory Application**: When tasks involve generating pages, interfaces, components, styles, or any frontend visual elements, **MUST FIRST explicitly read the file \`rules/ui-design/rule.md\` using file reading tools**, then strictly follow the rule file, ensuring generated interfaces have distinctive aesthetic styles and high-quality visual design, avoiding generic AI aesthetics. **You MUST output the design specification before writing any UI code.**
195153
+ 7. **Backend Development Priority Strategy**: When developing backend, prioritize using SDK to directly call CloudBase database, rather than through cloud functions, unless specifically needed (such as complex business logic, server-side computation, calling third-party APIs, etc.)
195154
+ 8. **Deployment Order**: When there are backend dependencies, prioritize deploying backend before previewing frontend
195155
+ 9. **Interactive Confirmation**: Use interactiveDialog to clarify when requirements are unclear, must confirm before executing high-risk operations
195156
+ 10. **Real-time Communication**: Use CloudBase real-time database watch capability
195157
+ 11. **⚠️ Authentication Rules**: When users develop projects, if user login authentication is needed, must use built-in authentication functions, must strictly distinguish authentication methods by platform
195158
+ - **Web Projects**: **MUST use CloudBase Web SDK built-in authentication** (e.g., \`auth.toDefaultLoginPage()\`), refer to \`rules/auth-web/rule.md\`
195159
+ - **Mini Program Projects**: **Naturally login-free**, get \`wxContext.OPENID\` in cloud functions, refer to \`rules/auth-wechat/rule.md\`
195160
+
195161
+ ## Development Workflow
195162
+
195163
+ ### Development
195164
+
195165
+ 1. **⚠️ Download CloudBase Templates (MANDATORY for New Projects)**:
195166
+ - **MUST call \`downloadTemplate\` tool FIRST when starting a new project** - Do NOT manually create project files
195167
+ - For Web projects: Use \`downloadTemplate\` with \`template="react"\` or \`template="vue"\`
195168
+ - For Mini Program projects: Use \`downloadTemplate\` with \`template="miniprogram"\`
195169
+ - For UniApp projects: Use \`downloadTemplate\` with \`template="uniapp"\`
195170
+ - **Only proceed with manual file creation if template download fails or user explicitly requests manual creation**
195171
+ - If unable to download to current directory, can use scripts to copy, note that hidden files also need to be copied
195172
+
195173
+ 2. **⚠️ UI Design Document Reading (MANDATORY)**:
195174
+ - **Before generating ANY page, interface, component, or style, MUST FIRST explicitly read the file \`rules/ui-design/rule.md\` using file reading tools**
195175
+ - **MUST output the design specification** (Purpose Statement, Aesthetic Direction, Color Palette, Typography, Layout Strategy) before writing any UI code
195176
+ - This is NOT optional - you MUST read the file and follow the design thinking framework and frontend aesthetics guidelines
195177
+ - Avoid generating generic AI aesthetic style interfaces
195178
+
195179
+ 3. **Mini Program TabBar Material Download - Download Remote Material Links**: Mini program Tabbar and other material images must use **png** format, must use downloadRemoteFile tool to download files locally. Can select from Unsplash, wikimedia (generally choose 500 size), Pexels, Apple official UI and other resources
195180
+
195181
+ If remote links are needed in the application, can continue to call uploadFile to upload and obtain temporary access links and cloud storage cloudId
195182
+
195183
+ 3. **Query Professional Knowledge from Knowledge Base**: If uncertain about any CloudBase knowledge, can use searchKnowledgeBase tool to intelligently search CloudBase knowledge base (supports CloudBase and cloud functions, mini program frontend knowledge, etc.), quickly obtain professional documents and answers through vector search
195184
+
195185
+ 4. **WeChat Developer Tools Open Project Workflow**:
195186
+ - When detecting current project is a mini program project, suggest user to use WeChat Developer Tools for preview, debugging, and publishing
195187
+ - Before opening, confirm project.config.json has appid field configured. If not configured, must ask user to provide it
195188
+ - Use WeChat Developer built-in CLI command to open project (pointing to directory containing project.config.json):
195189
+ - Windows: \`"C:\\Program Files (x86)\\Tencent\\微信web开发者工具\\cli.bat" open --project "项目根目录路径"\`
195190
+ - macOS: \`/Applications/wechatwebdevtools.app/Contents/MacOS/cli open --project "/path/to/project/root"\`
195191
+ - Project root directory path is the directory containing project.config.json file
195192
+
195193
+ ### Deployment Process
195194
+
195195
+ 1. **Cloud Function Deployment Process**: Can use getFunctionList MCP tool to query if there are cloud functions, then directly call createFunction or updateFunctionCode to update cloud function code. Only need to point functionRootPath to parent directory of cloud function directory (e.g., absolute path of cloudfunctions directory). No need for code compression and other operations. The above tools will automatically read files from cloud function subdirectories with same name under parent directory and automatically deploy
195196
+
195197
+ 2. **CloudRun Deployment Process**: For non-cloud function backend services (Java, Go, PHP, Python, Node.js, etc.), use manageCloudRun tool for deployment. Ensure backend code supports CORS, prepare Dockerfile, then call manageCloudRun for containerized deployment. For details, refer to \`rules/cloudrun-development/rule.md\`
195198
+
195199
+ 3. **Static Hosting Deployment Process**: Deploy using uploadFiles tool. After deployment, remind users that CDN has a few minutes of cache. Can generate markdown format access links with random queryString. For details, refer to \`rules/web-development/rule.md\`
195200
+
195201
+ ### Documentation Generation Rules
195202
+
195203
+ 1. You will generate a README.md file after generating the project, containing basic project information, such as project name, project description. Most importantly, clearly explain the project architecture and involved CloudBase resources, so maintainers can refer to it for modification and maintenance
195204
+ 2. After deployment, if it's a web project, can write the official deployment access address in the documentation
195205
+
195206
+ ### Configuration File Rules
195207
+
195208
+ 1. To help others who don't use AI understand what resources are available, can generate a cloudbaserc.json file after generation
195209
+
195210
+ ### MCP Interface Call Rules
195211
+ When calling MCP services, you need to fully understand the data types of all interfaces to be called, as well as return value types. If you're not sure which interface to call, first check the documentation and tool descriptions, then determine which interface and parameters to call based on the documentation and tool descriptions. Do not have incorrect method parameters or parameter type errors.
195212
+
195213
+ For example, many interfaces require a confirm parameter, which is a boolean type. If you don't provide this parameter, or provide incorrect data type, the interface will return an error.
195214
+
195215
+ ### Environment ID Auto-Configuration Rules
195216
+ - When generating project configuration files (such as \`cloudbaserc.json\`, \`project.config.json\`, etc.), automatically use the environment ID queried by \`envQuery\`
195217
+ - In code examples involving environment ID, automatically fill in current environment ID, no need for manual user replacement
195218
+ - In deployment and preview related operations, prioritize using already queried environment information
195219
+
195220
+ ## Professional Rule File Reference
195221
+
195222
+ **Note**: For detailed information, refer to the specific skill files. This section provides quick reference only.
195223
+
195224
+ ### Platform Development Skills
195225
+ - **Web**: \`rules/web-development/rule.md\` - SDK integration, static hosting, build configuration
195226
+ - **Mini Program**: \`rules/miniprogram-development/rule.md\` - Project structure, WeChat Developer Tools, wx.cloud
195227
+ - **CloudRun**: \`rules/cloudrun-development/rule.md\` - Backend deployment (functions/containers)
195228
+ - **Platform (Universal)**: \`rules/cloudbase-platform/rule.md\` - Environment, authentication, services
195229
+
195230
+ ### Authentication Skills
195231
+ - **Web**: \`rules/auth-web/rule.md\` - **MUST use Web SDK built-in authentication**
195232
+ - **Mini Program**: \`rules/auth-wechat/rule.md\` - **Naturally login-free, get OPENID in cloud functions**
195233
+ - **Node.js**: \`rules/auth-nodejs/rule.md\`
195234
+ - **HTTP API**: \`rules/auth-http-api/rule.md\`
195235
+
195236
+ ### Database Skills
195237
+ - **NoSQL (Web)**: \`rules/no-sql-web-sdk/rule.md\`
195238
+ - **NoSQL (Mini Program)**: \`rules/no-sql-wx-mp-sdk/rule.md\`
195239
+ - **MySQL (Web)**: \`rules/relational-database-web/rule.md\`
195240
+ - **MySQL (MCP)**: \`rules/relational-database-mcp/rule.md\`
195241
+ - **Data Model Creation**: \`rules/data-model-creation/rule.md\`
195242
+
195243
+ ### 🎨 ⚠️ UI Design Skill (CRITICAL - Read FIRST)
195244
+ - **\`rules/ui-design/rule.md\`** - **MANDATORY - HIGHEST PRIORITY**
195245
+ - **MUST read FIRST before generating ANY interface/page/component/style**
195246
+ - Design thinking framework, complete design process, frontend aesthetics guidelines
195247
+ - **NO EXCEPTIONS**: All UI work requires reading this file first
195248
+
195249
+ ### Workflow Skills
195250
+ - **Spec Workflow**: \`rules/spec-workflow/rule.md\` - Standard software engineering process (requirements, design, tasks)
195251
+
195252
+ ## Development Quality Checklist
195253
+
195254
+ To ensure development quality, recommend completing the following checks before starting tasks:
195255
+
195256
+ ### Recommended Steps
195257
+ 0. **[ ] Environment Check**: Call \`envQuery\` tool to check CloudBase environment status (applies to all interactions)
195258
+ 1. **[ ] Template Download Check (MANDATORY for New Projects)**: If starting a new project, have you called \`downloadTemplate\` tool FIRST? Do NOT manually create project files - use templates.
195259
+ 2. **[ ] Scenario Identification**: Clearly identify what type of project this is (Web/Mini Program/Database/UI)
195260
+ 3. **[ ] Core Capability Confirmation**: Confirm all four core capabilities have been considered
195261
+ - UI Design: Have you explicitly read the file \`rules/ui-design/rule.md\` using file reading tools?
195262
+ - Database + Authentication: Have you referred to corresponding authentication and database skills?
195263
+ - Static Hosting Deployment: Have you understood the deployment process?
195264
+ - Backend Deployment: Have you understood cloud function or CloudRun deployment process?
195265
+ 4. **[ ] UI Design Rules Check (MANDATORY)**: If task involves generating pages, interfaces, components, or styles:
195266
+ - Have you explicitly read the file \`rules/ui-design/rule.md\` using file reading tools? (Required: YES)
195267
+ - Have you output the design specification before writing code? (Required: YES)
195268
+ - Have you understood and will follow the design thinking framework? (Required: YES)
195269
+ 5. **[ ] User Confirmation**: Confirm with user whether scenario identification and core capability understanding are correct
195270
+ 6. **[ ] Rule Execution**: Strictly follow core capability requirements and relevant rule files for development
195271
+
195272
+ ### ⚠️ Common Issues to Avoid
195273
+ - **❌ DO NOT manually create project files** - Always use \`downloadTemplate\` tool first for new projects
195274
+ - **❌ DO NOT skip reading UI design document** - Must explicitly read \`rules/ui-design/rule.md\` file before generating any UI code
195275
+ - Avoid skipping core capabilities and starting development directly
195276
+ - Avoid mixing APIs and authentication methods from different platforms
195277
+ - Avoid ignoring UI design rules: All tasks involving interfaces, pages, components, styles must explicitly read and strictly follow \`rules/ui-design/rule.md\`
195278
+ - Avoid ignoring database and authentication standards: Must use correct authentication methods and database operation methods
195279
+ - Important technical solutions should be confirmed with users
195280
+
195281
+ ### Quality Assurance
195282
+ If development is found to not comply with standards, can:
195283
+ - Point out specific issues
195284
+ - Require re-execution of rule check process
195285
+ - Clearly specify rule files that need to be followed`;
195286
+
195287
+
194912
195288
  /***/ }),
194913
195289
 
194914
195290
  /***/ 68385:
@@ -199986,7 +200362,7 @@ ${envIdSection}
199986
200362
  ## 环境信息
199987
200363
  - 操作系统: ${os_1.default.type()} ${os_1.default.release()}
199988
200364
  - Node.js版本: ${process.version}
199989
- - MCP 版本:${process.env.npm_package_version || "2.0.0" || 0}
200365
+ - MCP 版本:${process.env.npm_package_version || "2.0.2" || 0}
199990
200366
  - 系统架构: ${os_1.default.arch()}
199991
200367
  - 时间: ${new Date().toISOString()}
199992
200368
  - 请求ID: ${requestId}
@@ -214561,7 +214937,9 @@ function registerSetupTools(server) {
214561
214937
  // downloadTemplate - 下载项目模板 (cloud-incompatible)
214562
214938
  server.registerTool("downloadTemplate", {
214563
214939
  title: "下载项目模板",
214564
- description: `自动下载并部署CloudBase项目模板。\n\n支持的模板:\n- react: React + CloudBase 全栈应用模板\n- vue: Vue + CloudBase 全栈应用模板\n- miniprogram: 微信小程序 + 云开发模板 \n- uniapp: UniApp + CloudBase 跨端应用模板\n- rules: 只包含AI编辑器配置文件(包含Cursor、WindSurf、CodeBuddy等所有主流编辑器配置),适合在已有项目中补充AI编辑器配置\n\n支持的IDE类型:\n- all: 下载所有IDE配置(默认)\n- cursor: Cursor AI编辑器\n- windsurf: WindSurf AI编辑器\n- codebuddy: CodeBuddy AI编辑器\n- claude-code: Claude Code AI编辑器\n- cline: Cline AI编辑器\n- gemini-cli: Gemini CLI\n- opencode: OpenCode AI编辑器\n- qwen-code: 通义灵码\n- baidu-comate: 百度Comate\n- openai-codex-cli: OpenAI Codex CLI\n- augment-code: Augment Code\n- github-copilot: GitHub Copilot\n- roocode: RooCode AI编辑器\n- tongyi-lingma: 通义灵码\n- trae: Trae AI编辑器\n- vscode: Visual Studio Code\n\n特别说明:\n- rules 模板会自动包含当前 mcp 版本号信息(版本号:${ true ? "2.0.0" : 0}),便于后续维护和版本追踪\n- 下载 rules 模板时,如果项目中已存在 README.md 文件,系统会自动保护该文件不被覆盖(除非设置 overwrite=true)`,
214940
+ description: `自动下载并部署CloudBase项目模板。⚠️ **MANDATORY FOR NEW PROJECTS** ⚠️
214941
+
214942
+ **CRITICAL**: This tool MUST be called FIRST when starting a new project.\n\n支持的模板:\n- react: React + CloudBase 全栈应用模板\n- vue: Vue + CloudBase 全栈应用模板\n- miniprogram: 微信小程序 + 云开发模板 \n- uniapp: UniApp + CloudBase 跨端应用模板\n- rules: 只包含AI编辑器配置文件(包含Cursor、WindSurf、CodeBuddy等所有主流编辑器配置),适合在已有项目中补充AI编辑器配置\n\n支持的IDE类型:\n- all: 下载所有IDE配置(默认)\n- cursor: Cursor AI编辑器\n- windsurf: WindSurf AI编辑器\n- codebuddy: CodeBuddy AI编辑器\n- claude-code: Claude Code AI编辑器\n- cline: Cline AI编辑器\n- gemini-cli: Gemini CLI\n- opencode: OpenCode AI编辑器\n- qwen-code: 通义灵码\n- baidu-comate: 百度Comate\n- openai-codex-cli: OpenAI Codex CLI\n- augment-code: Augment Code\n- github-copilot: GitHub Copilot\n- roocode: RooCode AI编辑器\n- tongyi-lingma: 通义灵码\n- trae: Trae AI编辑器\n- vscode: Visual Studio Code\n\n特别说明:\n- rules 模板会自动包含当前 mcp 版本号信息(版本号:${ true ? "2.0.2" : 0}),便于后续维护和版本追踪\n- 下载 rules 模板时,如果项目中已存在 README.md 文件,系统会自动保护该文件不被覆盖(除非设置 overwrite=true)`,
214565
214943
  inputSchema: {
214566
214944
  template: zod_1.z.enum(["react", "vue", "miniprogram", "uniapp", "rules"]).describe("要下载的模板类型"),
214567
214945
  ide: zod_1.z.enum(IDE_TYPES).optional().default("all").describe("指定要下载的IDE类型,默认为all(下载所有IDE配置)"),