@cloudbase/cloudbase-mcp 1.0.4 → 1.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -10,8 +10,8 @@ const cloudbase = new CloudBase({
10
10
  export function registerHostingTools(server) {
11
11
  // uploadFiles - 上传文件到静态网站托管
12
12
  server.tool("uploadFiles", "上传文件到静态网站托管", {
13
- localPath: z.string().optional().describe("本地文件或文件夹路径"),
14
- cloudPath: z.string().optional().describe("云端文件或文件夹路径"),
13
+ localPath: z.string().optional().describe("本地文件或文件夹路径,需要是绝对路径,例如 /tmp/files/data.txt"),
14
+ cloudPath: z.string().optional().describe("云端文件或文件夹路径,例如files/data.txt"),
15
15
  files: z.array(z.object({
16
16
  localPath: z.string(),
17
17
  cloudPath: z.string()
@@ -24,11 +24,23 @@ export function registerHostingTools(server) {
24
24
  files,
25
25
  ignore
26
26
  });
27
+ // 获取环境信息
28
+ const envInfo = await cloudbase.env.getEnvInfo();
29
+ // 获取静态网站地址
30
+ let staticDomain = "";
31
+ if (envInfo?.EnvInfo?.StaticStorages && envInfo.EnvInfo.StaticStorages.length > 0) {
32
+ staticDomain = envInfo.EnvInfo.StaticStorages[0].StaticDomain;
33
+ }
27
34
  return {
28
35
  content: [
29
36
  {
30
37
  type: "text",
31
- text: JSON.stringify(result, null, 2)
38
+ text: JSON.stringify({
39
+ uploadResult: result,
40
+ staticWebsiteUrl: staticDomain ? `https://${staticDomain}` : "",
41
+ // 返回文件的完整访问URL
42
+ fileUrl: staticDomain && cloudPath ? `https://${staticDomain}/${cloudPath}` : ""
43
+ }, null, 2)
32
44
  }
33
45
  ]
34
46
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cloudbase/cloudbase-mcp",
3
- "version": "1.0.4",
3
+ "version": "1.0.6",
4
4
  "description": "腾讯云开发 MCP Server,支持静态托管/环境查询/",
5
5
  "main": "index.js",
6
6
  "type": "module",