@cloudbase/cloudbase-mcp 2.0.4 → 2.0.6

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/README.md CHANGED
@@ -29,7 +29,7 @@
29
29
 
30
30
  <sup>从 AI 提示词到应用上线的最短路径</sup>
31
31
 
32
- [![][github-trending-shield]][github-trending-url]
32
+ [![][github-trending-shield]](https://github.com/TencentCloudBase/CloudBase-AI-ToolKit)
33
33
 
34
34
  [<img width="791" height="592" alt="Clipboard_Screenshot_1763724670" src="https://github.com/user-attachments/assets/f769beb7-5710-4397-8854-af2b7e452f70" />](https://docs.cloudbase.net/ai/cloudbase-ai-toolkit/tutorials)
35
35
 
@@ -85,10 +85,6 @@ AI 编程工具(如 Cursor、Copilot)解决了**代码生成**的难题。
85
85
  > 一键安装,自动配置,支持多种 AI 编程工具:
86
86
  >
87
87
  > ```bash
88
- > # Mac/Linux/WSL
89
- > curl https://static.cloudbase.net/cli/install/install.sh -fsS | bash
90
- >
91
- > # Windows PowerShell
92
88
  > npm install @cloudbase/cli@latest -g
93
89
  > ```
94
90
  >
package/dist/cli.cjs CHANGED
@@ -33476,9 +33476,12 @@ function wrap (fn) {
33476
33476
  "use strict";
33477
33477
 
33478
33478
  Object.defineProperty(exports, "__esModule", ({ value: true }));
33479
+ exports.WRITE_SECURITY_RULE = exports.READ_SECURITY_RULE = void 0;
33479
33480
  exports.registerSecurityRuleTools = registerSecurityRuleTools;
33480
33481
  const zod_1 = __webpack_require__(21614);
33481
33482
  const cloudbase_manager_js_1 = __webpack_require__(3431);
33483
+ exports.READ_SECURITY_RULE = "readSecurityRule";
33484
+ exports.WRITE_SECURITY_RULE = "writeSecurityRule";
33482
33485
  /**
33483
33486
  * 注册安全规则相关 Tool
33484
33487
  * @param server MCP Server 实例
@@ -33487,7 +33490,7 @@ function registerSecurityRuleTools(server) {
33487
33490
  const cloudBaseOptions = server.cloudBaseOptions;
33488
33491
  const getManager = () => (0, cloudbase_manager_js_1.getCloudBaseManager)({ cloudBaseOptions });
33489
33492
  // 读取安全规则 Tool
33490
- server.registerTool?.("readSecurityRule", {
33493
+ server.registerTool?.(exports.READ_SECURITY_RULE, {
33491
33494
  title: "读取安全规则",
33492
33495
  description: `读取指定资源(noSQL 数据库、SQL 数据库、云函数、存储桶)的安全规则和权限类别。`,
33493
33496
  inputSchema: {
@@ -33587,7 +33590,7 @@ function registerSecurityRuleTools(server) {
33587
33590
  }
33588
33591
  });
33589
33592
  // 写入安全规则 Tool
33590
- server.registerTool?.("writeSecurityRule", {
33593
+ server.registerTool?.(exports.WRITE_SECURITY_RULE, {
33591
33594
  title: "写入安全规则",
33592
33595
  description: `设置指定资源(数据库集合、云函数、存储桶)的安全规则。`,
33593
33596
  inputSchema: {
@@ -38318,6 +38321,7 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
38318
38321
  exports.registerSQLDatabaseTools = registerSQLDatabaseTools;
38319
38322
  const zod_1 = __webpack_require__(21614);
38320
38323
  const cloudbase_manager_js_1 = __webpack_require__(3431);
38324
+ const security_rule_js_1 = __webpack_require__(7862);
38321
38325
  const CATEGORY = "SQL database";
38322
38326
  function registerSQLDatabaseTools(server) {
38323
38327
  // Get cloudBaseOptions, if not available then undefined
@@ -38386,7 +38390,7 @@ function registerSQLDatabaseTools(server) {
38386
38390
  // executeWriteSQL
38387
38391
  server.registerTool?.("executeWriteSQL", {
38388
38392
  title: "Execute write SQL statement",
38389
- description: "Execute a write SQL statement on the SQL database (INSERT, UPDATE, DELETE, etc.). Note: For per-user ACL, each table should contain a fixed `_openid` column that represents the user and is used for access control.",
38393
+ description: "Execute a write SQL statement on the SQL database (INSERT, UPDATE, DELETE, etc.). Whenever you create a new table, you **must** contain a fixed `_opeid` column that represents the user and is used for access control.",
38390
38394
  inputSchema: {
38391
38395
  sql: zod_1.z
38392
38396
  .string()
@@ -38424,7 +38428,7 @@ function registerSQLDatabaseTools(server) {
38424
38428
  type: "text",
38425
38429
  text: JSON.stringify({
38426
38430
  success: true,
38427
- message: "SQL statement executed successfully",
38431
+ message: `SQL statement executed successfully. If you just created a table, make sure to check its security rule is set to a proper value by using \`${security_rule_js_1.WRITE_SECURITY_RULE}\` and \`${security_rule_js_1.READ_SECURITY_RULE}\` tools.`,
38428
38432
  result,
38429
38433
  }, null, 2),
38430
38434
  },
@@ -134861,7 +134865,7 @@ class TelemetryReporter {
134861
134865
  const nodeVersion = process.version; // Node.js版本
134862
134866
  const arch = os_1.default.arch(); // 系统架构
134863
134867
  // 从构建时注入的版本号获取MCP版本信息
134864
- const mcpVersion = process.env.npm_package_version || "2.0.4" || 0;
134868
+ const mcpVersion = process.env.npm_package_version || "2.0.6" || 0;
134865
134869
  return {
134866
134870
  userAgent: `${osType} ${osRelease} ${arch} ${nodeVersion} CloudBase-MCP/${mcpVersion}`,
134867
134871
  deviceId: this.deviceId,
@@ -200506,7 +200510,7 @@ ${envIdSection}
200506
200510
  ## 环境信息
200507
200511
  - 操作系统: ${os_1.default.type()} ${os_1.default.release()}
200508
200512
  - Node.js版本: ${process.version}
200509
- - MCP 版本:${process.env.npm_package_version || "2.0.4" || 0}
200513
+ - MCP 版本:${process.env.npm_package_version || "2.0.6" || 0}
200510
200514
  - 系统架构: ${os_1.default.arch()}
200511
200515
  - 时间: ${new Date().toISOString()}
200512
200516
  - 请求ID: ${requestId}
@@ -208787,12 +208791,15 @@ deleteCollection: 删除数据`),
208787
208791
  collectionName: zod_1.z.string().describe("集合名称"),
208788
208792
  documents: zod_1.z
208789
208793
  .array(zod_1.z.object({}).passthrough())
208794
+ .optional()
208790
208795
  .describe("要插入的文档对象数组,每个文档都是对象(insert 操作必填)"),
208791
208796
  query: zod_1.z
208792
208797
  .union([zod_1.z.object({}).passthrough(), zod_1.z.string()])
208798
+ .optional()
208793
208799
  .describe("查询条件(对象或字符串,推荐对象)(update/delete 操作必填)"),
208794
208800
  update: zod_1.z
208795
208801
  .union([zod_1.z.object({}).passthrough(), zod_1.z.string()])
208802
+ .optional()
208796
208803
  .describe("更新内容(对象或字符串,推荐对象)(update 操作必填)"),
208797
208804
  isMulti: zod_1.z
208798
208805
  .boolean()
@@ -208812,6 +208819,9 @@ deleteCollection: 删除数据`),
208812
208819
  },
208813
208820
  }, async ({ action, collectionName, documents, query, update, isMulti, upsert, }) => {
208814
208821
  if (action === "insert") {
208822
+ if (!documents) {
208823
+ throw new Error("insert 操作时必须提供 documents");
208824
+ }
208815
208825
  const text = await insertDocuments({
208816
208826
  collectionName,
208817
208827
  documents,
@@ -208827,6 +208837,12 @@ deleteCollection: 删除数据`),
208827
208837
  };
208828
208838
  }
208829
208839
  if (action === "update") {
208840
+ if (!query) {
208841
+ throw new Error("update 操作时必须提供 query");
208842
+ }
208843
+ if (!update) {
208844
+ throw new Error("update 操作时必须提供 update");
208845
+ }
208830
208846
  const text = await updateDocuments({
208831
208847
  collectionName,
208832
208848
  query,
@@ -208845,6 +208861,9 @@ deleteCollection: 删除数据`),
208845
208861
  };
208846
208862
  }
208847
208863
  if (action === "delete") {
208864
+ if (!query) {
208865
+ throw new Error("delete 操作时必须提供 query");
208866
+ }
208848
208867
  const text = await deleteDocuments({
208849
208868
  collectionName,
208850
208869
  query,
@@ -215083,7 +215102,7 @@ function registerSetupTools(server) {
215083
215102
  title: "下载项目模板",
215084
215103
  description: `自动下载并部署CloudBase项目模板。⚠️ **MANDATORY FOR NEW PROJECTS** ⚠️
215085
215104
 
215086
- **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.4" : 0}),便于后续维护和版本追踪\n- 下载 rules 模板时,如果项目中已存在 README.md 文件,系统会自动保护该文件不被覆盖(除非设置 overwrite=true)`,
215105
+ **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.6" : 0}),便于后续维护和版本追踪\n- 下载 rules 模板时,如果项目中已存在 README.md 文件,系统会自动保护该文件不被覆盖(除非设置 overwrite=true)`,
215087
215106
  inputSchema: {
215088
215107
  template: zod_1.z.enum(["react", "vue", "miniprogram", "uniapp", "rules"]).describe("要下载的模板类型"),
215089
215108
  ide: zod_1.z.enum(IDE_TYPES).optional().default("all").describe("指定要下载的IDE类型,默认为all(下载所有IDE配置)"),
package/dist/index.cjs CHANGED
@@ -33475,9 +33475,12 @@ function wrap (fn) {
33475
33475
  "use strict";
33476
33476
 
33477
33477
  Object.defineProperty(exports, "__esModule", ({ value: true }));
33478
+ exports.WRITE_SECURITY_RULE = exports.READ_SECURITY_RULE = void 0;
33478
33479
  exports.registerSecurityRuleTools = registerSecurityRuleTools;
33479
33480
  const zod_1 = __webpack_require__(21614);
33480
33481
  const cloudbase_manager_js_1 = __webpack_require__(3431);
33482
+ exports.READ_SECURITY_RULE = "readSecurityRule";
33483
+ exports.WRITE_SECURITY_RULE = "writeSecurityRule";
33481
33484
  /**
33482
33485
  * 注册安全规则相关 Tool
33483
33486
  * @param server MCP Server 实例
@@ -33486,7 +33489,7 @@ function registerSecurityRuleTools(server) {
33486
33489
  const cloudBaseOptions = server.cloudBaseOptions;
33487
33490
  const getManager = () => (0, cloudbase_manager_js_1.getCloudBaseManager)({ cloudBaseOptions });
33488
33491
  // 读取安全规则 Tool
33489
- server.registerTool?.("readSecurityRule", {
33492
+ server.registerTool?.(exports.READ_SECURITY_RULE, {
33490
33493
  title: "读取安全规则",
33491
33494
  description: `读取指定资源(noSQL 数据库、SQL 数据库、云函数、存储桶)的安全规则和权限类别。`,
33492
33495
  inputSchema: {
@@ -33586,7 +33589,7 @@ function registerSecurityRuleTools(server) {
33586
33589
  }
33587
33590
  });
33588
33591
  // 写入安全规则 Tool
33589
- server.registerTool?.("writeSecurityRule", {
33592
+ server.registerTool?.(exports.WRITE_SECURITY_RULE, {
33590
33593
  title: "写入安全规则",
33591
33594
  description: `设置指定资源(数据库集合、云函数、存储桶)的安全规则。`,
33592
33595
  inputSchema: {
@@ -38317,6 +38320,7 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
38317
38320
  exports.registerSQLDatabaseTools = registerSQLDatabaseTools;
38318
38321
  const zod_1 = __webpack_require__(21614);
38319
38322
  const cloudbase_manager_js_1 = __webpack_require__(3431);
38323
+ const security_rule_js_1 = __webpack_require__(7862);
38320
38324
  const CATEGORY = "SQL database";
38321
38325
  function registerSQLDatabaseTools(server) {
38322
38326
  // Get cloudBaseOptions, if not available then undefined
@@ -38385,7 +38389,7 @@ function registerSQLDatabaseTools(server) {
38385
38389
  // executeWriteSQL
38386
38390
  server.registerTool?.("executeWriteSQL", {
38387
38391
  title: "Execute write SQL statement",
38388
- description: "Execute a write SQL statement on the SQL database (INSERT, UPDATE, DELETE, etc.). Note: For per-user ACL, each table should contain a fixed `_openid` column that represents the user and is used for access control.",
38392
+ description: "Execute a write SQL statement on the SQL database (INSERT, UPDATE, DELETE, etc.). Whenever you create a new table, you **must** contain a fixed `_opeid` column that represents the user and is used for access control.",
38389
38393
  inputSchema: {
38390
38394
  sql: zod_1.z
38391
38395
  .string()
@@ -38423,7 +38427,7 @@ function registerSQLDatabaseTools(server) {
38423
38427
  type: "text",
38424
38428
  text: JSON.stringify({
38425
38429
  success: true,
38426
- message: "SQL statement executed successfully",
38430
+ message: `SQL statement executed successfully. If you just created a table, make sure to check its security rule is set to a proper value by using \`${security_rule_js_1.WRITE_SECURITY_RULE}\` and \`${security_rule_js_1.READ_SECURITY_RULE}\` tools.`,
38427
38431
  result,
38428
38432
  }, null, 2),
38429
38433
  },
@@ -134710,7 +134714,7 @@ class TelemetryReporter {
134710
134714
  const nodeVersion = process.version; // Node.js版本
134711
134715
  const arch = os_1.default.arch(); // 系统架构
134712
134716
  // 从构建时注入的版本号获取MCP版本信息
134713
- const mcpVersion = process.env.npm_package_version || "2.0.4" || 0;
134717
+ const mcpVersion = process.env.npm_package_version || "2.0.6" || 0;
134714
134718
  return {
134715
134719
  userAgent: `${osType} ${osRelease} ${arch} ${nodeVersion} CloudBase-MCP/${mcpVersion}`,
134716
134720
  deviceId: this.deviceId,
@@ -200355,7 +200359,7 @@ ${envIdSection}
200355
200359
  ## 环境信息
200356
200360
  - 操作系统: ${os_1.default.type()} ${os_1.default.release()}
200357
200361
  - Node.js版本: ${process.version}
200358
- - MCP 版本:${process.env.npm_package_version || "2.0.4" || 0}
200362
+ - MCP 版本:${process.env.npm_package_version || "2.0.6" || 0}
200359
200363
  - 系统架构: ${os_1.default.arch()}
200360
200364
  - 时间: ${new Date().toISOString()}
200361
200365
  - 请求ID: ${requestId}
@@ -208636,12 +208640,15 @@ deleteCollection: 删除数据`),
208636
208640
  collectionName: zod_1.z.string().describe("集合名称"),
208637
208641
  documents: zod_1.z
208638
208642
  .array(zod_1.z.object({}).passthrough())
208643
+ .optional()
208639
208644
  .describe("要插入的文档对象数组,每个文档都是对象(insert 操作必填)"),
208640
208645
  query: zod_1.z
208641
208646
  .union([zod_1.z.object({}).passthrough(), zod_1.z.string()])
208647
+ .optional()
208642
208648
  .describe("查询条件(对象或字符串,推荐对象)(update/delete 操作必填)"),
208643
208649
  update: zod_1.z
208644
208650
  .union([zod_1.z.object({}).passthrough(), zod_1.z.string()])
208651
+ .optional()
208645
208652
  .describe("更新内容(对象或字符串,推荐对象)(update 操作必填)"),
208646
208653
  isMulti: zod_1.z
208647
208654
  .boolean()
@@ -208661,6 +208668,9 @@ deleteCollection: 删除数据`),
208661
208668
  },
208662
208669
  }, async ({ action, collectionName, documents, query, update, isMulti, upsert, }) => {
208663
208670
  if (action === "insert") {
208671
+ if (!documents) {
208672
+ throw new Error("insert 操作时必须提供 documents");
208673
+ }
208664
208674
  const text = await insertDocuments({
208665
208675
  collectionName,
208666
208676
  documents,
@@ -208676,6 +208686,12 @@ deleteCollection: 删除数据`),
208676
208686
  };
208677
208687
  }
208678
208688
  if (action === "update") {
208689
+ if (!query) {
208690
+ throw new Error("update 操作时必须提供 query");
208691
+ }
208692
+ if (!update) {
208693
+ throw new Error("update 操作时必须提供 update");
208694
+ }
208679
208695
  const text = await updateDocuments({
208680
208696
  collectionName,
208681
208697
  query,
@@ -208694,6 +208710,9 @@ deleteCollection: 删除数据`),
208694
208710
  };
208695
208711
  }
208696
208712
  if (action === "delete") {
208713
+ if (!query) {
208714
+ throw new Error("delete 操作时必须提供 query");
208715
+ }
208697
208716
  const text = await deleteDocuments({
208698
208717
  collectionName,
208699
208718
  query,
@@ -214932,7 +214951,7 @@ function registerSetupTools(server) {
214932
214951
  title: "下载项目模板",
214933
214952
  description: `自动下载并部署CloudBase项目模板。⚠️ **MANDATORY FOR NEW PROJECTS** ⚠️
214934
214953
 
214935
- **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.4" : 0}),便于后续维护和版本追踪\n- 下载 rules 模板时,如果项目中已存在 README.md 文件,系统会自动保护该文件不被覆盖(除非设置 overwrite=true)`,
214954
+ **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.6" : 0}),便于后续维护和版本追踪\n- 下载 rules 模板时,如果项目中已存在 README.md 文件,系统会自动保护该文件不被覆盖(除非设置 overwrite=true)`,
214936
214955
  inputSchema: {
214937
214956
  template: zod_1.z.enum(["react", "vue", "miniprogram", "uniapp", "rules"]).describe("要下载的模板类型"),
214938
214957
  ide: zod_1.z.enum(IDE_TYPES).optional().default("all").describe("指定要下载的IDE类型,默认为all(下载所有IDE配置)"),
package/dist/index.js CHANGED
@@ -6021,7 +6021,7 @@ ${envIdSection}
6021
6021
  ## 环境信息
6022
6022
  - 操作系统: ${os_1.default.type()} ${os_1.default.release()}
6023
6023
  - Node.js版本: ${process.version}
6024
- - MCP 版本:${process.env.npm_package_version || "2.0.4" || 0}
6024
+ - MCP 版本:${process.env.npm_package_version || "2.0.6" || 0}
6025
6025
  - 系统架构: ${os_1.default.arch()}
6026
6026
  - 时间: ${new Date().toISOString()}
6027
6027
  - 请求ID: ${requestId}
@@ -6178,6 +6178,7 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
6178
6178
  exports.registerSQLDatabaseTools = registerSQLDatabaseTools;
6179
6179
  const zod_1 = __webpack_require__(971);
6180
6180
  const cloudbase_manager_js_1 = __webpack_require__(431);
6181
+ const security_rule_js_1 = __webpack_require__(862);
6181
6182
  const CATEGORY = "SQL database";
6182
6183
  function registerSQLDatabaseTools(server) {
6183
6184
  // Get cloudBaseOptions, if not available then undefined
@@ -6246,7 +6247,7 @@ function registerSQLDatabaseTools(server) {
6246
6247
  // executeWriteSQL
6247
6248
  server.registerTool?.("executeWriteSQL", {
6248
6249
  title: "Execute write SQL statement",
6249
- description: "Execute a write SQL statement on the SQL database (INSERT, UPDATE, DELETE, etc.). Note: For per-user ACL, each table should contain a fixed `_openid` column that represents the user and is used for access control.",
6250
+ description: "Execute a write SQL statement on the SQL database (INSERT, UPDATE, DELETE, etc.). Whenever you create a new table, you **must** contain a fixed `_opeid` column that represents the user and is used for access control.",
6250
6251
  inputSchema: {
6251
6252
  sql: zod_1.z
6252
6253
  .string()
@@ -6284,7 +6285,7 @@ function registerSQLDatabaseTools(server) {
6284
6285
  type: "text",
6285
6286
  text: JSON.stringify({
6286
6287
  success: true,
6287
- message: "SQL statement executed successfully",
6288
+ message: `SQL statement executed successfully. If you just created a table, make sure to check its security rule is set to a proper value by using \`${security_rule_js_1.WRITE_SECURITY_RULE}\` and \`${security_rule_js_1.READ_SECURITY_RULE}\` tools.`,
6288
6289
  result,
6289
6290
  }, null, 2),
6290
6291
  },
@@ -7210,7 +7211,7 @@ function registerSetupTools(server) {
7210
7211
  title: "下载项目模板",
7211
7212
  description: `自动下载并部署CloudBase项目模板。⚠️ **MANDATORY FOR NEW PROJECTS** ⚠️
7212
7213
 
7213
- **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.4" : 0}),便于后续维护和版本追踪\n- 下载 rules 模板时,如果项目中已存在 README.md 文件,系统会自动保护该文件不被覆盖(除非设置 overwrite=true)`,
7214
+ **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.6" : 0}),便于后续维护和版本追踪\n- 下载 rules 模板时,如果项目中已存在 README.md 文件,系统会自动保护该文件不被覆盖(除非设置 overwrite=true)`,
7214
7215
  inputSchema: {
7215
7216
  template: zod_1.z.enum(["react", "vue", "miniprogram", "uniapp", "rules"]).describe("要下载的模板类型"),
7216
7217
  ide: zod_1.z.enum(IDE_TYPES).optional().default("all").describe("指定要下载的IDE类型,默认为all(下载所有IDE配置)"),
@@ -7893,9 +7894,12 @@ function registerStorageTools(server) {
7893
7894
 
7894
7895
 
7895
7896
  Object.defineProperty(exports, "__esModule", ({ value: true }));
7897
+ exports.WRITE_SECURITY_RULE = exports.READ_SECURITY_RULE = void 0;
7896
7898
  exports.registerSecurityRuleTools = registerSecurityRuleTools;
7897
7899
  const zod_1 = __webpack_require__(971);
7898
7900
  const cloudbase_manager_js_1 = __webpack_require__(431);
7901
+ exports.READ_SECURITY_RULE = "readSecurityRule";
7902
+ exports.WRITE_SECURITY_RULE = "writeSecurityRule";
7899
7903
  /**
7900
7904
  * 注册安全规则相关 Tool
7901
7905
  * @param server MCP Server 实例
@@ -7904,7 +7908,7 @@ function registerSecurityRuleTools(server) {
7904
7908
  const cloudBaseOptions = server.cloudBaseOptions;
7905
7909
  const getManager = () => (0, cloudbase_manager_js_1.getCloudBaseManager)({ cloudBaseOptions });
7906
7910
  // 读取安全规则 Tool
7907
- server.registerTool?.("readSecurityRule", {
7911
+ server.registerTool?.(exports.READ_SECURITY_RULE, {
7908
7912
  title: "读取安全规则",
7909
7913
  description: `读取指定资源(noSQL 数据库、SQL 数据库、云函数、存储桶)的安全规则和权限类别。`,
7910
7914
  inputSchema: {
@@ -8004,7 +8008,7 @@ function registerSecurityRuleTools(server) {
8004
8008
  }
8005
8009
  });
8006
8010
  // 写入安全规则 Tool
8007
- server.registerTool?.("writeSecurityRule", {
8011
+ server.registerTool?.(exports.WRITE_SECURITY_RULE, {
8008
8012
  title: "写入安全规则",
8009
8013
  description: `设置指定资源(数据库集合、云函数、存储桶)的安全规则。`,
8010
8014
  inputSchema: {
@@ -8249,7 +8253,7 @@ class TelemetryReporter {
8249
8253
  const nodeVersion = process.version; // Node.js版本
8250
8254
  const arch = os_1.default.arch(); // 系统架构
8251
8255
  // 从构建时注入的版本号获取MCP版本信息
8252
- const mcpVersion = process.env.npm_package_version || "2.0.4" || 0;
8256
+ const mcpVersion = process.env.npm_package_version || "2.0.6" || 0;
8253
8257
  return {
8254
8258
  userAgent: `${osType} ${osRelease} ${arch} ${nodeVersion} CloudBase-MCP/${mcpVersion}`,
8255
8259
  deviceId: this.deviceId,
@@ -8840,12 +8844,15 @@ deleteCollection: 删除数据`),
8840
8844
  collectionName: zod_1.z.string().describe("集合名称"),
8841
8845
  documents: zod_1.z
8842
8846
  .array(zod_1.z.object({}).passthrough())
8847
+ .optional()
8843
8848
  .describe("要插入的文档对象数组,每个文档都是对象(insert 操作必填)"),
8844
8849
  query: zod_1.z
8845
8850
  .union([zod_1.z.object({}).passthrough(), zod_1.z.string()])
8851
+ .optional()
8846
8852
  .describe("查询条件(对象或字符串,推荐对象)(update/delete 操作必填)"),
8847
8853
  update: zod_1.z
8848
8854
  .union([zod_1.z.object({}).passthrough(), zod_1.z.string()])
8855
+ .optional()
8849
8856
  .describe("更新内容(对象或字符串,推荐对象)(update 操作必填)"),
8850
8857
  isMulti: zod_1.z
8851
8858
  .boolean()
@@ -8865,6 +8872,9 @@ deleteCollection: 删除数据`),
8865
8872
  },
8866
8873
  }, async ({ action, collectionName, documents, query, update, isMulti, upsert, }) => {
8867
8874
  if (action === "insert") {
8875
+ if (!documents) {
8876
+ throw new Error("insert 操作时必须提供 documents");
8877
+ }
8868
8878
  const text = await insertDocuments({
8869
8879
  collectionName,
8870
8880
  documents,
@@ -8880,6 +8890,12 @@ deleteCollection: 删除数据`),
8880
8890
  };
8881
8891
  }
8882
8892
  if (action === "update") {
8893
+ if (!query) {
8894
+ throw new Error("update 操作时必须提供 query");
8895
+ }
8896
+ if (!update) {
8897
+ throw new Error("update 操作时必须提供 update");
8898
+ }
8883
8899
  const text = await updateDocuments({
8884
8900
  collectionName,
8885
8901
  query,
@@ -8898,6 +8914,9 @@ deleteCollection: 删除数据`),
8898
8914
  };
8899
8915
  }
8900
8916
  if (action === "delete") {
8917
+ if (!query) {
8918
+ throw new Error("delete 操作时必须提供 query");
8919
+ }
8901
8920
  const text = await deleteDocuments({
8902
8921
  collectionName,
8903
8922
  query,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cloudbase/cloudbase-mcp",
3
- "version": "2.0.4",
3
+ "version": "2.0.6",
4
4
  "description": "腾讯云开发 MCP Server,通过AI提示词和MCP协议+云开发,让开发更智能、更高效,当你在Cursor/ VSCode GitHub Copilot/WinSurf/CodeBuddy/Augment Code/Claude Code等AI编程工具里写代码时,它能自动帮你生成可直接部署的前后端应用+小程序,并一键发布到腾讯云开发 CloudBase。",
5
5
  "main": "./dist/index.cjs",
6
6
  "module": "./dist/index.js",