@cloudbase/cloudbase-mcp 2.17.1 → 2.18.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.js CHANGED
@@ -171,6 +171,7 @@ function formatDeviceAuthHint(deviceAuthInfo) {
171
171
  if (!deviceAuthInfo) {
172
172
  return "";
173
173
  }
174
+ const verificationUriComplete = (0, auth_js_1.buildVerificationUriComplete)(deviceAuthInfo);
174
175
  const lines = [
175
176
  "",
176
177
  "### Device Flow 授权信息",
@@ -179,8 +180,11 @@ function formatDeviceAuthHint(deviceAuthInfo) {
179
180
  if (deviceAuthInfo.verification_uri) {
180
181
  lines.push(`- verification_uri: ${deviceAuthInfo.verification_uri}`);
181
182
  }
183
+ if (verificationUriComplete) {
184
+ lines.push(`- verification_uri_complete: ${verificationUriComplete}`);
185
+ }
182
186
  lines.push(`- expires_in: ${deviceAuthInfo.expires_in}s`);
183
- lines.push("", "请在另一台可用浏览器设备打开 `verification_uri` 并输入 `user_code` 完成授权。");
187
+ lines.push("", "请优先向用户展示完整的 `verification_uri_complete`,不要截断或改写 URL。");
184
188
  return lines.join("\n");
185
189
  }
186
190
  function emitDeviceAuthNotice(server, deviceAuthInfo) {
@@ -606,13 +610,7 @@ function registerEnvTools(server) {
606
610
  (0, auth_js_1.setPendingAuthProgressState)(info, "device");
607
611
  // emitDeviceAuthNotice(server, info);
608
612
  };
609
- const authChallenge = () => deviceAuthInfo
610
- ? {
611
- user_code: deviceAuthInfo.user_code,
612
- verification_uri: deviceAuthInfo.verification_uri,
613
- expires_in: deviceAuthInfo.expires_in,
614
- }
615
- : undefined;
613
+ const authChallenge = () => (0, auth_js_1.buildDeviceAuthChallengePayload)(deviceAuthInfo);
616
614
  try {
617
615
  if (!supportedAuthActions.includes(action)) {
618
616
  return (0, tool_result_js_1.buildJsonToolResult)({
@@ -659,12 +657,8 @@ function registerEnvTools(server) {
659
657
  current_env_id: null,
660
658
  ...buildEnvCandidatePayload([]),
661
659
  }),
662
- auth_challenge: authFlowState.status === "PENDING" && authFlowState.authChallenge
663
- ? {
664
- user_code: authFlowState.authChallenge.user_code,
665
- verification_uri: authFlowState.authChallenge.verification_uri,
666
- expires_in: authFlowState.authChallenge.expires_in,
667
- }
660
+ auth_challenge: authFlowState.status === "PENDING"
661
+ ? (0, auth_js_1.buildDeviceAuthChallengePayload)(authFlowState.authChallenge)
668
662
  : undefined,
669
663
  message,
670
664
  next_step: authStatus === "REQUIRED"
@@ -685,11 +679,7 @@ function registerEnvTools(server) {
685
679
  ok: true,
686
680
  code: "AUTH_PENDING",
687
681
  message: "设备码授权进行中,请在浏览器中打开 verification_uri 并输入 user_code 完成授权。",
688
- auth_challenge: {
689
- user_code: authFlowState.authChallenge.user_code,
690
- verification_uri: authFlowState.authChallenge.verification_uri,
691
- expires_in: authFlowState.authChallenge.expires_in,
692
- },
682
+ auth_challenge: (0, auth_js_1.buildDeviceAuthChallengePayload)(authFlowState.authChallenge),
693
683
  next_step: (0, tool_result_js_1.buildAuthNextStep)("status", {
694
684
  suggestedArgs: { action: "status" },
695
685
  }),
@@ -1542,7 +1532,7 @@ ${envIdSection}
1542
1532
  ## 环境信息
1543
1533
  - 操作系统: ${os_1.default.type()} ${os_1.default.release()}
1544
1534
  - Node.js版本: ${process.version}
1545
- - MCP 版本:${process.env.npm_package_version || "2.17.1" || 0}
1535
+ - MCP 版本:${process.env.npm_package_version || "2.18.0" || 0}
1546
1536
  - 系统架构: ${os_1.default.arch()}
1547
1537
  - 时间: ${new Date().toISOString()}
1548
1538
  - 请求ID: ${requestId}
@@ -3249,13 +3239,7 @@ async function throwPendingAuthError() {
3249
3239
  ok: false,
3250
3240
  code: "AUTH_PENDING",
3251
3241
  message: authState.lastError || "设备码授权进行中,请先完成登录后再重试当前工具。",
3252
- auth_challenge: authState.authChallenge
3253
- ? {
3254
- user_code: authState.authChallenge.user_code,
3255
- verification_uri: authState.authChallenge.verification_uri,
3256
- expires_in: authState.authChallenge.expires_in,
3257
- }
3258
- : undefined,
3242
+ auth_challenge: (0, auth_js_1.buildDeviceAuthChallengePayload)(authState.authChallenge),
3259
3243
  next_step: (0, tool_result_js_1.buildAuthNextStep)("status", {
3260
3244
  suggestedArgs: {
3261
3245
  action: "status",
@@ -5333,10 +5317,10 @@ function registerDataModelTools(server) {
5333
5317
  throw new Error(`不支持的操作类型: ${action}`);
5334
5318
  }
5335
5319
  });
5336
- // modifyDataModel - 数据模型修改工具(创建/更新)
5320
+ // modifyDataModel - 数据模型写工具(兼容名称,当前仅支持创建)
5337
5321
  server.registerTool?.("modifyDataModel", {
5338
- title: "修改数据模型",
5339
- description: "基于Mermaid classDiagram创建或更新数据模型。支持创建新模型和更新现有模型结构。内置异步任务监控,自动轮询直至完成或超时。",
5322
+ title: "修改数据模型(当前仅支持创建)",
5323
+ description: "基于Mermaid classDiagram创建数据模型。为保持兼容性,工具名仍为 modifyDataModel;当前仅支持创建新模型,不支持更新现有模型结构。内置异步任务监控,自动轮询直至完成或超时。",
5340
5324
  inputSchema: {
5341
5325
  mermaidDiagram: zod_1.z.string()
5342
5326
  .describe(`Mermaid classDiagram代码,描述数据模型结构。
@@ -5496,10 +5480,10 @@ classDiagram
5496
5480
  status: status,
5497
5481
  action: action,
5498
5482
  message: status === "success"
5499
- ? `数据模型${action === "create" ? "创建" : "更新"}成功,共处理${models.length}个模型`
5483
+ ? `数据模型创建成功,共处理${models.length}个模型`
5500
5484
  : status === "init"
5501
5485
  ? `任务超时,任务ID: ${taskId},请稍后手动查询状态`
5502
- : `数据模型${action === "create" ? "创建" : "更新"}失败`,
5486
+ : `数据模型创建失败`,
5503
5487
  taskResult: statusResult?.Data,
5504
5488
  }, null, 2),
5505
5489
  },
@@ -7139,14 +7123,15 @@ exports.CLOUDRUN_SERVICE_TYPES = ['function', 'container'];
7139
7123
  exports.CLOUDRUN_ACCESS_TYPES = ['OA', 'PUBLIC', 'MINIAPP', 'VPC'];
7140
7124
  // Input schema for queryCloudRun tool
7141
7125
  const queryCloudRunInputSchema = {
7142
- action: zod_1.z.enum(['list', 'detail', 'templates']).describe('查询操作类型:list=获取云托管服务列表(支持分页和筛选),detail=查询指定服务的详细信息(包括配置、版本、访问地址等),templates=获取可用的项目模板列表(用于初始化新项目)'),
7126
+ action: zod_1.z.enum(['list', 'detail', 'templates', 'getDeployLog']).describe('查询操作类型:list=获取云托管服务列表(支持分页和筛选),detail=查询指定服务的详细信息(包含服务配置和最新部署状态),templates=获取可用的项目模板列表(用于初始化新项目),getDeployLog=获取指定服务最近一次或指定构建的部署日志'),
7143
7127
  // List operation parameters
7144
7128
  pageSize: zod_1.z.number().min(1).max(100).optional().default(10).describe('分页大小,控制每页返回的服务数量。取值范围:1-100,默认值:10。建议根据网络性能和显示需求调整'),
7145
7129
  pageNum: zod_1.z.number().min(1).optional().default(1).describe('页码,用于分页查询。从1开始,默认值:1。配合pageSize使用可实现分页浏览'),
7146
7130
  serverName: zod_1.z.string().optional().describe('服务名称筛选条件,支持模糊匹配。例如:输入"test"可匹配"test-service"、"my-test-app"等服务名称。留空则查询所有服务'),
7147
7131
  serverType: zod_1.z.enum(exports.CLOUDRUN_SERVICE_TYPES).optional().describe('服务类型筛选条件:function=函数型云托管(仅支持Node.js,有特殊的开发要求和限制,适合简单的API服务),container=容器型服务(推荐使用,支持任意语言和框架如Java/Go/Python/PHP/.NET等,适合大多数应用场景)'),
7148
- // Detail operation parameters
7149
- detailServerName: zod_1.z.string().optional().describe('要查询详细信息的服务名称。当action为detail时必需提供,必须是已存在的服务名称。可通过list操作获取可用的服务名称列表'),
7132
+ // Detail and log operation parameters
7133
+ detailServerName: zod_1.z.string().optional().describe('要查询详细信息或部署日志的服务名称。当action为detail或getDeployLog时建议提供,必须是已存在的服务名称。可通过list操作获取可用的服务名称列表'),
7134
+ buildId: zod_1.z.number().optional().describe('构建ID,仅在action=getDeployLog时使用。不传时默认返回最近一次部署的构建日志'),
7150
7135
  };
7151
7136
  // Input schema for manageCloudRun tool
7152
7137
  const ManageCloudRunInputSchema = {
@@ -7254,6 +7239,28 @@ function buildManageCloudRunErrorMessage(action, serverName, error) {
7254
7239
  }
7255
7240
  return `[manageCloudRun/${action}] ${baseMessage}\n建议:${suggestions.join(" ")}`;
7256
7241
  }
7242
+ function getCloudRunQueryServerName(input) {
7243
+ return input.detailServerName || input.serverName;
7244
+ }
7245
+ function normalizeProcessLogText(logs) {
7246
+ return logs
7247
+ .map((log) => {
7248
+ if (typeof log === "string") {
7249
+ return log;
7250
+ }
7251
+ if (log && typeof log === "object") {
7252
+ if ("Log" in log && typeof log.Log === "string") {
7253
+ return log.Log;
7254
+ }
7255
+ if ("Text" in log && typeof log.Text === "string") {
7256
+ return log.Text;
7257
+ }
7258
+ return JSON.stringify(log);
7259
+ }
7260
+ return String(log);
7261
+ })
7262
+ .join("\n");
7263
+ }
7257
7264
  /**
7258
7265
  * Format CloudRun service info for display
7259
7266
  */
@@ -7268,7 +7275,7 @@ function registerCloudRunTools(server) {
7268
7275
  // Tool 1: Get CloudRun service information (read operations)
7269
7276
  server.registerTool("queryCloudRun", {
7270
7277
  title: "查询 CloudRun 服务信息",
7271
- description: "查询云托管服务信息,支持获取服务列表、查询服务详情和获取可用模板列表。返回的服务信息包括服务名称、状态、访问类型、配置详情等。",
7278
+ description: "查询云托管服务信息,支持获取服务列表、查询服务详情、获取可用模板列表和部署日志。返回的服务信息包括服务名称、状态、访问类型、配置详情以及最近部署上下文。",
7272
7279
  inputSchema: queryCloudRunInputSchema,
7273
7280
  annotations: {
7274
7281
  readOnlyHint: true,
@@ -7317,7 +7324,21 @@ function registerCloudRunTools(server) {
7317
7324
  };
7318
7325
  }
7319
7326
  case 'detail': {
7320
- const serverName = input.detailServerName || input.serverName;
7327
+ const serverName = getCloudRunQueryServerName(input);
7328
+ if (!serverName) {
7329
+ return {
7330
+ content: [
7331
+ {
7332
+ type: "text",
7333
+ text: JSON.stringify({
7334
+ success: false,
7335
+ error: "detailServerName or serverName is required for detail action",
7336
+ message: "Please provide detailServerName or serverName."
7337
+ }, null, 2)
7338
+ }
7339
+ ]
7340
+ };
7341
+ }
7321
7342
  const result = await cloudrunService.detail({ serverName });
7322
7343
  if (!result) {
7323
7344
  return {
@@ -7333,6 +7354,30 @@ function registerCloudRunTools(server) {
7333
7354
  ]
7334
7355
  };
7335
7356
  }
7357
+ let latestDeploy = null;
7358
+ let deployRecordsWarning;
7359
+ let message;
7360
+ try {
7361
+ const deployRecords = await cloudrunService.getDeployRecords({ serverName });
7362
+ latestDeploy = deployRecords?.DeployRecords?.[0] ?? null;
7363
+ if (!latestDeploy) {
7364
+ message = `Retrieved details for service '${serverName}'. No deploy records found yet.`;
7365
+ }
7366
+ else if (typeof latestDeploy.Status === 'string' && latestDeploy.Status.includes('failed')) {
7367
+ message = `Service '${serverName}' latest deploy failed. Please use queryCloudRun(action="getDeployLog") for details.`;
7368
+ }
7369
+ else if (typeof latestDeploy.Status === 'string' && latestDeploy.Status.includes('creating')) {
7370
+ message = `Service '${serverName}' latest deploy is still running. Please check again later or query the deploy log for progress.`;
7371
+ }
7372
+ else {
7373
+ message = `Retrieved details for service '${serverName}'. Latest service status: ${result.BaseInfo?.Status || 'unknown'}, latest deploy status: ${latestDeploy.Status || 'unknown'}.`;
7374
+ }
7375
+ }
7376
+ catch (error) {
7377
+ const baseMessage = error instanceof Error ? error.message : String(error);
7378
+ deployRecordsWarning = `Failed to fetch deploy records: ${baseMessage}`;
7379
+ message = `Retrieved details for service '${serverName}', but deploy records are currently unavailable.`;
7380
+ }
7336
7381
  return {
7337
7382
  content: [
7338
7383
  {
@@ -7340,9 +7385,11 @@ function registerCloudRunTools(server) {
7340
7385
  text: JSON.stringify({
7341
7386
  success: true,
7342
7387
  data: {
7343
- service: result
7388
+ service: result,
7389
+ latestDeploy,
7390
+ ...(deployRecordsWarning ? { deployRecordsWarning } : {})
7344
7391
  },
7345
- message: `Retrieved details for service '${serverName}'`
7392
+ message
7346
7393
  }, null, 2)
7347
7394
  }
7348
7395
  ]
@@ -7365,6 +7412,79 @@ function registerCloudRunTools(server) {
7365
7412
  ]
7366
7413
  };
7367
7414
  }
7415
+ case 'getDeployLog': {
7416
+ const serverName = getCloudRunQueryServerName(input);
7417
+ if (!serverName) {
7418
+ return {
7419
+ content: [
7420
+ {
7421
+ type: "text",
7422
+ text: JSON.stringify({
7423
+ success: false,
7424
+ error: "detailServerName or serverName is required for getDeployLog action",
7425
+ message: "Please provide detailServerName or serverName."
7426
+ }, null, 2)
7427
+ }
7428
+ ]
7429
+ };
7430
+ }
7431
+ const deployRecords = await cloudrunService.getDeployRecords({ serverName });
7432
+ const latestDeploy = deployRecords?.DeployRecords?.[0];
7433
+ if (!latestDeploy) {
7434
+ return {
7435
+ content: [
7436
+ {
7437
+ type: "text",
7438
+ text: JSON.stringify({
7439
+ success: false,
7440
+ error: `Service '${serverName}' has no deploy records.`,
7441
+ message: "Please deploy the service first, then query the deploy log again."
7442
+ }, null, 2)
7443
+ }
7444
+ ]
7445
+ };
7446
+ }
7447
+ const buildId = input.buildId ?? latestDeploy.BuildId;
7448
+ const buildLogResult = await cloudrunService.getBuildLog({
7449
+ serverName,
7450
+ buildId,
7451
+ });
7452
+ let processLogs = [];
7453
+ let processLogsWarning;
7454
+ if (latestDeploy.RunId && typeof cloudrunService.getProcessLog === 'function') {
7455
+ try {
7456
+ const processLogResult = await cloudrunService.getProcessLog({
7457
+ RunId: latestDeploy.RunId,
7458
+ });
7459
+ processLogs = processLogResult?.Logs || [];
7460
+ }
7461
+ catch (error) {
7462
+ processLogsWarning = error instanceof Error ? error.message : String(error);
7463
+ }
7464
+ }
7465
+ const buildLogText = typeof buildLogResult?.Log?.Text === 'string' ? buildLogResult.Log.Text : '';
7466
+ const processLogText = Array.isArray(processLogs) && processLogs.length > 0 ? normalizeProcessLogText(processLogs) : '';
7467
+ const combinedLogText = [buildLogText, processLogText].filter(Boolean).join('\n');
7468
+ return {
7469
+ content: [
7470
+ {
7471
+ type: "text",
7472
+ text: JSON.stringify({
7473
+ success: true,
7474
+ data: {
7475
+ buildId,
7476
+ deployRecord: latestDeploy,
7477
+ buildLog: buildLogResult?.Log || null,
7478
+ processLogs,
7479
+ combinedLogText,
7480
+ ...(processLogsWarning ? { processLogsWarning } : {})
7481
+ },
7482
+ message: `Retrieved deploy log for service '${serverName}'`
7483
+ }, null, 2)
7484
+ }
7485
+ ]
7486
+ };
7487
+ }
7368
7488
  default:
7369
7489
  throw new Error(`Unsupported action: ${input.action}`);
7370
7490
  }
@@ -7632,6 +7752,7 @@ for await (let x of res.textStream) {
7632
7752
  name: input.serverName
7633
7753
  }
7634
7754
  };
7755
+ const consoleUrl = `https://tcb.cloud.tencent.com/dev?envId=${currentEnvId}#/platform-run/service/detail?serverName=${input.serverName}&tabId=overview&envId=${currentEnvId}`;
7635
7756
  try {
7636
7757
  fs_1.default.writeFileSync(cloudbasercPath, JSON.stringify(cloudbasercContent, null, 2));
7637
7758
  }
@@ -7675,8 +7796,6 @@ for await (let x of res.textStream) {
7675
7796
  }
7676
7797
  // Extract project name from targetPath
7677
7798
  const projectName = path_1.default.basename(targetPath);
7678
- // Build console URL
7679
- const consoleUrl = `https://tcb.cloud.tencent.com/dev?envId=${currentEnvId}#/platform-run/service/detail?serverName=${input.serverName}&tabId=overview&envId=${currentEnvId}`;
7680
7799
  // Send notification
7681
7800
  await (0, notification_js_1.sendDeployNotification)(server, {
7682
7801
  deployType: 'cloudrun',
@@ -7698,12 +7817,13 @@ for await (let x of res.textStream) {
7698
7817
  success: true,
7699
7818
  data: {
7700
7819
  serviceName: input.serverName,
7701
- status: 'deployed',
7820
+ status: 'deploying',
7702
7821
  deployPath: targetPath,
7703
7822
  serverType: serverType,
7704
- cloudbasercGenerated: true
7823
+ cloudbasercGenerated: true,
7824
+ consoleUrl
7705
7825
  },
7706
- message: `Successfully deployed ${serverType} service '${input.serverName}' from ${targetPath}`
7826
+ message: `Triggered deployment for ${serverType} service '${input.serverName}' from ${targetPath}. You can follow the progress in ${consoleUrl}`
7707
7827
  }, null, 2)
7708
7828
  }
7709
7829
  ]
@@ -8611,7 +8731,7 @@ class TelemetryReporter {
8611
8731
  const nodeVersion = process.version; // Node.js版本
8612
8732
  const arch = os_1.default.arch(); // 系统架构
8613
8733
  // 从构建时注入的版本号获取MCP版本信息
8614
- const mcpVersion = process.env.npm_package_version || "2.17.1" || 0;
8734
+ const mcpVersion = process.env.npm_package_version || "2.18.0" || 0;
8615
8735
  return {
8616
8736
  userAgent: `${osType} ${osRelease} ${arch} ${nodeVersion} CloudBase-MCP/${mcpVersion}`,
8617
8737
  deviceId: this.deviceId,
@@ -9931,13 +10051,13 @@ function registerFunctionTools(server) {
9931
10051
  .enum(exports.MANAGE_FUNCTION_ACTIONS)
9932
10052
  .describe("写操作类型,例如 createFunction、invokeFunction、attachLayer"),
9933
10053
  func: CREATE_FUNCTION_SCHEMA.optional().describe("createFunction 操作的函数配置"),
9934
- functionRootPath: zod_1.z.string().optional().describe("函数根目录(父目录绝对路径)。" +
10054
+ functionRootPath: zod_1.z.string().optional().describe("创建或更新函数代码时默认推荐的本地目录方式。函数根目录(父目录绝对路径)。" +
9935
10055
  "本地应按 cloudfunctions/<functionName>/index.js 布局," +
9936
10056
  "此参数传 cloudfunctions 目录的绝对路径(如 /abs/path/cloudfunctions),不要传到函数名子目录。" +
9937
- "SDK 会自动拼接函数名子目录。"),
10057
+ "SDK 会自动拼接函数名子目录,无需预先压缩 zip 或 base64 编码。"),
9938
10058
  force: zod_1.z.boolean().optional().describe("createFunction 时是否覆盖"),
9939
10059
  functionName: zod_1.z.string().optional().describe("函数名称。大多数 action 使用该字段作为统一目标"),
9940
- zipFile: zod_1.z.string().optional().describe("代码包的 base64 编码"),
10060
+ zipFile: zod_1.z.string().optional().describe("仅兼容特殊场景:预先准备好的代码包 base64 编码。普通 createFunction/updateFunctionCode 默认不要先压缩 zip,优先使用 functionRootPath。"),
9941
10061
  handler: zod_1.z.string().optional().describe("函数入口"),
9942
10062
  timeout: zod_1.z.number().optional().describe("配置更新时的超时时间"),
9943
10063
  envVariables: zod_1.z.record(zod_1.z.string()).optional().describe("配置更新时要合并的环境变量"),
@@ -11010,7 +11130,7 @@ function registerSetupTools(server) {
11010
11130
  title: "下载项目模板",
11011
11131
  description: `自动下载并部署CloudBase项目模板。⚠️ **MANDATORY FOR NEW PROJECTS** ⚠️
11012
11132
 
11013
- **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.17.1" : 0}),便于后续维护和版本追踪\n- 下载 rules 模板时,如果项目中已存在 README.md 文件,系统会自动保护该文件不被覆盖(除非设置 overwrite=true)`,
11133
+ **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.18.0" : 0}),便于后续维护和版本追踪\n- 下载 rules 模板时,如果项目中已存在 README.md 文件,系统会自动保护该文件不被覆盖(除非设置 overwrite=true)`,
11014
11134
  inputSchema: {
11015
11135
  template: zod_1.z
11016
11136
  .enum(["react", "vue", "miniprogram", "uniapp", "rules"])
@@ -12223,6 +12343,8 @@ function registerHostingTools(server) {
12223
12343
 
12224
12344
 
12225
12345
  Object.defineProperty(exports, "__esModule", ({ value: true }));
12346
+ exports.buildVerificationUriComplete = buildVerificationUriComplete;
12347
+ exports.buildDeviceAuthChallengePayload = buildDeviceAuthChallengePayload;
12226
12348
  exports.getAuthProgressStateSync = getAuthProgressStateSync;
12227
12349
  exports.getAuthProgressState = getAuthProgressState;
12228
12350
  exports.resolveAuthOptions = resolveAuthOptions;
@@ -12251,6 +12373,54 @@ function normalizeOptionalString(value) {
12251
12373
  const trimmed = value.trim();
12252
12374
  return trimmed.length > 0 ? trimmed : undefined;
12253
12375
  }
12376
+ function buildVerificationUriComplete(deviceAuthInfo) {
12377
+ const explicitComplete = normalizeOptionalString(deviceAuthInfo?.verification_uri_complete);
12378
+ if (explicitComplete) {
12379
+ return explicitComplete;
12380
+ }
12381
+ const verificationUri = normalizeOptionalString(deviceAuthInfo?.verification_uri);
12382
+ const userCode = normalizeOptionalString(deviceAuthInfo?.user_code);
12383
+ if (!verificationUri || !userCode) {
12384
+ return undefined;
12385
+ }
12386
+ try {
12387
+ const url = new URL(verificationUri);
12388
+ const hash = url.hash.startsWith("#") ? url.hash.slice(1) : url.hash;
12389
+ if (hash) {
12390
+ const [hashPath, hashQuery = ""] = hash.split("?");
12391
+ const hashParams = new URLSearchParams(hashQuery);
12392
+ if (!hashParams.has("user_code")) {
12393
+ hashParams.set("user_code", userCode);
12394
+ }
12395
+ url.hash = hashParams.toString()
12396
+ ? `#${hashPath}?${hashParams.toString()}`
12397
+ : `#${hashPath}`;
12398
+ return url.toString();
12399
+ }
12400
+ if (!url.searchParams.has("user_code")) {
12401
+ url.searchParams.set("user_code", userCode);
12402
+ }
12403
+ return url.toString();
12404
+ }
12405
+ catch {
12406
+ if (verificationUri.includes("user_code=")) {
12407
+ return verificationUri;
12408
+ }
12409
+ const separator = verificationUri.includes("?") ? "&" : "?";
12410
+ return `${verificationUri}${separator}user_code=${encodeURIComponent(userCode)}`;
12411
+ }
12412
+ }
12413
+ function buildDeviceAuthChallengePayload(deviceAuthInfo) {
12414
+ if (!deviceAuthInfo) {
12415
+ return undefined;
12416
+ }
12417
+ return {
12418
+ user_code: deviceAuthInfo.user_code,
12419
+ verification_uri: deviceAuthInfo.verification_uri,
12420
+ verification_uri_complete: buildVerificationUriComplete(deviceAuthInfo),
12421
+ expires_in: deviceAuthInfo.expires_in,
12422
+ };
12423
+ }
12254
12424
  function normalizeAuthMode(value) {
12255
12425
  return value === "web" || value === "device" ? value : undefined;
12256
12426
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cloudbase/cloudbase-mcp",
3
- "version": "2.17.1",
3
+ "version": "2.18.0",
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",