@mcpjam/inspector 0.9.52 → 0.9.55

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.
@@ -6,8 +6,9 @@ import { Hono as Hono13 } from "hono";
6
6
  import { cors } from "hono/cors";
7
7
  import { logger } from "hono/logger";
8
8
  import { serveStatic } from "@hono/node-server/serve-static";
9
- import { readFileSync } from "fs";
10
- import { join } from "path";
9
+ import { readFileSync, existsSync } from "fs";
10
+ import { join, dirname, resolve } from "path";
11
+ import { fileURLToPath } from "url";
11
12
 
12
13
  // routes/mcp/index.ts
13
14
  import { Hono as Hono12 } from "hono";
@@ -196,8 +197,8 @@ function takeNextElicitation(state) {
196
197
  if (state.queue.length > 0) {
197
198
  return Promise.resolve(state.queue.shift());
198
199
  }
199
- return new Promise((resolve) => {
200
- state.waiters.push(resolve);
200
+ return new Promise((resolve2) => {
201
+ state.waiters.push(resolve2);
201
202
  });
202
203
  }
203
204
  tools.post("/list", async (c) => {
@@ -275,7 +276,7 @@ tools.post("/execute", async (c) => {
275
276
  } else {
276
277
  activeExecution.queue.push(event);
277
278
  }
278
- return new Promise((resolve, reject) => {
279
+ return new Promise((resolve2, reject) => {
279
280
  const timeout = setTimeout(
280
281
  () => reject(new Error("Elicitation timeout")),
281
282
  3e5
@@ -283,7 +284,7 @@ tools.post("/execute", async (c) => {
283
284
  mcp2.getPendingElicitations().set(requestId, {
284
285
  resolve: (response) => {
285
286
  clearTimeout(timeout);
286
- resolve(response);
287
+ resolve2(response);
287
288
  },
288
289
  reject: (error) => {
289
290
  clearTimeout(timeout);
@@ -1295,14 +1296,14 @@ chat.post("/", async (c) => {
1295
1296
  }
1296
1297
  );
1297
1298
  }
1298
- return new Promise((resolve, reject) => {
1299
+ return new Promise((resolve2, reject) => {
1299
1300
  const timeout = setTimeout(() => {
1300
1301
  reject(new Error("Elicitation timeout"));
1301
1302
  }, ELICITATION_TIMEOUT);
1302
1303
  mcpClientManager.getPendingElicitations().set(request.requestId, {
1303
1304
  resolve: (response2) => {
1304
1305
  clearTimeout(timeout);
1305
- resolve(response2);
1306
+ resolve2(response2);
1306
1307
  },
1307
1308
  reject: (error) => {
1308
1309
  clearTimeout(timeout);
@@ -3497,14 +3498,14 @@ var MCPJamClientManager = class {
3497
3498
  */
3498
3499
  async handleElicitationRequest(elicitationRequest) {
3499
3500
  const requestId = `elicit_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`;
3500
- return new Promise((resolve, reject) => {
3501
- this.pendingElicitations.set(requestId, { resolve, reject });
3501
+ return new Promise((resolve2, reject) => {
3502
+ this.pendingElicitations.set(requestId, { resolve: resolve2, reject });
3502
3503
  if (this.elicitationCallback) {
3503
3504
  this.elicitationCallback({
3504
3505
  requestId,
3505
3506
  message: elicitationRequest.message,
3506
3507
  schema: elicitationRequest.requestedSchema
3507
- }).then(resolve).catch(reject);
3508
+ }).then(resolve2).catch(reject);
3508
3509
  } else {
3509
3510
  const error = new Error("ELICITATION_REQUIRED");
3510
3511
  error.elicitationRequest = {
@@ -3549,6 +3550,8 @@ var MCPJamClientManager = class {
3549
3550
  };
3550
3551
 
3551
3552
  // index.ts
3553
+ var __filename = fileURLToPath(import.meta.url);
3554
+ var __dirname = dirname(__filename);
3552
3555
  function logBox(content, title) {
3553
3556
  const lines = content.split("\n");
3554
3557
  const maxLength = Math.max(...lines.map((line) => line.length));
@@ -3624,14 +3627,22 @@ try {
3624
3627
  } catch {
3625
3628
  }
3626
3629
  var app = new Hono13();
3627
- try {
3628
- const envFile = process.env.NODE_ENV === "production" ? ".env.production" : ".env.development";
3629
- dotenv.config({ path: envFile });
3630
- if (!process.env.CONVEX_HTTP_URL) {
3631
- dotenv.config();
3630
+ var envFile = process.env.NODE_ENV === "production" ? ".env.production" : ".env.development";
3631
+ var envPath = envFile;
3632
+ if (process.env.ELECTRON_APP === "true" && process.env.ELECTRON_RESOURCES_PATH) {
3633
+ envPath = join(process.env.ELECTRON_RESOURCES_PATH, envFile);
3634
+ } else {
3635
+ const packageRoot = resolve(__dirname, "..", "..");
3636
+ const packageEnvPath = join(packageRoot, envFile);
3637
+ if (existsSync(packageEnvPath)) {
3638
+ envPath = packageEnvPath;
3632
3639
  }
3633
- } catch (error) {
3634
- console.warn("[startup] Failed loading env files", error);
3640
+ }
3641
+ dotenv.config({ path: envPath });
3642
+ if (!process.env.CONVEX_HTTP_URL) {
3643
+ throw new Error(
3644
+ "CONVEX_HTTP_URL is required but not set. Please set it via environment variable or .env file."
3645
+ );
3635
3646
  }
3636
3647
  var mcpJamClientManager = new MCPJamClientManager();
3637
3648
  app.use("*", async (c, next) => {