@cloudbase/cloudbase-mcp 1.8.4 → 1.8.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.
package/dist/index.cjs CHANGED
@@ -128,7 +128,7 @@ var init_logger = __esm({
128
128
  logger = new Logger({
129
129
  enabled: (process.env.MCP_DEBUG ?? "true") === "true",
130
130
  level: 0 /* DEBUG */,
131
- console: process.env.NODE_ENV === "development" || process.env.MCP_CONSOLE_LOG === "true"
131
+ console: process.env.MCP_CONSOLE_LOG === "true"
132
132
  });
133
133
  debug = (message, data) => logger.debug(message, data);
134
134
  info = (message, data) => logger.info(message, data);
@@ -184,6 +184,16 @@ __export(interactive_server_exports, {
184
184
  getInteractiveServerSafe: () => getInteractiveServerSafe,
185
185
  resetInteractiveServer: () => resetInteractiveServer
186
186
  });
187
+ async function openUrl(url, options) {
188
+ try {
189
+ const openModule = await import("open");
190
+ const open = openModule.default || openModule;
191
+ return await open(url, options);
192
+ } catch (err) {
193
+ error("Failed to import or use open module", err);
194
+ warn(`Please manually open: ${url}`);
195
+ }
196
+ }
187
197
  function getInteractiveServer() {
188
198
  if (!interactiveServerInstance) {
189
199
  interactiveServerInstance = new InteractiveServer();
@@ -211,14 +221,13 @@ async function getInteractiveServerSafe() {
211
221
  }
212
222
  return getInteractiveServer();
213
223
  }
214
- var import_express, import_http, import_ws, import_open, import_path2, import_url, import_meta, getFilename, __filename, __dirname, InteractiveServer, interactiveServerInstance;
224
+ var import_express, import_http, import_ws, import_path2, import_url, import_meta, getFilename, __filename, __dirname, InteractiveServer, interactiveServerInstance;
215
225
  var init_interactive_server = __esm({
216
226
  "src/interactive-server.ts"() {
217
227
  "use strict";
218
228
  import_express = __toESM(require("express"), 1);
219
229
  import_http = __toESM(require("http"), 1);
220
230
  import_ws = require("ws");
221
- import_open = __toESM(require("open"), 1);
222
231
  import_path2 = __toESM(require("path"), 1);
223
232
  import_url = require("url");
224
233
  init_logger();
@@ -230,7 +239,10 @@ var init_interactive_server = __esm({
230
239
  if (typeof globalThis.__filename === "string") {
231
240
  return globalThis.__filename;
232
241
  }
233
- return require.main?.filename || process.cwd() + "/interactive-server.js";
242
+ if (typeof require !== "undefined" && require.main && require.main.filename) {
243
+ return require.main.filename;
244
+ }
245
+ return import_path2.default.join(process.cwd(), "interactive-server.js");
234
246
  };
235
247
  __filename = getFilename();
236
248
  __dirname = import_path2.default.dirname(__filename);
@@ -466,7 +478,7 @@ var init_interactive_server = __esm({
466
478
  const url = `http://localhost:${port}/env-setup/${sessionId}`;
467
479
  info(`Opening browser: ${url}`);
468
480
  try {
469
- await (0, import_open.default)(url, { wait: false });
481
+ await openUrl(url, { wait: false });
470
482
  info("Browser opened successfully");
471
483
  } catch (browserError) {
472
484
  error("Failed to open browser", browserError);
@@ -496,7 +508,7 @@ var init_interactive_server = __esm({
496
508
  this.sessionData.delete(sessionId);
497
509
  }, 5 * 60 * 1e3);
498
510
  const url = `http://localhost:${port}/clarification/${sessionId}`;
499
- await (0, import_open.default)(url);
511
+ await openUrl(url);
500
512
  return new Promise((resolve2) => {
501
513
  this.currentResolver = resolve2;
502
514
  });
@@ -3160,10 +3172,9 @@ function registerEnvTools(server) {
3160
3172
  "envQuery",
3161
3173
  {
3162
3174
  title: "\u73AF\u5883\u67E5\u8BE2",
3163
- description: "\u67E5\u8BE2\u4E91\u5F00\u53D1\u73AF\u5883\u76F8\u5173\u4FE1\u606F\uFF0C\u652F\u6301\u67E5\u8BE2\u73AF\u5883\u5217\u8868\u3001\u5F53\u524D\u73AF\u5883\u4FE1\u606F\u548C\u5B89\u5168\u57DF\u540D",
3175
+ description: "\u67E5\u8BE2\u4E91\u5F00\u53D1\u73AF\u5883\u76F8\u5173\u4FE1\u606F\uFF0C\u652F\u6301\u67E5\u8BE2\u73AF\u5883\u5217\u8868\u3001\u5F53\u524D\u73AF\u5883\u4FE1\u606F\u548C\u5B89\u5168\u57DF\u540D\u3002\uFF08\u539F\u5DE5\u5177\u540D\uFF1AlistEnvs/getEnvInfo/getEnvAuthDomains\uFF0C\u4E3A\u517C\u5BB9\u65E7AI\u89C4\u5219\u53EF\u7EE7\u7EED\u4F7F\u7528\u8FD9\u4E9B\u540D\u79F0\uFF09",
3164
3176
  inputSchema: {
3165
- action: import_zod2.z.enum(["list", "info", "domains"]).describe("\u67E5\u8BE2\u7C7B\u578B\uFF1Alist=\u73AF\u5883\u5217\u8868\uFF0Cinfo=\u5F53\u524D\u73AF\u5883\u4FE1\u606F\uFF0Cdomains=\u5B89\u5168\u57DF\u540D\u5217\u8868"),
3166
- confirm: import_zod2.z.literal("yes").optional().describe("\u786E\u8BA4\u64CD\u4F5C\uFF0C\u9ED8\u8BA4\u4F20 yes")
3177
+ action: import_zod2.z.enum(["list", "info", "domains"]).describe("\u67E5\u8BE2\u7C7B\u578B\uFF1Alist=\u73AF\u5883\u5217\u8868\uFF0Cinfo=\u5F53\u524D\u73AF\u5883\u4FE1\u606F\uFF0Cdomains=\u5B89\u5168\u57DF\u540D\u5217\u8868")
3167
3178
  },
3168
3179
  annotations: {
3169
3180
  readOnlyHint: true,
@@ -3210,7 +3221,7 @@ function registerEnvTools(server) {
3210
3221
  "envDomainManagement",
3211
3222
  {
3212
3223
  title: "\u73AF\u5883\u57DF\u540D\u7BA1\u7406",
3213
- description: "\u7BA1\u7406\u4E91\u5F00\u53D1\u73AF\u5883\u7684\u5B89\u5168\u57DF\u540D\uFF0C\u652F\u6301\u6DFB\u52A0\u548C\u5220\u9664\u64CD\u4F5C",
3224
+ description: "\u7BA1\u7406\u4E91\u5F00\u53D1\u73AF\u5883\u7684\u5B89\u5168\u57DF\u540D\uFF0C\u652F\u6301\u6DFB\u52A0\u548C\u5220\u9664\u64CD\u4F5C\u3002\uFF08\u539F\u5DE5\u5177\u540D\uFF1AcreateEnvDomain/deleteEnvDomain\uFF0C\u4E3A\u517C\u5BB9\u65E7AI\u89C4\u5219\u53EF\u7EE7\u7EED\u4F7F\u7528\u8FD9\u4E9B\u540D\u79F0\uFF09",
3214
3225
  inputSchema: {
3215
3226
  action: import_zod2.z.enum(["create", "delete"]).describe("\u64CD\u4F5C\u7C7B\u578B\uFF1Acreate=\u6DFB\u52A0\u57DF\u540D\uFF0Cdelete=\u5220\u9664\u57DF\u540D"),
3216
3227
  domains: import_zod2.z.array(import_zod2.z.string()).describe("\u5B89\u5168\u57DF\u540D\u6570\u7EC4")
@@ -4054,7 +4065,7 @@ function registerDatabaseTools(server) {
4054
4065
  "collectionQuery",
4055
4066
  {
4056
4067
  title: "\u96C6\u5408\u67E5\u8BE2",
4057
- description: "\u6570\u636E\u5E93\u96C6\u5408\u7684\u67E5\u8BE2\u64CD\u4F5C\uFF0C\u652F\u6301\u68C0\u67E5\u5B58\u5728\u6027\u3001\u67E5\u770B\u8BE6\u60C5\u548C\u5217\u8868\u67E5\u8BE2",
4068
+ description: "\u6570\u636E\u5E93\u96C6\u5408\u7684\u67E5\u8BE2\u64CD\u4F5C\uFF0C\u652F\u6301\u68C0\u67E5\u5B58\u5728\u6027\u3001\u67E5\u770B\u8BE6\u60C5\u548C\u5217\u8868\u67E5\u8BE2\u3002\uFF08\u539F\u5DE5\u5177\u540D\uFF1AcheckCollectionExists/describeCollection/listCollections\uFF0C\u4E3A\u517C\u5BB9\u65E7AI\u89C4\u5219\u53EF\u7EE7\u7EED\u4F7F\u7528\u8FD9\u4E9B\u540D\u79F0\uFF09",
4058
4069
  inputSchema: {
4059
4070
  action: import_zod4.z.enum(["check", "describe", "list"]).describe("\u64CD\u4F5C\u7C7B\u578B\uFF1Acheck=\u68C0\u67E5\u662F\u5426\u5B58\u5728\uFF0Cdescribe=\u67E5\u770B\u8BE6\u60C5\uFF0Clist=\u5217\u8868\u67E5\u8BE2"),
4060
4071
  collectionName: import_zod4.z.string().optional().describe("\u96C6\u5408\u540D\u79F0\uFF08check\u3001describe\u64CD\u4F5C\u65F6\u5FC5\u586B\uFF09"),
@@ -5677,8 +5688,15 @@ var TelemetryReporter = class {
5677
5688
  try {
5678
5689
  mcpVersion = process.env.npm_package_version || "";
5679
5690
  if (!mcpVersion) {
5680
- const __filename2 = (0, import_url3.fileURLToPath)(import_meta2.url);
5681
- const __dirname2 = (0, import_path5.dirname)(__filename2);
5691
+ let __dirname2;
5692
+ if (typeof import_meta2 !== "undefined" && import_meta2.url) {
5693
+ const __filename2 = (0, import_url3.fileURLToPath)(import_meta2.url);
5694
+ __dirname2 = (0, import_path5.dirname)(__filename2);
5695
+ } else if (typeof globalThis.__filename !== "undefined") {
5696
+ __dirname2 = (0, import_path5.dirname)(globalThis.__filename);
5697
+ } else {
5698
+ __dirname2 = process.cwd();
5699
+ }
5682
5700
  const packageJsonPath = (0, import_path5.join)(__dirname2, "../../package.json");
5683
5701
  const packageJson = JSON.parse((0, import_fs.readFileSync)(packageJsonPath, "utf-8"));
5684
5702
  mcpVersion = packageJson.version || "unknown";
@@ -5778,7 +5796,7 @@ var TelemetryReporter = class {
5778
5796
  A101: this.userAgent,
5779
5797
  // 运行环境信息
5780
5798
  from: "cloudbase-mcp",
5781
- xDeployEnv: process.env.NODE_ENV || "production",
5799
+ xDeployEnv: "production",
5782
5800
  ...this.additionalParams
5783
5801
  },
5784
5802
  events: [