@cloudbase/cloudbase-mcp 2.21.0 → 2.21.1

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
@@ -117979,13 +117979,16 @@ async function resolveHostingStaticDomain(cloudbase, logger) {
117979
117979
  return undefined;
117980
117980
  }
117981
117981
  }
117982
- async function assertHostingUploadEnvironmentReady(cloudbase, cloudBaseOptions, logger) {
117982
+ // Returns the first hosting store record from DescribeStaticStore, which is
117983
+ // the authoritative source for Mini Program-sourced environments (those envs
117984
+ // do not populate StaticStorages in DescribeEnvs / getEnvInfo).
117985
+ // Throws when no valid store is found so upload can fail fast with a clear msg.
117986
+ async function getHostingStoreOrThrow(cloudbase, cloudBaseOptions, logger) {
117983
117987
  const envId = await (0, cloudbase_manager_js_1.getEnvId)(cloudBaseOptions);
117984
- const envInfo = await cloudbase.env.getEnvInfo();
117985
- (0, cloudbase_manager_js_1.logCloudBaseResult)(logger, envInfo);
117986
- const staticStorage = envInfo.EnvInfo?.StaticStorages?.[0];
117987
- if (staticStorage?.Bucket) {
117988
- return;
117988
+ const result = await callTcbHostingAction(cloudbase, 'DescribeStaticStore', { EnvId: envId }, logger);
117989
+ const hostingInfo = extractStaticStores(result);
117990
+ if (hostingInfo.length > 0 && hostingInfo[0].Bucket) {
117991
+ return hostingInfo[0];
117989
117992
  }
117990
117993
  throw new Error(`当前环境 ${envId} 未发现静态托管资源配置,无法上传文件。请先确认 MCP 已绑定到已开通静态托管的 CloudBase 环境;如需切换环境,请调用 auth(action="set_env", envId="目标环境ID") 后重试。`);
117991
117994
  }
@@ -118193,8 +118196,9 @@ function registerHostingTools(server) {
118193
118196
  throw new Error('manageHosting(action="upload") 需要提供 localPath + cloudPath,或提供 files 多文件上传列表。');
118194
118197
  }
118195
118198
  let result;
118199
+ let store;
118196
118200
  try {
118197
- await assertHostingUploadEnvironmentReady(cloudbase, cloudBaseOptions, server.logger);
118201
+ store = await getHostingStoreOrThrow(cloudbase, cloudBaseOptions, server.logger);
118198
118202
  result = await cloudbase.hosting.uploadFiles({
118199
118203
  localPath: input.localPath,
118200
118204
  cloudPath: input.cloudPath,
@@ -118206,7 +118210,11 @@ function registerHostingTools(server) {
118206
118210
  throw new Error(buildUploadErrorMessage(error, input.localPath));
118207
118211
  }
118208
118212
  (0, cloudbase_manager_js_1.logCloudBaseResult)(server.logger, result);
118209
- const staticDomain = await resolveHostingStaticDomain(cloudbase, server.logger);
118213
+ // Prefer CdnDomain from the DescribeStaticStore result we already
118214
+ // fetched; fall back to getEnvInfo for environments that populate
118215
+ // StaticDomain there but not in DescribeStaticStore.
118216
+ const cdnFromStore = (store.CdnDomain ?? store.StaticDomain);
118217
+ const staticDomain = cdnFromStore || await resolveHostingStaticDomain(cloudbase, server.logger);
118210
118218
  const accessUrl = buildHostingAccessUrl(staticDomain, input.cloudPath, input.localPath);
118211
118219
  try {
118212
118220
  const envId = await (0, cloudbase_manager_js_1.getEnvId)(cloudBaseOptions);
@@ -135149,7 +135157,7 @@ class TelemetryReporter {
135149
135157
  const nodeVersion = process.version; // Node.js版本
135150
135158
  const arch = os_1.default.arch(); // 系统架构
135151
135159
  // 从构建时注入的版本号获取MCP版本信息
135152
- const mcpVersion = process.env.npm_package_version || "2.21.0" || 0;
135160
+ const mcpVersion = process.env.npm_package_version || "2.21.1" || 0;
135153
135161
  return {
135154
135162
  userAgent: `${osType} ${osRelease} ${arch} ${nodeVersion} CloudBase-MCP/${mcpVersion}`,
135155
135163
  deviceId: this.deviceId,
@@ -180374,99 +180382,6 @@ async function downloadResources() {
180374
180382
  return resourceDownloadPromise;
180375
180383
  }
180376
180384
  async function registerRagTools(server) {
180377
- // 联网搜索
180378
- server.registerTool?.("searchWeb", {
180379
- title: "联网搜索",
180380
- description: "使用联网来进行信息检索,如查询最新的新闻、文章、股价、天气等。支持自然语言查询,也可以直接输入网址获取网页内容",
180381
- inputSchema: {
180382
- query: zod_1.z.string().describe("搜索关键词、问题或网址,支持自然语言"),
180383
- },
180384
- annotations: {
180385
- readOnlyHint: true,
180386
- openWorldHint: true,
180387
- category: "web",
180388
- },
180389
- }, async ({ query }) => {
180390
- try {
180391
- // 使用混元进行联网搜索
180392
- const signInRes = await fetch("https://tcb-advanced-a656fc.api.tcloudbasegateway.com/auth/v1/signin/anonymously", {
180393
- method: "POST",
180394
- headers: {
180395
- "Content-Type": "application/json",
180396
- Accept: "application/json",
180397
- "x-device-id": "cloudbase-ai-toolkit",
180398
- },
180399
- body: safeStringify({}),
180400
- });
180401
- const { access_token } = await signInRes.json();
180402
- // 调用混元API进行联网搜索
180403
- const searchRes = await fetch("https://tcb-advanced-a656fc.api.tcloudbasegateway.com/v1/ai/hunyuan-beta/openapi/v1/chat/completions", {
180404
- method: "POST",
180405
- headers: {
180406
- "Content-Type": "application/json",
180407
- Authorization: `Bearer ${access_token}`,
180408
- },
180409
- body: safeStringify({
180410
- model: "hunyuan",
180411
- messages: [
180412
- {
180413
- role: "user",
180414
- content: `你好,你将扮演一个知识库的角色,联网查询到问题的答案之后回答给我`,
180415
- },
180416
- {
180417
- role: "assistant",
180418
- content: "好的",
180419
- },
180420
- {
180421
- role: "user",
180422
- content: query,
180423
- },
180424
- ],
180425
- enable_enhancement: true,
180426
- search_info: true,
180427
- enable_speed_search: true,
180428
- force_search_enhancement: true,
180429
- }),
180430
- });
180431
- const result = await searchRes.json();
180432
- if (result.error) {
180433
- throw new Error(result.error.message || "联网搜索失败");
180434
- }
180435
- const content = result.choices?.[0]?.message?.content || "";
180436
- const searchResults = result.search_info?.search_results || [];
180437
- return {
180438
- content: [
180439
- {
180440
- type: "text",
180441
- text: safeStringify({
180442
- type: "web_search",
180443
- content: content,
180444
- search_results: searchResults.map((item) => ({
180445
- title: item.title,
180446
- url: item.url,
180447
- snippet: item.snippet,
180448
- })),
180449
- status: "success",
180450
- }),
180451
- },
180452
- ],
180453
- };
180454
- }
180455
- catch (error) {
180456
- return {
180457
- content: [
180458
- {
180459
- type: "text",
180460
- text: safeStringify({
180461
- type: "error",
180462
- message: error instanceof Error ? error.message : "联网搜索失败",
180463
- status: "error",
180464
- }),
180465
- },
180466
- ],
180467
- };
180468
- }
180469
- });
180470
180385
  let openapis = [];
180471
180386
  let skills = [];
180472
180387
  let fallbackSkillsRoot;
@@ -193754,7 +193669,7 @@ ${envIdSection}
193754
193669
  ## 环境信息
193755
193670
  - 操作系统: ${os_1.default.type()} ${os_1.default.release()}
193756
193671
  - Node.js版本: ${process.version}
193757
- - MCP 版本:${process.env.npm_package_version || "2.21.0" || 0}
193672
+ - MCP 版本:${process.env.npm_package_version || "2.21.1" || 0}
193758
193673
  - 系统架构: ${os_1.default.arch()}
193759
193674
  - 时间: ${new Date().toISOString()}
193760
193675
  - 请求ID: ${requestId}
@@ -193835,7 +193750,7 @@ function createWrappedHandler(name, handler, server) {
193835
193750
  requestId: (typeof error === 'object' && error && 'requestId' in error) ? error.requestId : '',
193836
193751
  ide: server.ide || process.env.INTEGRATION_IDE || ''
193837
193752
  });
193838
- const mcpVersion = true ? "2.21.0" : 0;
193753
+ const mcpVersion = true ? "2.21.1" : 0;
193839
193754
  const requestIdSuffix = requestId ? `\n🆔 RequestId: ${requestId}` : '';
193840
193755
  const enhancedErrorMessage = `${errorMessage}${requestIdSuffix}\n\n📦 CloudBase MCP v${mcpVersion}\n🔗 遇到问题?请复制以下链接到浏览器打开\n即可自动携带错误详情快速创建 GitHub Issue:\n${issueLink}`;
193841
193756
  // 创建新的错误对象,保持原有的错误类型但更新消息
@@ -209808,7 +209723,7 @@ function registerSetupTools(server) {
209808
209723
  server.registerTool("downloadTemplate", {
209809
209724
  title: "下载项目模板",
209810
209725
  description: `自动下载并部署CloudBase项目模板。
209811
- **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.21.0" : 0}),便于后续维护和版本追踪\n- 下载 rules 模板时,如果项目中已存在 README.md 文件,系统会自动保护该文件不被覆盖(除非设置 overwrite=true)`,
209726
+ **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.21.1" : 0}),便于后续维护和版本追踪\n- 下载 rules 模板时,如果项目中已存在 README.md 文件,系统会自动保护该文件不被覆盖(除非设置 overwrite=true)`,
209812
209727
  inputSchema: {
209813
209728
  template: zod_1.z
209814
209729
  .enum(["react", "vue", "miniprogram", "uniapp", "rules"])
package/dist/index.js CHANGED
@@ -1703,7 +1703,7 @@ ${envIdSection}
1703
1703
  ## 环境信息
1704
1704
  - 操作系统: ${os_1.default.type()} ${os_1.default.release()}
1705
1705
  - Node.js版本: ${process.version}
1706
- - MCP 版本:${process.env.npm_package_version || "2.21.0" || 0}
1706
+ - MCP 版本:${process.env.npm_package_version || "2.21.1" || 0}
1707
1707
  - 系统架构: ${os_1.default.arch()}
1708
1708
  - 时间: ${new Date().toISOString()}
1709
1709
  - 请求ID: ${requestId}
@@ -1784,7 +1784,7 @@ function createWrappedHandler(name, handler, server) {
1784
1784
  requestId: (typeof error === 'object' && error && 'requestId' in error) ? error.requestId : '',
1785
1785
  ide: server.ide || process.env.INTEGRATION_IDE || ''
1786
1786
  });
1787
- const mcpVersion = true ? "2.21.0" : 0;
1787
+ const mcpVersion = true ? "2.21.1" : 0;
1788
1788
  const requestIdSuffix = requestId ? `\n🆔 RequestId: ${requestId}` : '';
1789
1789
  const enhancedErrorMessage = `${errorMessage}${requestIdSuffix}\n\n📦 CloudBase MCP v${mcpVersion}\n🔗 遇到问题?请复制以下链接到浏览器打开\n即可自动携带错误详情快速创建 GitHub Issue:\n${issueLink}`;
1790
1790
  // 创建新的错误对象,保持原有的错误类型但更新消息
@@ -6240,99 +6240,6 @@ async function downloadResources() {
6240
6240
  return resourceDownloadPromise;
6241
6241
  }
6242
6242
  async function registerRagTools(server) {
6243
- // 联网搜索
6244
- server.registerTool?.("searchWeb", {
6245
- title: "联网搜索",
6246
- description: "使用联网来进行信息检索,如查询最新的新闻、文章、股价、天气等。支持自然语言查询,也可以直接输入网址获取网页内容",
6247
- inputSchema: {
6248
- query: zod_1.z.string().describe("搜索关键词、问题或网址,支持自然语言"),
6249
- },
6250
- annotations: {
6251
- readOnlyHint: true,
6252
- openWorldHint: true,
6253
- category: "web",
6254
- },
6255
- }, async ({ query }) => {
6256
- try {
6257
- // 使用混元进行联网搜索
6258
- const signInRes = await fetch("https://tcb-advanced-a656fc.api.tcloudbasegateway.com/auth/v1/signin/anonymously", {
6259
- method: "POST",
6260
- headers: {
6261
- "Content-Type": "application/json",
6262
- Accept: "application/json",
6263
- "x-device-id": "cloudbase-ai-toolkit",
6264
- },
6265
- body: safeStringify({}),
6266
- });
6267
- const { access_token } = await signInRes.json();
6268
- // 调用混元API进行联网搜索
6269
- const searchRes = await fetch("https://tcb-advanced-a656fc.api.tcloudbasegateway.com/v1/ai/hunyuan-beta/openapi/v1/chat/completions", {
6270
- method: "POST",
6271
- headers: {
6272
- "Content-Type": "application/json",
6273
- Authorization: `Bearer ${access_token}`,
6274
- },
6275
- body: safeStringify({
6276
- model: "hunyuan",
6277
- messages: [
6278
- {
6279
- role: "user",
6280
- content: `你好,你将扮演一个知识库的角色,联网查询到问题的答案之后回答给我`,
6281
- },
6282
- {
6283
- role: "assistant",
6284
- content: "好的",
6285
- },
6286
- {
6287
- role: "user",
6288
- content: query,
6289
- },
6290
- ],
6291
- enable_enhancement: true,
6292
- search_info: true,
6293
- enable_speed_search: true,
6294
- force_search_enhancement: true,
6295
- }),
6296
- });
6297
- const result = await searchRes.json();
6298
- if (result.error) {
6299
- throw new Error(result.error.message || "联网搜索失败");
6300
- }
6301
- const content = result.choices?.[0]?.message?.content || "";
6302
- const searchResults = result.search_info?.search_results || [];
6303
- return {
6304
- content: [
6305
- {
6306
- type: "text",
6307
- text: safeStringify({
6308
- type: "web_search",
6309
- content: content,
6310
- search_results: searchResults.map((item) => ({
6311
- title: item.title,
6312
- url: item.url,
6313
- snippet: item.snippet,
6314
- })),
6315
- status: "success",
6316
- }),
6317
- },
6318
- ],
6319
- };
6320
- }
6321
- catch (error) {
6322
- return {
6323
- content: [
6324
- {
6325
- type: "text",
6326
- text: safeStringify({
6327
- type: "error",
6328
- message: error instanceof Error ? error.message : "联网搜索失败",
6329
- status: "error",
6330
- }),
6331
- },
6332
- ],
6333
- };
6334
- }
6335
- });
6336
6243
  let openapis = [];
6337
6244
  let skills = [];
6338
6245
  let fallbackSkillsRoot;
@@ -9275,7 +9182,7 @@ class TelemetryReporter {
9275
9182
  const nodeVersion = process.version; // Node.js版本
9276
9183
  const arch = os_1.default.arch(); // 系统架构
9277
9184
  // 从构建时注入的版本号获取MCP版本信息
9278
- const mcpVersion = process.env.npm_package_version || "2.21.0" || 0;
9185
+ const mcpVersion = process.env.npm_package_version || "2.21.1" || 0;
9279
9186
  return {
9280
9187
  userAgent: `${osType} ${osRelease} ${arch} ${nodeVersion} CloudBase-MCP/${mcpVersion}`,
9281
9188
  deviceId: this.deviceId,
@@ -11845,7 +11752,7 @@ function registerSetupTools(server) {
11845
11752
  server.registerTool("downloadTemplate", {
11846
11753
  title: "下载项目模板",
11847
11754
  description: `自动下载并部署CloudBase项目模板。
11848
- **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.21.0" : 0}),便于后续维护和版本追踪\n- 下载 rules 模板时,如果项目中已存在 README.md 文件,系统会自动保护该文件不被覆盖(除非设置 overwrite=true)`,
11755
+ **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.21.1" : 0}),便于后续维护和版本追踪\n- 下载 rules 模板时,如果项目中已存在 README.md 文件,系统会自动保护该文件不被覆盖(除非设置 overwrite=true)`,
11849
11756
  inputSchema: {
11850
11757
  template: zod_1.z
11851
11758
  .enum(["react", "vue", "miniprogram", "uniapp", "rules"])
@@ -13292,13 +13199,16 @@ async function resolveHostingStaticDomain(cloudbase, logger) {
13292
13199
  return undefined;
13293
13200
  }
13294
13201
  }
13295
- async function assertHostingUploadEnvironmentReady(cloudbase, cloudBaseOptions, logger) {
13202
+ // Returns the first hosting store record from DescribeStaticStore, which is
13203
+ // the authoritative source for Mini Program-sourced environments (those envs
13204
+ // do not populate StaticStorages in DescribeEnvs / getEnvInfo).
13205
+ // Throws when no valid store is found so upload can fail fast with a clear msg.
13206
+ async function getHostingStoreOrThrow(cloudbase, cloudBaseOptions, logger) {
13296
13207
  const envId = await (0, cloudbase_manager_js_1.getEnvId)(cloudBaseOptions);
13297
- const envInfo = await cloudbase.env.getEnvInfo();
13298
- (0, cloudbase_manager_js_1.logCloudBaseResult)(logger, envInfo);
13299
- const staticStorage = envInfo.EnvInfo?.StaticStorages?.[0];
13300
- if (staticStorage?.Bucket) {
13301
- return;
13208
+ const result = await callTcbHostingAction(cloudbase, 'DescribeStaticStore', { EnvId: envId }, logger);
13209
+ const hostingInfo = extractStaticStores(result);
13210
+ if (hostingInfo.length > 0 && hostingInfo[0].Bucket) {
13211
+ return hostingInfo[0];
13302
13212
  }
13303
13213
  throw new Error(`当前环境 ${envId} 未发现静态托管资源配置,无法上传文件。请先确认 MCP 已绑定到已开通静态托管的 CloudBase 环境;如需切换环境,请调用 auth(action="set_env", envId="目标环境ID") 后重试。`);
13304
13214
  }
@@ -13506,8 +13416,9 @@ function registerHostingTools(server) {
13506
13416
  throw new Error('manageHosting(action="upload") 需要提供 localPath + cloudPath,或提供 files 多文件上传列表。');
13507
13417
  }
13508
13418
  let result;
13419
+ let store;
13509
13420
  try {
13510
- await assertHostingUploadEnvironmentReady(cloudbase, cloudBaseOptions, server.logger);
13421
+ store = await getHostingStoreOrThrow(cloudbase, cloudBaseOptions, server.logger);
13511
13422
  result = await cloudbase.hosting.uploadFiles({
13512
13423
  localPath: input.localPath,
13513
13424
  cloudPath: input.cloudPath,
@@ -13519,7 +13430,11 @@ function registerHostingTools(server) {
13519
13430
  throw new Error(buildUploadErrorMessage(error, input.localPath));
13520
13431
  }
13521
13432
  (0, cloudbase_manager_js_1.logCloudBaseResult)(server.logger, result);
13522
- const staticDomain = await resolveHostingStaticDomain(cloudbase, server.logger);
13433
+ // Prefer CdnDomain from the DescribeStaticStore result we already
13434
+ // fetched; fall back to getEnvInfo for environments that populate
13435
+ // StaticDomain there but not in DescribeStaticStore.
13436
+ const cdnFromStore = (store.CdnDomain ?? store.StaticDomain);
13437
+ const staticDomain = cdnFromStore || await resolveHostingStaticDomain(cloudbase, server.logger);
13523
13438
  const accessUrl = buildHostingAccessUrl(staticDomain, input.cloudPath, input.localPath);
13524
13439
  try {
13525
13440
  const envId = await (0, cloudbase_manager_js_1.getEnvId)(cloudBaseOptions);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cloudbase/cloudbase-mcp",
3
- "version": "2.21.0",
3
+ "version": "2.21.1",
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",