@cloudbase/cloudbase-mcp 2.23.1 → 2.23.3

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
@@ -3293,6 +3293,199 @@ function registerEnvTools(server) {
3293
3293
  }
3294
3294
  });
3295
3295
  } // end: wxide guard for envDomainManagement
3296
+ // manageEnv - 环境管理(创建、销毁、变更套餐、续费、查询套餐)
3297
+ server.registerTool?.("manageEnv", {
3298
+ title: "CloudBase 环境管理(创建/变配/续费)",
3299
+ description: "管理 CloudBase 环境,支持:listPackages=查询可选套餐列表,create=创建新环境(需确认),modifyPlan=变更套餐(升降配,需确认),renew=续费环境(需确认)。\n\n⚠️ 所有涉及费用的操作(create/modifyPlan/renew),执行前必须展示配置摘要并等待用户通过 confirm=\"yes\" 确认。",
3300
+ inputSchema: {
3301
+ action: zod_1.z
3302
+ .enum(["listPackages", "create", "modifyPlan", "renew"])
3303
+ .describe("操作类型:listPackages=查询可选套餐,create=创建环境,modifyPlan=变更套餐,renew=续费"),
3304
+ alias: zod_1.z
3305
+ .string()
3306
+ .optional()
3307
+ .describe("环境别名(action=create 时必填)。要求:小写字母/数字/减号,不能以减号开头或结尾,最长 20 位"),
3308
+ packageId: zod_1.z
3309
+ .string()
3310
+ .optional()
3311
+ .describe("套餐 ID(action=create/modifyPlan 时必填)。可选值如 baas_personal(个人版)、baas_pf_standard(标准版)、baas_pf_enterprise(企业版)"),
3312
+ region: zod_1.z
3313
+ .string()
3314
+ .optional()
3315
+ .describe("环境地域(action=create 时可选)。默认 ap-shanghai,可选 ap-guangzhou、ap-beijing 等"),
3316
+ resources: zod_1.z
3317
+ .array(zod_1.z.enum(["flexdb", "storage", "function"]))
3318
+ .optional()
3319
+ .describe("启用的资源类型(action=create 时可选)。默认启用全部三项:flexdb(文档数据库)、storage(存储)、function(云函数)"),
3320
+ duration: zod_1.z
3321
+ .number()
3322
+ .int()
3323
+ .min(1)
3324
+ .max(36)
3325
+ .optional()
3326
+ .describe("购买或续费时长(月),action=create/renew 时可选,默认 1"),
3327
+ envId: zod_1.z
3328
+ .string()
3329
+ .optional()
3330
+ .describe("环境 ID(action=modifyPlan/renew 时必填)"),
3331
+ confirm: zod_1.z
3332
+ .literal("yes")
3333
+ .optional()
3334
+ .describe("确认操作。所有付费操作(create/modifyPlan/renew)必须传 \"yes\" 确认"),
3335
+ },
3336
+ annotations: {
3337
+ readOnlyHint: false,
3338
+ destructiveHint: true,
3339
+ idempotentHint: false,
3340
+ openWorldHint: true,
3341
+ category: "env",
3342
+ },
3343
+ }, async (rawArgs) => {
3344
+ const action = rawArgs.action ?? "";
3345
+ const alias = normalizeOptionalToolString(rawArgs.alias);
3346
+ const packageId = normalizeOptionalToolString(rawArgs.packageId);
3347
+ const region = normalizeOptionalToolString(rawArgs.region) ?? "ap-shanghai";
3348
+ const resources = rawArgs.resources;
3349
+ const duration = rawArgs.duration ?? 1;
3350
+ const envId = normalizeOptionalToolString(rawArgs.envId);
3351
+ const confirmed = rawArgs.confirm === "yes";
3352
+ try {
3353
+ const cloudbase = await getManager();
3354
+ switch (action) {
3355
+ case "listPackages": {
3356
+ // 查询可选套餐列表(新购场景)
3357
+ const result = await cloudbase.env.describeBaasPackageList({ TargetAction: "new" });
3358
+ (0, cloudbase_manager_js_1.logCloudBaseResult)(server.logger, result);
3359
+ return (0, tool_result_js_1.buildJsonToolResult)({
3360
+ ok: true,
3361
+ code: "PACKAGE_LIST",
3362
+ message: "成功获取可选套餐列表。",
3363
+ packages: result.PackageList || result,
3364
+ });
3365
+ }
3366
+ case "create": {
3367
+ // 创建环境需要 confirm
3368
+ if (!confirmed) {
3369
+ return (0, tool_result_js_1.buildJsonToolResult)({
3370
+ ok: false,
3371
+ code: "CONFIRM_REQUIRED",
3372
+ message: `创建环境需要您确认。请确认以下配置信息后传入 confirm="yes":\n别名: ${alias}\n套餐: ${packageId}\n地域: ${region}\n资源类型: ${resources?.join(", ") ?? "flexdb, storage, function"}\n时长: ${duration} 个月`,
3373
+ next_step: {
3374
+ tool: "manageEnv",
3375
+ action: "create",
3376
+ requiredParams: ["alias", "packageId", "confirm"],
3377
+ },
3378
+ });
3379
+ }
3380
+ if (!alias) {
3381
+ throw new Error("创建环境时 alias(环境别名)为必填参数");
3382
+ }
3383
+ if (!packageId) {
3384
+ throw new Error("创建环境时 packageId(套餐 ID)为必填参数");
3385
+ }
3386
+ const createParams = {
3387
+ Alias: alias,
3388
+ PackageId: packageId,
3389
+ Region: region,
3390
+ Period: duration,
3391
+ };
3392
+ if (resources && resources.length > 0) {
3393
+ createParams.Resources = resources;
3394
+ }
3395
+ const result = await cloudbase.env.createEnv(createParams);
3396
+ (0, cloudbase_manager_js_1.logCloudBaseResult)(server.logger, result);
3397
+ return (0, tool_result_js_1.buildJsonToolResult)({
3398
+ ok: true,
3399
+ code: "ENV_CREATED",
3400
+ message: `环境创建成功!新环境 ID: ${result.EnvId}。环境初始化可能需要几分钟,请通过 queryEnv(action="info", envId="${result.EnvId}") 轮询直到 Status 为正常。`,
3401
+ envId: result.EnvId,
3402
+ });
3403
+ }
3404
+ case "modifyPlan": {
3405
+ // 变更套餐需要 confirm
3406
+ if (!confirmed) {
3407
+ if (!envId || !packageId) {
3408
+ throw new Error("变更套餐时 envId 和 packageId 为必填参数");
3409
+ }
3410
+ return (0, tool_result_js_1.buildJsonToolResult)({
3411
+ ok: false,
3412
+ code: "CONFIRM_REQUIRED",
3413
+ message: `变更环境 ${envId} 的套餐为 ${packageId} 可能产生费用变化。请确认后传入 confirm="yes"。`,
3414
+ next_step: {
3415
+ tool: "manageEnv",
3416
+ action: "modifyPlan",
3417
+ requiredParams: ["envId", "packageId", "confirm"],
3418
+ },
3419
+ });
3420
+ }
3421
+ if (!envId) {
3422
+ throw new Error("变更套餐时 envId 为必填参数");
3423
+ }
3424
+ if (!packageId) {
3425
+ throw new Error("变更套餐时 packageId 为必填参数");
3426
+ }
3427
+ const result = await cloudbase.env.modifyEnvPlan({ EnvId: envId, PackageId: packageId });
3428
+ (0, cloudbase_manager_js_1.logCloudBaseResult)(server.logger, result);
3429
+ return (0, tool_result_js_1.buildJsonToolResult)({
3430
+ ok: true,
3431
+ code: "PLAN_MODIFIED",
3432
+ message: `环境 ${envId} 的套餐已成功变更为 ${packageId}。`,
3433
+ envId,
3434
+ packageId,
3435
+ });
3436
+ }
3437
+ case "renew": {
3438
+ // 续费需要 confirm
3439
+ if (!confirmed) {
3440
+ if (!envId) {
3441
+ throw new Error("续费环境时 envId 为必填参数");
3442
+ }
3443
+ return (0, tool_result_js_1.buildJsonToolResult)({
3444
+ ok: false,
3445
+ code: "CONFIRM_REQUIRED",
3446
+ message: `续费环境 ${envId},时长: ${duration} 个月,可能产生费用。请确认后传入 confirm="yes"。`,
3447
+ next_step: {
3448
+ tool: "manageEnv",
3449
+ action: "renew",
3450
+ requiredParams: ["envId", "confirm"],
3451
+ },
3452
+ });
3453
+ }
3454
+ if (!envId) {
3455
+ throw new Error("续费环境时 envId 为必填参数");
3456
+ }
3457
+ const result = await cloudbase.env.renewEnv({ EnvId: envId, Period: duration });
3458
+ (0, cloudbase_manager_js_1.logCloudBaseResult)(server.logger, result);
3459
+ return (0, tool_result_js_1.buildJsonToolResult)({
3460
+ ok: true,
3461
+ code: "ENV_RENEWED",
3462
+ message: `环境 ${envId} 已成功续费 ${duration} 个月。`,
3463
+ envId,
3464
+ });
3465
+ }
3466
+ default:
3467
+ return (0, tool_result_js_1.buildJsonToolResult)({
3468
+ ok: false,
3469
+ code: "INVALID_ACTION",
3470
+ message: `不支持的操作: ${action}。支持的操作: listPackages, create, destroy, modifyPlan, renew。`,
3471
+ });
3472
+ }
3473
+ }
3474
+ catch (error) {
3475
+ const toolPayloadResult = (0, tool_result_js_1.toolPayloadErrorToResult)(error);
3476
+ if (toolPayloadResult) {
3477
+ return toolPayloadResult;
3478
+ }
3479
+ return {
3480
+ content: [
3481
+ {
3482
+ type: "text",
3483
+ text: `环境管理操作失败: ${error instanceof Error ? error.message : String(error)}`,
3484
+ },
3485
+ ],
3486
+ };
3487
+ }
3488
+ });
3296
3489
  }
3297
3490
 
3298
3491
 
@@ -135656,7 +135849,7 @@ class TelemetryReporter {
135656
135849
  const nodeVersion = process.version; // Node.js版本
135657
135850
  const arch = os_1.default.arch(); // 系统架构
135658
135851
  // 从构建时注入的版本号获取MCP版本信息
135659
- const mcpVersion = process.env.npm_package_version || "2.23.1" || 0;
135852
+ const mcpVersion = process.env.npm_package_version || "2.23.3" || 0;
135660
135853
  return {
135661
135854
  userAgent: `${osType} ${osRelease} ${arch} ${nodeVersion} CloudBase-MCP/${mcpVersion}`,
135662
135855
  deviceId: this.deviceId,
@@ -195427,7 +195620,7 @@ ${envIdSection}
195427
195620
  ## 环境信息
195428
195621
  - 操作系统: ${os_1.default.type()} ${os_1.default.release()}
195429
195622
  - Node.js版本: ${process.version}
195430
- - MCP 版本:${process.env.npm_package_version || "2.23.1" || 0}
195623
+ - MCP 版本:${process.env.npm_package_version || "2.23.3" || 0}
195431
195624
  - 系统架构: ${os_1.default.arch()}
195432
195625
  - 时间: ${new Date().toISOString()}
195433
195626
  - 请求ID: ${requestId}
@@ -195508,7 +195701,7 @@ function createWrappedHandler(name, handler, server) {
195508
195701
  requestId: (typeof error === 'object' && error && 'requestId' in error) ? error.requestId : '',
195509
195702
  ide: server.ide || process.env.INTEGRATION_IDE || ''
195510
195703
  });
195511
- const mcpVersion = true ? "2.23.1" : 0;
195704
+ const mcpVersion = true ? "2.23.3" : 0;
195512
195705
  const requestIdSuffix = requestId ? `\n🆔 RequestId: ${requestId}` : '';
195513
195706
  const enhancedErrorMessage = `${errorMessage}${requestIdSuffix}\n\n📦 CloudBase MCP v${mcpVersion}\n🔗 遇到问题?请复制以下链接到浏览器打开\n即可自动携带错误详情快速创建 GitHub Issue:\n${issueLink}`;
195514
195707
  // 创建新的错误对象,保持原有的错误类型但更新消息
@@ -211520,7 +211713,7 @@ function registerSetupTools(server) {
211520
211713
  server.registerTool("downloadTemplate", {
211521
211714
  title: "下载项目模板",
211522
211715
  description: `自动下载并部署CloudBase项目模板。
211523
- **Note**: Call this tool when the user requests to create a new project using a CloudBase template.\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- 其他IDE类型见下方列表\n\n注意:如果未传入 ide 参数且无法从环境变量检测到 IDE,将提示错误并要求传入 ide 参数\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- qoder: Qoder AI编辑器\n- antigravity: Google Antigravity AI编辑器\n- vscode: Visual Studio Code\n- kiro: Kiro AI编辑器\n- aider: Aider AI编辑器\n\n特别说明:\n- rules 模板会自动包含当前 mcp 版本号信息(版本号:${ true ? "2.23.1" : 0}),便于后续维护和版本追踪\n- 下载 rules 模板时,如果项目中已存在 README.md 文件,系统会自动保护该文件不被覆盖(除非设置 overwrite=true)`,
211716
+ **Note**: Call this tool when the user requests to create a new project using a CloudBase template.\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- 其他IDE类型见下方列表\n\n注意:如果未传入 ide 参数且无法从环境变量检测到 IDE,将提示错误并要求传入 ide 参数\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- qoder: Qoder AI编辑器\n- antigravity: Google Antigravity AI编辑器\n- vscode: Visual Studio Code\n- kiro: Kiro AI编辑器\n- aider: Aider AI编辑器\n\n特别说明:\n- rules 模板会自动包含当前 mcp 版本号信息(版本号:${ true ? "2.23.3" : 0}),便于后续维护和版本追踪\n- 下载 rules 模板时,如果项目中已存在 README.md 文件,系统会自动保护该文件不被覆盖(除非设置 overwrite=true)`,
211524
211717
  inputSchema: {
211525
211718
  template: zod_1.z
211526
211719
  .enum(["react", "vue", "miniprogram", "uniapp", "rules"])
package/dist/index.js CHANGED
@@ -1564,6 +1564,199 @@ function registerEnvTools(server) {
1564
1564
  }
1565
1565
  });
1566
1566
  } // end: wxide guard for envDomainManagement
1567
+ // manageEnv - 环境管理(创建、销毁、变更套餐、续费、查询套餐)
1568
+ server.registerTool?.("manageEnv", {
1569
+ title: "CloudBase 环境管理(创建/变配/续费)",
1570
+ description: "管理 CloudBase 环境,支持:listPackages=查询可选套餐列表,create=创建新环境(需确认),modifyPlan=变更套餐(升降配,需确认),renew=续费环境(需确认)。\n\n⚠️ 所有涉及费用的操作(create/modifyPlan/renew),执行前必须展示配置摘要并等待用户通过 confirm=\"yes\" 确认。",
1571
+ inputSchema: {
1572
+ action: zod_1.z
1573
+ .enum(["listPackages", "create", "modifyPlan", "renew"])
1574
+ .describe("操作类型:listPackages=查询可选套餐,create=创建环境,modifyPlan=变更套餐,renew=续费"),
1575
+ alias: zod_1.z
1576
+ .string()
1577
+ .optional()
1578
+ .describe("环境别名(action=create 时必填)。要求:小写字母/数字/减号,不能以减号开头或结尾,最长 20 位"),
1579
+ packageId: zod_1.z
1580
+ .string()
1581
+ .optional()
1582
+ .describe("套餐 ID(action=create/modifyPlan 时必填)。可选值如 baas_personal(个人版)、baas_pf_standard(标准版)、baas_pf_enterprise(企业版)"),
1583
+ region: zod_1.z
1584
+ .string()
1585
+ .optional()
1586
+ .describe("环境地域(action=create 时可选)。默认 ap-shanghai,可选 ap-guangzhou、ap-beijing 等"),
1587
+ resources: zod_1.z
1588
+ .array(zod_1.z.enum(["flexdb", "storage", "function"]))
1589
+ .optional()
1590
+ .describe("启用的资源类型(action=create 时可选)。默认启用全部三项:flexdb(文档数据库)、storage(存储)、function(云函数)"),
1591
+ duration: zod_1.z
1592
+ .number()
1593
+ .int()
1594
+ .min(1)
1595
+ .max(36)
1596
+ .optional()
1597
+ .describe("购买或续费时长(月),action=create/renew 时可选,默认 1"),
1598
+ envId: zod_1.z
1599
+ .string()
1600
+ .optional()
1601
+ .describe("环境 ID(action=modifyPlan/renew 时必填)"),
1602
+ confirm: zod_1.z
1603
+ .literal("yes")
1604
+ .optional()
1605
+ .describe("确认操作。所有付费操作(create/modifyPlan/renew)必须传 \"yes\" 确认"),
1606
+ },
1607
+ annotations: {
1608
+ readOnlyHint: false,
1609
+ destructiveHint: true,
1610
+ idempotentHint: false,
1611
+ openWorldHint: true,
1612
+ category: "env",
1613
+ },
1614
+ }, async (rawArgs) => {
1615
+ const action = rawArgs.action ?? "";
1616
+ const alias = normalizeOptionalToolString(rawArgs.alias);
1617
+ const packageId = normalizeOptionalToolString(rawArgs.packageId);
1618
+ const region = normalizeOptionalToolString(rawArgs.region) ?? "ap-shanghai";
1619
+ const resources = rawArgs.resources;
1620
+ const duration = rawArgs.duration ?? 1;
1621
+ const envId = normalizeOptionalToolString(rawArgs.envId);
1622
+ const confirmed = rawArgs.confirm === "yes";
1623
+ try {
1624
+ const cloudbase = await getManager();
1625
+ switch (action) {
1626
+ case "listPackages": {
1627
+ // 查询可选套餐列表(新购场景)
1628
+ const result = await cloudbase.env.describeBaasPackageList({ TargetAction: "new" });
1629
+ (0, cloudbase_manager_js_1.logCloudBaseResult)(server.logger, result);
1630
+ return (0, tool_result_js_1.buildJsonToolResult)({
1631
+ ok: true,
1632
+ code: "PACKAGE_LIST",
1633
+ message: "成功获取可选套餐列表。",
1634
+ packages: result.PackageList || result,
1635
+ });
1636
+ }
1637
+ case "create": {
1638
+ // 创建环境需要 confirm
1639
+ if (!confirmed) {
1640
+ return (0, tool_result_js_1.buildJsonToolResult)({
1641
+ ok: false,
1642
+ code: "CONFIRM_REQUIRED",
1643
+ message: `创建环境需要您确认。请确认以下配置信息后传入 confirm="yes":\n别名: ${alias}\n套餐: ${packageId}\n地域: ${region}\n资源类型: ${resources?.join(", ") ?? "flexdb, storage, function"}\n时长: ${duration} 个月`,
1644
+ next_step: {
1645
+ tool: "manageEnv",
1646
+ action: "create",
1647
+ requiredParams: ["alias", "packageId", "confirm"],
1648
+ },
1649
+ });
1650
+ }
1651
+ if (!alias) {
1652
+ throw new Error("创建环境时 alias(环境别名)为必填参数");
1653
+ }
1654
+ if (!packageId) {
1655
+ throw new Error("创建环境时 packageId(套餐 ID)为必填参数");
1656
+ }
1657
+ const createParams = {
1658
+ Alias: alias,
1659
+ PackageId: packageId,
1660
+ Region: region,
1661
+ Period: duration,
1662
+ };
1663
+ if (resources && resources.length > 0) {
1664
+ createParams.Resources = resources;
1665
+ }
1666
+ const result = await cloudbase.env.createEnv(createParams);
1667
+ (0, cloudbase_manager_js_1.logCloudBaseResult)(server.logger, result);
1668
+ return (0, tool_result_js_1.buildJsonToolResult)({
1669
+ ok: true,
1670
+ code: "ENV_CREATED",
1671
+ message: `环境创建成功!新环境 ID: ${result.EnvId}。环境初始化可能需要几分钟,请通过 queryEnv(action="info", envId="${result.EnvId}") 轮询直到 Status 为正常。`,
1672
+ envId: result.EnvId,
1673
+ });
1674
+ }
1675
+ case "modifyPlan": {
1676
+ // 变更套餐需要 confirm
1677
+ if (!confirmed) {
1678
+ if (!envId || !packageId) {
1679
+ throw new Error("变更套餐时 envId 和 packageId 为必填参数");
1680
+ }
1681
+ return (0, tool_result_js_1.buildJsonToolResult)({
1682
+ ok: false,
1683
+ code: "CONFIRM_REQUIRED",
1684
+ message: `变更环境 ${envId} 的套餐为 ${packageId} 可能产生费用变化。请确认后传入 confirm="yes"。`,
1685
+ next_step: {
1686
+ tool: "manageEnv",
1687
+ action: "modifyPlan",
1688
+ requiredParams: ["envId", "packageId", "confirm"],
1689
+ },
1690
+ });
1691
+ }
1692
+ if (!envId) {
1693
+ throw new Error("变更套餐时 envId 为必填参数");
1694
+ }
1695
+ if (!packageId) {
1696
+ throw new Error("变更套餐时 packageId 为必填参数");
1697
+ }
1698
+ const result = await cloudbase.env.modifyEnvPlan({ EnvId: envId, PackageId: packageId });
1699
+ (0, cloudbase_manager_js_1.logCloudBaseResult)(server.logger, result);
1700
+ return (0, tool_result_js_1.buildJsonToolResult)({
1701
+ ok: true,
1702
+ code: "PLAN_MODIFIED",
1703
+ message: `环境 ${envId} 的套餐已成功变更为 ${packageId}。`,
1704
+ envId,
1705
+ packageId,
1706
+ });
1707
+ }
1708
+ case "renew": {
1709
+ // 续费需要 confirm
1710
+ if (!confirmed) {
1711
+ if (!envId) {
1712
+ throw new Error("续费环境时 envId 为必填参数");
1713
+ }
1714
+ return (0, tool_result_js_1.buildJsonToolResult)({
1715
+ ok: false,
1716
+ code: "CONFIRM_REQUIRED",
1717
+ message: `续费环境 ${envId},时长: ${duration} 个月,可能产生费用。请确认后传入 confirm="yes"。`,
1718
+ next_step: {
1719
+ tool: "manageEnv",
1720
+ action: "renew",
1721
+ requiredParams: ["envId", "confirm"],
1722
+ },
1723
+ });
1724
+ }
1725
+ if (!envId) {
1726
+ throw new Error("续费环境时 envId 为必填参数");
1727
+ }
1728
+ const result = await cloudbase.env.renewEnv({ EnvId: envId, Period: duration });
1729
+ (0, cloudbase_manager_js_1.logCloudBaseResult)(server.logger, result);
1730
+ return (0, tool_result_js_1.buildJsonToolResult)({
1731
+ ok: true,
1732
+ code: "ENV_RENEWED",
1733
+ message: `环境 ${envId} 已成功续费 ${duration} 个月。`,
1734
+ envId,
1735
+ });
1736
+ }
1737
+ default:
1738
+ return (0, tool_result_js_1.buildJsonToolResult)({
1739
+ ok: false,
1740
+ code: "INVALID_ACTION",
1741
+ message: `不支持的操作: ${action}。支持的操作: listPackages, create, destroy, modifyPlan, renew。`,
1742
+ });
1743
+ }
1744
+ }
1745
+ catch (error) {
1746
+ const toolPayloadResult = (0, tool_result_js_1.toolPayloadErrorToResult)(error);
1747
+ if (toolPayloadResult) {
1748
+ return toolPayloadResult;
1749
+ }
1750
+ return {
1751
+ content: [
1752
+ {
1753
+ type: "text",
1754
+ text: `环境管理操作失败: ${error instanceof Error ? error.message : String(error)}`,
1755
+ },
1756
+ ],
1757
+ };
1758
+ }
1759
+ });
1567
1760
  }
1568
1761
 
1569
1762
 
@@ -1887,7 +2080,7 @@ ${envIdSection}
1887
2080
  ## 环境信息
1888
2081
  - 操作系统: ${os_1.default.type()} ${os_1.default.release()}
1889
2082
  - Node.js版本: ${process.version}
1890
- - MCP 版本:${process.env.npm_package_version || "2.23.1" || 0}
2083
+ - MCP 版本:${process.env.npm_package_version || "2.23.3" || 0}
1891
2084
  - 系统架构: ${os_1.default.arch()}
1892
2085
  - 时间: ${new Date().toISOString()}
1893
2086
  - 请求ID: ${requestId}
@@ -1968,7 +2161,7 @@ function createWrappedHandler(name, handler, server) {
1968
2161
  requestId: (typeof error === 'object' && error && 'requestId' in error) ? error.requestId : '',
1969
2162
  ide: server.ide || process.env.INTEGRATION_IDE || ''
1970
2163
  });
1971
- const mcpVersion = true ? "2.23.1" : 0;
2164
+ const mcpVersion = true ? "2.23.3" : 0;
1972
2165
  const requestIdSuffix = requestId ? `\n🆔 RequestId: ${requestId}` : '';
1973
2166
  const enhancedErrorMessage = `${errorMessage}${requestIdSuffix}\n\n📦 CloudBase MCP v${mcpVersion}\n🔗 遇到问题?请复制以下链接到浏览器打开\n即可自动携带错误详情快速创建 GitHub Issue:\n${issueLink}`;
1974
2167
  // 创建新的错误对象,保持原有的错误类型但更新消息
@@ -9544,7 +9737,7 @@ class TelemetryReporter {
9544
9737
  const nodeVersion = process.version; // Node.js版本
9545
9738
  const arch = os_1.default.arch(); // 系统架构
9546
9739
  // 从构建时注入的版本号获取MCP版本信息
9547
- const mcpVersion = process.env.npm_package_version || "2.23.1" || 0;
9740
+ const mcpVersion = process.env.npm_package_version || "2.23.3" || 0;
9548
9741
  return {
9549
9742
  userAgent: `${osType} ${osRelease} ${arch} ${nodeVersion} CloudBase-MCP/${mcpVersion}`,
9550
9743
  deviceId: this.deviceId,
@@ -13406,7 +13599,7 @@ function registerSetupTools(server) {
13406
13599
  server.registerTool("downloadTemplate", {
13407
13600
  title: "下载项目模板",
13408
13601
  description: `自动下载并部署CloudBase项目模板。
13409
- **Note**: Call this tool when the user requests to create a new project using a CloudBase template.\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- 其他IDE类型见下方列表\n\n注意:如果未传入 ide 参数且无法从环境变量检测到 IDE,将提示错误并要求传入 ide 参数\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- qoder: Qoder AI编辑器\n- antigravity: Google Antigravity AI编辑器\n- vscode: Visual Studio Code\n- kiro: Kiro AI编辑器\n- aider: Aider AI编辑器\n\n特别说明:\n- rules 模板会自动包含当前 mcp 版本号信息(版本号:${ true ? "2.23.1" : 0}),便于后续维护和版本追踪\n- 下载 rules 模板时,如果项目中已存在 README.md 文件,系统会自动保护该文件不被覆盖(除非设置 overwrite=true)`,
13602
+ **Note**: Call this tool when the user requests to create a new project using a CloudBase template.\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- 其他IDE类型见下方列表\n\n注意:如果未传入 ide 参数且无法从环境变量检测到 IDE,将提示错误并要求传入 ide 参数\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- qoder: Qoder AI编辑器\n- antigravity: Google Antigravity AI编辑器\n- vscode: Visual Studio Code\n- kiro: Kiro AI编辑器\n- aider: Aider AI编辑器\n\n特别说明:\n- rules 模板会自动包含当前 mcp 版本号信息(版本号:${ true ? "2.23.3" : 0}),便于后续维护和版本追踪\n- 下载 rules 模板时,如果项目中已存在 README.md 文件,系统会自动保护该文件不被覆盖(除非设置 overwrite=true)`,
13410
13603
  inputSchema: {
13411
13604
  template: zod_1.z
13412
13605
  .enum(["react", "vue", "miniprogram", "uniapp", "rules"])
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cloudbase/cloudbase-mcp",
3
- "version": "2.23.1",
3
+ "version": "2.23.3",
4
4
  "packageManager": "pnpm@10.8.0",
5
5
  "description": "腾讯云开发 MCP Server,通过AI提示词和MCP协议+云开发,让开发更智能、更高效,当你在Cursor/ VSCode GitHub Copilot/WinSurf/CodeBuddy/Augment Code/Claude Code等AI编程工具里写代码时,它能自动帮你生成可直接部署的前后端应用+小程序,并一键发布到腾讯云开发 CloudBase。",
6
6
  "main": "./dist/index.cjs",
@@ -40,7 +40,7 @@
40
40
  "clean": "rm -rf dist",
41
41
  "prebuild": "npm run clean",
42
42
  "build": "npm run build:webpack && npm run build:types && npm run build:permissions",
43
- "build:webpack": "webpack --config webpack/index.cjs --mode=production",
43
+ "build:webpack": "NODE_OPTIONS=\"--max-old-space-size=8192\" webpack --config webpack/index.cjs --mode=production",
44
44
  "build:types": "tsc --emitDeclarationOnly --declaration --declarationMap --outDir dist/types && api-extractor run --local --verbose && cp dist/types/cli.d.ts dist/cli.d.ts && rm -rf dist/types",
45
45
  "build:permissions": "chmod 755 dist/cli.cjs",
46
46
  "test": "npm run build && vitest run",