@cloudbase/cloudbase-mcp 1.8.4 → 1.8.5

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
  });
@@ -5677,8 +5689,15 @@ var TelemetryReporter = class {
5677
5689
  try {
5678
5690
  mcpVersion = process.env.npm_package_version || "";
5679
5691
  if (!mcpVersion) {
5680
- const __filename2 = (0, import_url3.fileURLToPath)(import_meta2.url);
5681
- const __dirname2 = (0, import_path5.dirname)(__filename2);
5692
+ let __dirname2;
5693
+ if (typeof import_meta2 !== "undefined" && import_meta2.url) {
5694
+ const __filename2 = (0, import_url3.fileURLToPath)(import_meta2.url);
5695
+ __dirname2 = (0, import_path5.dirname)(__filename2);
5696
+ } else if (typeof globalThis.__filename !== "undefined") {
5697
+ __dirname2 = (0, import_path5.dirname)(globalThis.__filename);
5698
+ } else {
5699
+ __dirname2 = process.cwd();
5700
+ }
5682
5701
  const packageJsonPath = (0, import_path5.join)(__dirname2, "../../package.json");
5683
5702
  const packageJson = JSON.parse((0, import_fs.readFileSync)(packageJsonPath, "utf-8"));
5684
5703
  mcpVersion = packageJson.version || "unknown";
@@ -5778,7 +5797,7 @@ var TelemetryReporter = class {
5778
5797
  A101: this.userAgent,
5779
5798
  // 运行环境信息
5780
5799
  from: "cloudbase-mcp",
5781
- xDeployEnv: process.env.NODE_ENV || "production",
5800
+ xDeployEnv: "production",
5782
5801
  ...this.additionalParams
5783
5802
  },
5784
5803
  events: [