@cloudbase/cloudbase-mcp 2.7.7 → 2.9.0

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
@@ -1726,7 +1726,7 @@ function registerEnvTools(server) {
1726
1726
  // Get CLAUDE.md prompt content (skip for CodeBuddy IDE)
1727
1727
  let promptContent = "";
1728
1728
  const currentIde = server.ide || process.env.INTEGRATION_IDE;
1729
- if (currentIde !== "CodeBuddy") {
1729
+ if (currentIde !== "CodeBuddy" && process.env.CLOUDBASE_GUIDE_PROMPT !== "false") {
1730
1730
  try {
1731
1731
  promptContent = await (0, rag_js_1.getClaudePrompt)();
1732
1732
  }
@@ -1829,7 +1829,7 @@ function registerEnvTools(server) {
1829
1829
  });
1830
1830
  // Use commonService to call DescribeEnvs with filter parameters
1831
1831
  // Filter parameters match the reference conditions provided by user
1832
- result = await cloudbaseList.commonService("tcb").call({
1832
+ result = await cloudbaseList.commonService("tcb", "2018-06-08").call({
1833
1833
  Action: "DescribeEnvs",
1834
1834
  Param: {
1835
1835
  EnvTypes: ["weda", "baas"], // Include weda and baas (normal) environments
@@ -1912,7 +1912,7 @@ function registerEnvTools(server) {
1912
1912
  let responseText = JSON.stringify(result, null, 2);
1913
1913
  // For info action, append CLAUDE.md prompt content (skip for CodeBuddy IDE)
1914
1914
  const currentIde = server.ide || process.env.INTEGRATION_IDE;
1915
- if (action === "info" && currentIde !== "CodeBuddy") {
1915
+ if (action === "info" && currentIde !== "CodeBuddy" && process.env.CLOUDBASE_GUIDE_PROMPT !== "false") {
1916
1916
  try {
1917
1917
  const promptContent = await (0, rag_js_1.getClaudePrompt)();
1918
1918
  if (promptContent) {
@@ -23837,7 +23837,10 @@ async function getCloudBaseManager(options = {}) {
23837
23837
  return createCloudBaseManagerWithOptions(cloudBaseOptions);
23838
23838
  }
23839
23839
  try {
23840
- const loginState = await (0, auth_js_1.getLoginState)();
23840
+ // Get region from environment variable for auth URL
23841
+ // Note: At this point, cloudBaseOptions is undefined (checked above), so only use env var
23842
+ const region = process.env.TCB_REGION;
23843
+ const loginState = await (0, auth_js_1.getLoginState)({ region });
23841
23844
  const { envId: loginEnvId, secretId, secretKey, token } = loginState;
23842
23845
  let finalEnvId;
23843
23846
  if (requireEnvId) {
@@ -23862,12 +23865,17 @@ async function getCloudBaseManager(options = {}) {
23862
23865
  }
23863
23866
  // envId priority: envManager.cachedEnvId > envManager.getEnvId() > loginState.envId > undefined
23864
23867
  // Note: envManager.cachedEnvId has highest priority as it reflects user's latest environment switch
23868
+ // Region priority: process.env.TCB_REGION > undefined (use SDK default)
23869
+ // At this point, cloudBaseOptions is undefined (checked above), so only use env var if present
23870
+ // Reuse region variable declared above (line 259) for CloudBase initialization
23865
23871
  const manager = new manager_node_1.default({
23866
23872
  secretId,
23867
23873
  secretKey,
23868
23874
  envId: finalEnvId || loginEnvId,
23869
23875
  token,
23870
23876
  proxy: process.env.http_proxy,
23877
+ region,
23878
+ // REGION 国际站需要指定 region
23871
23879
  });
23872
23880
  return manager;
23873
23881
  }
@@ -23877,15 +23885,18 @@ async function getCloudBaseManager(options = {}) {
23877
23885
  }
23878
23886
  }
23879
23887
  /**
23880
- * 使用传入的 CloudBase 配置创建 manager,不使用缓存
23881
- * @param cloudBaseOptions 传入的 CloudBase 配置选项
23882
- * @returns CloudBase manager 实例
23888
+ * Create a manager with the provided CloudBase options, without using cache
23889
+ * @param cloudBaseOptions Provided CloudBase options
23890
+ * @returns CloudBase manager instance
23883
23891
  */
23884
23892
  function createCloudBaseManagerWithOptions(cloudBaseOptions) {
23885
- (0, logger_js_1.debug)('使用传入的 CloudBase 配置创建 manager:', cloudBaseOptions);
23893
+ (0, logger_js_1.debug)('Create manager with provided CloudBase options:', cloudBaseOptions);
23894
+ // Region priority: cloudBaseOptions.region > process.env.TCB_REGION > undefined (use SDK default)
23895
+ const region = cloudBaseOptions.region ?? process.env.TCB_REGION ?? undefined;
23886
23896
  const manager = new manager_node_1.default({
23887
23897
  ...cloudBaseOptions,
23888
23898
  proxy: cloudBaseOptions.proxy || process.env.http_proxy,
23899
+ region
23889
23900
  });
23890
23901
  return manager;
23891
23902
  }
@@ -24095,9 +24106,14 @@ async function _promptAndSetEnvironmentId(autoSelectSingle, options) {
24095
24106
  }
24096
24107
  // 1. 确保用户已登录
24097
24108
  (0, logger_js_1.debug)("[interactive] Step 1: Checking login state...");
24109
+ // Get region from server options or environment variable for auth URL
24110
+ // Note: serverCloudBaseOptions will be declared later (line 282), so we get it here first
24111
+ const serverCloudBaseOptionsForAuth = server?.cloudBaseOptions;
24112
+ const region = serverCloudBaseOptionsForAuth?.region || process.env.TCB_REGION;
24098
24113
  const loginState = await (0, auth_js_1.getLoginState)({
24099
24114
  fromCloudBaseLoginPage: options?.loginFromCloudBaseLoginPage,
24100
24115
  ignoreEnvVars: options?.ignoreEnvVars,
24116
+ region,
24101
24117
  });
24102
24118
  (0, logger_js_1.debug)("[interactive] Login state:", {
24103
24119
  hasLoginState: !!loginState,
@@ -24129,6 +24145,14 @@ async function _promptAndSetEnvironmentId(autoSelectSingle, options) {
24129
24145
  cloudBaseOptions: serverCloudBaseOptions,
24130
24146
  });
24131
24147
  (0, logger_js_1.debug)("[interactive] CloudBase manager obtained");
24148
+ // If envId is already set, return directly
24149
+ const envId = serverCloudBaseOptions?.envId || process.env.CLOUDBASE_ENV_ID;
24150
+ if (envId) {
24151
+ return {
24152
+ selectedEnvId: envId,
24153
+ cancelled: false,
24154
+ };
24155
+ }
24132
24156
  // Step 2.1: Check and initialize TCB service if needed
24133
24157
  // Check if retry is requested (from interactive server session data)
24134
24158
  // Ensure server is resolved if it's a Promise (CLI mode)
@@ -24202,7 +24226,7 @@ async function _promptAndSetEnvironmentId(autoSelectSingle, options) {
24202
24226
  let queryEnvSuccess = false;
24203
24227
  let queryEnvError;
24204
24228
  try {
24205
- // Use commonService to call DescribeEnvs with filter parameters
24229
+ // Use Service to call DescribeEnvs with filter parameters
24206
24230
  // Filter parameters match the reference conditions provided by user
24207
24231
  const queryParams = {
24208
24232
  EnvTypes: ["weda", "baas"], // Include weda and baas (normal) environments
@@ -24210,7 +24234,7 @@ async function _promptAndSetEnvironmentId(autoSelectSingle, options) {
24210
24234
  Channels: ["dcloud", "iotenable", "tem", "scene_module"], // Filter special channels
24211
24235
  };
24212
24236
  (0, logger_js_1.debug)("[interactive] DescribeEnvs params:", queryParams);
24213
- envResult = await cloudbase.commonService("tcb").call({
24237
+ envResult = await cloudbase.commonService("tcb", "2018-06-08").call({
24214
24238
  Action: "DescribeEnvs",
24215
24239
  Param: queryParams,
24216
24240
  });
@@ -24338,7 +24362,7 @@ async function _promptAndSetEnvironmentId(autoSelectSingle, options) {
24338
24362
  // Sometimes creation is async and env might not be immediately available
24339
24363
  (0, logger_js_1.debug)("[interactive] Verifying created environment exists in list...");
24340
24364
  try {
24341
- const verifyResult = await cloudbase.commonService("tcb").call({
24365
+ const verifyResult = await cloudbase.commonService("tcb", "2018-06-08").call({
24342
24366
  Action: "DescribeEnvs",
24343
24367
  Param: {
24344
24368
  EnvTypes: ["weda", "baas"],
@@ -24523,6 +24547,15 @@ async function _promptAndSetEnvironmentId(autoSelectSingle, options) {
24523
24547
  accountInfo.uin = String(loginState.uin);
24524
24548
  (0, logger_js_1.debug)("[interactive] Using UIN from loginState:", { uin: accountInfo.uin });
24525
24549
  }
24550
+ // Attach region from server options or environment variable fallback
24551
+ // Reuse serverCloudBaseOptions declared earlier (line 278)
24552
+ const currentServerCloudBaseOptions = server?.cloudBaseOptions;
24553
+ if (currentServerCloudBaseOptions?.region) {
24554
+ accountInfo.region = currentServerCloudBaseOptions.region;
24555
+ }
24556
+ else if (process.env.TCB_REGION) {
24557
+ accountInfo.region = process.env.TCB_REGION;
24558
+ }
24526
24559
  // Report display_env_selection event
24527
24560
  await telemetry_js_1.telemetryReporter.report('toolkit_env_setup', {
24528
24561
  step: 'display_env_selection',
@@ -33396,7 +33429,7 @@ async function checkAndInitTcbService(cloudbase, context) {
33396
33429
  uin: newContext.uin,
33397
33430
  tcbServiceChecked: newContext.tcbServiceChecked
33398
33431
  });
33399
- const checkResult = await cloudbase.commonService("tcb").call({
33432
+ const checkResult = await cloudbase.commonService("tcb", "2018-06-08").call({
33400
33433
  Action: "CheckTcbService",
33401
33434
  Param: {}
33402
33435
  });
@@ -33417,7 +33450,7 @@ async function checkAndInitTcbService(cloudbase, context) {
33417
33450
  (0, logger_js_1.debug)('[env-setup] TCB service not initialized, attempting to initialize...');
33418
33451
  (0, logger_js_1.debug)('[env-setup] InitTcb params:', { Source: "qcloud", Channel: "mcp" });
33419
33452
  try {
33420
- const initResult = await cloudbase.commonService("tcb").call({
33453
+ const initResult = await cloudbase.commonService("tcb", "2018-06-08").call({
33421
33454
  Action: "InitTcb",
33422
33455
  Param: {
33423
33456
  Source: "qcloud",
@@ -33505,7 +33538,7 @@ async function checkAndCreateFreeEnv(cloudbase, context) {
33505
33538
  (0, logger_js_1.debug)('[env-setup] DescribeUserPromotionalActivity params:', {
33506
33539
  Names: ["NewUser", "ReturningUser", "BaasFree"]
33507
33540
  });
33508
- const activityResult = await cloudbase.commonService("tcb").call({
33541
+ const activityResult = await cloudbase.commonService("tcb", "2018-06-08").call({
33509
33542
  Action: "DescribeUserPromotionalActivity",
33510
33543
  Param: {
33511
33544
  Names: ["NewUser", "ReturningUser", "BaasFree"]
@@ -33556,7 +33589,7 @@ async function checkAndCreateFreeEnv(cloudbase, context) {
33556
33589
  Source: "qcloud"
33557
33590
  };
33558
33591
  (0, logger_js_1.debug)('[env-setup] CreateFreeEnvByActivity params:', createParams);
33559
- const createResult = await cloudbase.commonService("tcb").call({
33592
+ const createResult = await cloudbase.commonService("tcb", "2018-06-08").call({
33560
33593
  Action: "CreateFreeEnvByActivity",
33561
33594
  Param: createParams
33562
33595
  });
@@ -33701,7 +33734,9 @@ async function checkAndCreateFreeEnv(cloudbase, context) {
33701
33734
  */
33702
33735
  async function getUinForTelemetry() {
33703
33736
  try {
33704
- const loginState = await (0, auth_js_1.getLoginState)();
33737
+ // Get region from environment variable for auth URL
33738
+ const region = process.env.TCB_REGION;
33739
+ const loginState = await (0, auth_js_1.getLoginState)({ region });
33705
33740
  // Try to extract UIN from loginState
33706
33741
  // Note: actual field name may vary, adjust based on actual response
33707
33742
  return loginState.uin || undefined;
@@ -40387,7 +40422,7 @@ function registerSQLDatabaseTools(server) {
40387
40422
  // TODO: 考虑是否有支持指定其他 instance、schema 的需求
40388
40423
  const schemaId = envId;
40389
40424
  const instanceId = "default";
40390
- const result = await cloudbase.commonService("tcb").call({
40425
+ const result = await cloudbase.commonService("tcb", "2018-06-08").call({
40391
40426
  Action: "RunSql",
40392
40427
  Param: {
40393
40428
  EnvId: envId,
@@ -40451,7 +40486,7 @@ function registerSQLDatabaseTools(server) {
40451
40486
  // TODO: 考虑是否有支持指定其他 instance、schema 的需求
40452
40487
  const schemaId = envId;
40453
40488
  const instanceId = "default";
40454
- const result = await cloudbase.commonService("tcb").call({
40489
+ const result = await cloudbase.commonService("tcb", "2018-06-08").call({
40455
40490
  Action: "RunSql",
40456
40491
  Param: {
40457
40492
  EnvId: envId,
@@ -89128,12 +89163,12 @@ function registerFunctionTools(server) {
89128
89163
  // getFunctionList - 获取云函数列表或详情(推荐)
89129
89164
  server.registerTool?.("getFunctionList", {
89130
89165
  title: "查询云函数列表或详情",
89131
- description: "获取云函数列表或单个函数详情,通过 action 参数区分操作类型",
89166
+ description: "获取云函数列表或单个函数详情。通过 action 参数区分操作类型:list=获取函数列表(默认,无需额外参数),detail=获取函数详情(需要提供 name 参数指定函数名称)",
89132
89167
  inputSchema: {
89133
- action: zod_1.z.enum(["list", "detail"]).optional().describe("操作类型:list=获取函数列表(默认),detail=获取函数详情"),
89168
+ action: zod_1.z.enum(["list", "detail"]).optional().describe("操作类型:list=获取函数列表(默认,无需额外参数),detail=获取函数详情(需要提供 name 参数)"),
89134
89169
  limit: zod_1.z.number().optional().describe("范围(list 操作时使用)"),
89135
89170
  offset: zod_1.z.number().optional().describe("偏移(list 操作时使用)"),
89136
- name: zod_1.z.string().optional().describe("函数名称(detail 操作时必需)"),
89171
+ name: zod_1.z.string().optional().describe("要查询的函数名称。当 action='detail' 时,此参数为必填项,必须提供已存在的函数名称。可通过 action='list' 操作获取可用的函数名称列表"),
89137
89172
  codeSecret: zod_1.z.string().optional().describe("代码保护密钥(detail 操作时使用)")
89138
89173
  },
89139
89174
  annotations: {
@@ -89373,17 +89408,30 @@ function registerFunctionTools(server) {
89373
89408
  }
89374
89409
  }, async ({ name, params }) => {
89375
89410
  // 使用闭包中的 cloudBaseOptions
89376
- const cloudbase = await getManager();
89377
- const result = await cloudbase.functions.invokeFunction(name, params);
89378
- (0, cloudbase_manager_js_1.logCloudBaseResult)(server.logger, result);
89379
- return {
89380
- content: [
89381
- {
89382
- type: "text",
89383
- text: JSON.stringify(result, null, 2)
89384
- }
89385
- ]
89386
- };
89411
+ try {
89412
+ const cloudbase = await getManager();
89413
+ const result = await cloudbase.functions.invokeFunction(name, params);
89414
+ (0, cloudbase_manager_js_1.logCloudBaseResult)(server.logger, result);
89415
+ return {
89416
+ content: [
89417
+ {
89418
+ type: "text",
89419
+ text: JSON.stringify(result, null, 2)
89420
+ }
89421
+ ]
89422
+ };
89423
+ }
89424
+ catch (error) {
89425
+ const errorMessage = (error instanceof Error ? error.message : String(error));
89426
+ if (errorMessage.includes("Function not found") ||
89427
+ errorMessage.includes("函数不存在")) {
89428
+ throw new Error(`${errorMessage}\n\n` +
89429
+ `Tip: "invokeFunction" can only call deployed cloud functions. ` +
89430
+ `For database operations (such as creating collections), ` +
89431
+ `please use the appropriate database tools instead.`);
89432
+ }
89433
+ throw error;
89434
+ }
89387
89435
  });
89388
89436
  // getFunctionLogs - 获取云函数日志(新版,参数直接展开)
89389
89437
  server.registerTool?.("getFunctionLogs", {
@@ -102398,6 +102446,7 @@ const invite_code_js_1 = __webpack_require__(44760);
102398
102446
  const security_rule_js_1 = __webpack_require__(7862);
102399
102447
  const cloud_mode_js_1 = __webpack_require__(89684);
102400
102448
  const logger_js_1 = __webpack_require__(13039);
102449
+ const tencet_cloud_js_1 = __webpack_require__(95018);
102401
102450
  const tool_wrapper_js_1 = __webpack_require__(71363);
102402
102451
  // 默认插件列表
102403
102452
  const DEFAULT_PLUGINS = [
@@ -102417,7 +102466,11 @@ const DEFAULT_PLUGINS = [
102417
102466
  "capi",
102418
102467
  ];
102419
102468
  function registerDatabase(server) {
102420
- (0, databaseNoSQL_js_1.registerDatabaseTools)(server);
102469
+ // Skip NoSQL database tools for international region (Singapore) as it doesn't support NoSQL DB
102470
+ const region = server.cloudBaseOptions?.region || process.env.TCB_REGION;
102471
+ if (!(0, tencet_cloud_js_1.isInternationalRegion)(region)) {
102472
+ (0, databaseNoSQL_js_1.registerDatabaseTools)(server);
102473
+ }
102421
102474
  (0, databaseSQL_js_1.registerSQLDatabaseTools)(server);
102422
102475
  (0, dataModel_js_1.registerDataModelTools)(server);
102423
102476
  }
@@ -108819,12 +108872,12 @@ function registerDataModelTools(server) {
108819
108872
  // 数据模型查询工具
108820
108873
  server.registerTool?.("manageDataModel", {
108821
108874
  title: "数据模型管理",
108822
- description: "数据模型查询工具,支持查询和列表数据模型(只读操作)。list操作返回基础信息(不含Schema),get操作返回详细信息(含简化的Schema,包括字段列表、格式、关联关系等),docs操作生成SDK使用文档",
108875
+ description: "数据模型查询工具,支持查询和列表数据模型(只读操作)。通过 action 参数区分操作类型:list=获取模型列表(不含Schema,可选 names 参数过滤),get=查询单个模型详情(含Schema字段列表、格式、关联关系等,需要提供 name 参数),docs=生成SDK使用文档(需要提供 name 参数)",
108823
108876
  inputSchema: {
108824
108877
  action: zod_1.z
108825
108878
  .enum(["get", "list", "docs"])
108826
- .describe("操作类型:get=查询单个模型(含Schema字段列表、格式、关联关系),list=获取模型列表(不含Schema),docs=生成SDK使用文档"),
108827
- name: zod_1.z.string().optional().describe("模型名称(get操作时必填)"),
108879
+ .describe("操作类型:get=查询单个模型(含Schema字段列表、格式、关联关系,需要提供 name 参数),list=获取模型列表(不含Schema,可选 names 参数过滤),docs=生成SDK使用文档(需要提供 name 参数)"),
108880
+ name: zod_1.z.string().optional().describe("要查询的数据模型名称。当 action='get' 或 action='docs' 时,此参数为必填项,必须提供已存在的数据模型名称。可通过 action='list' 操作获取可用的模型名称列表"),
108828
108881
  names: zod_1.z
108829
108882
  .array(zod_1.z.string())
108830
108883
  .optional()
@@ -125414,7 +125467,6 @@ const cloudbase_manager_js_1 = __webpack_require__(3431);
125414
125467
  const CATEGORY = "cloud-api";
125415
125468
  const ALLOWED_SERVICES = [
125416
125469
  "tcb",
125417
- "flexdb",
125418
125470
  "scf",
125419
125471
  "sts",
125420
125472
  "cam",
@@ -125437,7 +125489,7 @@ function registerCapiTools(server) {
125437
125489
  inputSchema: {
125438
125490
  service: zod_1.z
125439
125491
  .enum(ALLOWED_SERVICES)
125440
- .describe("选择要访问的服务,必须先查看规则/技能确认是否可用。可选:tcb、flexdb、scf、sts、cam、lowcode、cdn、vpc。"),
125492
+ .describe("选择要访问的服务,必须先查看规则/技能确认是否可用。可选:tcb、scf、sts、cam、lowcode、cdn、vpc。"),
125441
125493
  action: zod_1.z
125442
125494
  .string()
125443
125495
  .min(1)
@@ -137058,7 +137110,7 @@ class TelemetryReporter {
137058
137110
  const nodeVersion = process.version; // Node.js版本
137059
137111
  const arch = os_1.default.arch(); // 系统架构
137060
137112
  // 从构建时注入的版本号获取MCP版本信息
137061
- const mcpVersion = process.env.npm_package_version || "2.7.7" || 0;
137113
+ const mcpVersion = process.env.npm_package_version || "2.9.0" || 0;
137062
137114
  return {
137063
137115
  userAgent: `${osType} ${osRelease} ${arch} ${nodeVersion} CloudBase-MCP/${mcpVersion}`,
137064
137116
  deviceId: this.deviceId,
@@ -196594,7 +196646,7 @@ function renderHeader(accountInfo, ide) {
196594
196646
  <img class="logo" src="https://7463-tcb-advanced-a656fc-1257967285.tcb.qcloud.la/mcp/cloudbase-logo.svg" alt="CloudBase Logo" />
196595
196647
  <span class="title">CloudBase</span>
196596
196648
  </div>
196597
- ${hasAccount ? `
196649
+ ${(hasAccount && accountInfo.region !== 'ap-singapore') ? /** 国际站不支持切 */ `
196598
196650
  <div class="header-right">
196599
196651
  <div class="account-section">
196600
196652
  <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5">
@@ -196602,6 +196654,7 @@ function renderHeader(accountInfo, ide) {
196602
196654
  <circle cx="12" cy="7" r="4"/>
196603
196655
  </svg>
196604
196656
  <span class="account-uin">${accountInfo.uin}</span>
196657
+ ${accountInfo.region ? `<span class="account-region">${accountInfo.region}</span>` : ''}
196605
196658
  ${!isCodeBuddy ? `
196606
196659
  <button class="btn-switch" onclick="switchAccount()" title="切换账号">
196607
196660
  <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5">
@@ -203629,7 +203682,7 @@ ${envIdSection}
203629
203682
  ## 环境信息
203630
203683
  - 操作系统: ${os_1.default.type()} ${os_1.default.release()}
203631
203684
  - Node.js版本: ${process.version}
203632
- - MCP 版本:${process.env.npm_package_version || "2.7.7" || 0}
203685
+ - MCP 版本:${process.env.npm_package_version || "2.9.0" || 0}
203633
203686
  - 系统架构: ${os_1.default.arch()}
203634
203687
  - 时间: ${new Date().toISOString()}
203635
203688
  - 请求ID: ${requestId}
@@ -211897,8 +211950,8 @@ updateCollection: 更新集合`),
211897
211950
  const instanceId = await getDatabaseInstanceId(getManager);
211898
211951
  // 兼容对象和字符串
211899
211952
  const toJSONString = (v) => typeof v === "object" && v !== null ? JSON.stringify(v) : v;
211900
- const result = await cloudbase.commonService("flexdb").call({
211901
- Action: "Query",
211953
+ const result = await cloudbase.commonService("tcb", "2018-06-08").call({
211954
+ Action: "QueryRecords",
211902
211955
  Param: {
211903
211956
  TableName: collectionName,
211904
211957
  MgoQuery: toJSONString(query),
@@ -212052,7 +212105,7 @@ async function insertDocuments({ collectionName, documents, getManager, logger,
212052
212105
  const instanceId = await getDatabaseInstanceId(getManager);
212053
212106
  // 将对象数组序列化为字符串数组
212054
212107
  const docsAsStrings = documents.map((doc) => JSON.stringify(doc));
212055
- const result = await cloudbase.commonService("flexdb").call({
212108
+ const result = await cloudbase.commonService("tcb", "2018-06-08").call({
212056
212109
  Action: "PutItem",
212057
212110
  Param: {
212058
212111
  TableName: collectionName,
@@ -212081,7 +212134,7 @@ async function updateDocuments({ collectionName, query, update, isMulti, upsert,
212081
212134
  const cloudbase = await getManager();
212082
212135
  const instanceId = await getDatabaseInstanceId(getManager);
212083
212136
  const toJSONString = (v) => typeof v === "object" && v !== null ? JSON.stringify(v) : v;
212084
- const result = await cloudbase.commonService("flexdb").call({
212137
+ const result = await cloudbase.commonService("tcb", "2018-06-08").call({
212085
212138
  Action: "UpdateItem",
212086
212139
  Param: {
212087
212140
  TableName: collectionName,
@@ -212115,7 +212168,7 @@ async function deleteDocuments({ collectionName, query, isMulti, getManager, log
212115
212168
  const cloudbase = await getManager();
212116
212169
  const instanceId = await getDatabaseInstanceId(getManager);
212117
212170
  const toJSONString = (v) => typeof v === "object" && v !== null ? JSON.stringify(v) : v;
212118
- const result = await cloudbase.commonService("flexdb").call({
212171
+ const result = await cloudbase.commonService("tcb", "2018-06-08").call({
212119
212172
  Action: "DeleteItem",
212120
212173
  Param: {
212121
212174
  TableName: collectionName,
@@ -218385,15 +218438,14 @@ function registerSetupTools(server) {
218385
218438
  title: "下载项目模板",
218386
218439
  description: `自动下载并部署CloudBase项目模板。⚠️ **MANDATORY FOR NEW PROJECTS** ⚠️
218387
218440
 
218388
- **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- 其他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.7.7" : 0}),便于后续维护和版本追踪\n- 下载 rules 模板时,如果项目中已存在 README.md 文件,系统会自动保护该文件不被覆盖(除非设置 overwrite=true)`,
218441
+ **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- 其他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.9.0" : 0}),便于后续维护和版本追踪\n- 下载 rules 模板时,如果项目中已存在 README.md 文件,系统会自动保护该文件不被覆盖(除非设置 overwrite=true)`,
218389
218442
  inputSchema: {
218390
218443
  template: zod_1.z
218391
218444
  .enum(["react", "vue", "miniprogram", "uniapp", "rules"])
218392
218445
  .describe("要下载的模板类型"),
218393
218446
  ide: zod_1.z
218394
218447
  .enum(IDE_TYPES)
218395
- .optional()
218396
- .describe("指定要下载的IDE类型。如果未指定,会根据 INTEGRATION_IDE 环境变量自动选择对应的IDE配置;如果环境变量也未设置,则必须传入此参数"),
218448
+ .describe("指定要下载的IDE类型。"),
218397
218449
  overwrite: zod_1.z
218398
218450
  .boolean()
218399
218451
  .optional()
@@ -218408,7 +218460,7 @@ function registerSetupTools(server) {
218408
218460
  },
218409
218461
  }, async ({ template, ide, overwrite = false, }) => {
218410
218462
  try {
218411
- const ideResolution = resolveDownloadTemplateIDE(ide, process.env.INTEGRATION_IDE);
218463
+ const ideResolution = resolveDownloadTemplateIDE(ide, undefined);
218412
218464
  if (!ideResolution.ok) {
218413
218465
  const supportedIDEs = ideResolution.supportedIDEs.join(", ");
218414
218466
  if (ideResolution.reason === "unmapped_integration_ide") {
@@ -219682,6 +219734,7 @@ exports.getLoginState = getLoginState;
219682
219734
  exports.logout = logout;
219683
219735
  const toolbox_1 = __webpack_require__(25901);
219684
219736
  const logger_js_1 = __webpack_require__(13039);
219737
+ const tencet_cloud_js_1 = __webpack_require__(95018);
219685
219738
  const auth = toolbox_1.AuthSupevisor.getInstance({});
219686
219739
  async function getLoginState(options) {
219687
219740
  const { TENCENTCLOUD_SECRETID, TENCENTCLOUD_SECRETKEY, TENCENTCLOUD_SESSIONTOKEN, } = process.env;
@@ -219699,9 +219752,10 @@ async function getLoginState(options) {
219699
219752
  }
219700
219753
  const loginState = await auth.getLoginState();
219701
219754
  if (!loginState) {
219702
- await auth.loginByWebAuth(options?.fromCloudBaseLoginPage
219755
+ await auth.loginByWebAuth((options?.fromCloudBaseLoginPage && !(0, tencet_cloud_js_1.isInternationalRegion)(options?.region))
219703
219756
  ? {
219704
219757
  getAuthUrl: (url) => {
219758
+ // 国际站
219705
219759
  const separator = url.includes('?') ? '&' : '?';
219706
219760
  const urlWithParam = `${url}${separator}allowNoEnv=true`;
219707
219761
  return `https://tcb.cloud.tencent.com/login?_redirect_uri=${encodeURIComponent(urlWithParam)}`;
@@ -219709,6 +219763,9 @@ async function getLoginState(options) {
219709
219763
  }
219710
219764
  : {
219711
219765
  getAuthUrl: (url) => {
219766
+ if ((0, tencet_cloud_js_1.isInternationalRegion)(options?.region)) {
219767
+ url = url.replace('cloud.tencent.com', 'tencentcloud.com');
219768
+ }
219712
219769
  const separator = url.includes('?') ? '&' : '?';
219713
219770
  return `${url}${separator}allowNoEnv=true`;
219714
219771
  },
@@ -256605,7 +256662,7 @@ class InteractiveServer {
256605
256662
  IsVisible: false,
256606
256663
  Channels: ["dcloud", "iotenable", "tem", "scene_module"],
256607
256664
  };
256608
- envResult = await sessionData.manager.commonService("tcb").call({
256665
+ envResult = await sessionData.manager.commonService("tcb", "2018-06-08").call({
256609
256666
  Action: "DescribeEnvs",
256610
256667
  Param: queryParams,
256611
256668
  });
@@ -266628,6 +266685,27 @@ function pauseStreams (streams, options) {
266628
266685
  }
266629
266686
 
266630
266687
 
266688
+ /***/ }),
266689
+
266690
+ /***/ 95018:
266691
+ /***/ ((__unused_webpack_module, exports) => {
266692
+
266693
+ "use strict";
266694
+
266695
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
266696
+ exports.isInternationalRegion = void 0;
266697
+ exports.isValidRegion = isValidRegion;
266698
+ const REGION = {
266699
+ SHANGHAI: 'ap-shanghai',
266700
+ SINGAPORE: 'ap-singapore',
266701
+ };
266702
+ const isInternationalRegion = (region) => region === REGION.SINGAPORE;
266703
+ exports.isInternationalRegion = isInternationalRegion;
266704
+ function isValidRegion(region) {
266705
+ return Object.values(REGION).includes(region);
266706
+ }
266707
+
266708
+
266631
266709
  /***/ }),
266632
266710
 
266633
266711
  /***/ 95026: