@mcpjam/inspector 1.0.6 → 1.0.8

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.
@@ -5,7 +5,7 @@
5
5
  <link rel="icon" type="image/svg+xml" href="/mcp_jam.svg" />
6
6
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
7
7
  <title>MCPJam Inspector</title>
8
- <script type="module" crossorigin src="/assets/index-BPqF-2di.js"></script>
8
+ <script type="module" crossorigin src="/assets/index-DzmPRJya.js"></script>
9
9
  <link rel="stylesheet" crossorigin href="/assets/index-BM_pWNid.css">
10
10
  </head>
11
11
  <body>
@@ -48,7 +48,7 @@ import { readFileSync as readFileSync2, existsSync as existsSync2 } from "fs";
48
48
  import { join as join2, dirname, resolve } from "path";
49
49
  import { fileURLToPath } from "url";
50
50
 
51
- // ../sdk/mcp-client-manager/index.ts
51
+ // ../sdk/dist/chunk-6XEFXCUG.js
52
52
  import { Client } from "@modelcontextprotocol/sdk/client/index.js";
53
53
  import { SSEClientTransport } from "@modelcontextprotocol/sdk/client/sse.js";
54
54
  import {
@@ -64,8 +64,6 @@ import {
64
64
  ResourceUpdatedNotificationSchema,
65
65
  PromptListChangedNotificationSchema
66
66
  } from "@modelcontextprotocol/sdk/types.js";
67
-
68
- // ../sdk/mcp-client-manager/tool-converters.ts
69
67
  import {
70
68
  CallToolResultSchema
71
69
  } from "@modelcontextprotocol/sdk/types.js";
@@ -74,7 +72,17 @@ import {
74
72
  jsonSchema,
75
73
  tool as defineTool
76
74
  } from "ai";
75
+ var __defProp = Object.defineProperty;
76
+ var __export = (target, all) => {
77
+ for (var name in all)
78
+ __defProp(target, name, { get: all[name], enumerable: true });
79
+ };
80
+ var mcp_client_manager_exports = {};
81
+ __export(mcp_client_manager_exports, {
82
+ MCPClientManager: () => MCPClientManager
83
+ });
77
84
  var ensureJsonSchemaObject = (schema) => {
85
+ var _a2;
78
86
  if (schema && typeof schema === "object") {
79
87
  const record = schema;
80
88
  const base = record.jsonSchema ? ensureJsonSchemaObject(record.jsonSchema) : record;
@@ -82,7 +90,7 @@ var ensureJsonSchemaObject = (schema) => {
82
90
  base.type = "object";
83
91
  }
84
92
  if (base.type === "object") {
85
- base.properties = base.properties ?? {};
93
+ base.properties = (_a2 = base.properties) != null ? _a2 : {};
86
94
  if (base.additionalProperties === void 0) {
87
95
  base.additionalProperties = false;
88
96
  }
@@ -99,11 +107,13 @@ async function convertMCPToolsToVercelTools(listToolsResult, {
99
107
  schemas = "automatic",
100
108
  callTool
101
109
  }) {
110
+ var _a2, _b2;
102
111
  const tools2 = {};
103
112
  for (const toolDescription of listToolsResult.tools) {
104
113
  const { name, description, inputSchema } = toolDescription;
105
114
  const execute = async (args, options) => {
106
- options?.abortSignal?.throwIfAborted?.();
115
+ var _a22, _b22;
116
+ (_b22 = (_a22 = options == null ? void 0 : options.abortSignal) == null ? void 0 : _a22.throwIfAborted) == null ? void 0 : _b22.call(_a22);
107
117
  const result = await callTool({ name, args, options });
108
118
  return CallToolResultSchema.parse(result);
109
119
  };
@@ -114,8 +124,8 @@ async function convertMCPToolsToVercelTools(listToolsResult, {
114
124
  description,
115
125
  inputSchema: jsonSchema({
116
126
  type: "object",
117
- properties: normalizedInputSchema.properties ?? {},
118
- additionalProperties: normalizedInputSchema.additionalProperties ?? false
127
+ properties: (_a2 = normalizedInputSchema.properties) != null ? _a2 : {},
128
+ additionalProperties: (_b2 = normalizedInputSchema.additionalProperties) != null ? _b2 : false
119
129
  }),
120
130
  execute
121
131
  });
@@ -134,27 +144,19 @@ async function convertMCPToolsToVercelTools(listToolsResult, {
134
144
  }
135
145
  return tools2;
136
146
  }
137
-
138
- // ../sdk/mcp-client-manager/index.ts
139
147
  var MCPClientManager = class {
140
- clientStates = /* @__PURE__ */ new Map();
141
- notificationHandlers = /* @__PURE__ */ new Map();
142
- elicitationHandlers = /* @__PURE__ */ new Map();
143
- toolsMetadataCache = /* @__PURE__ */ new Map();
144
- defaultClientVersion;
145
- defaultCapabilities;
146
- defaultTimeout;
147
- // Default JSON-RPC logging controls
148
- defaultLogJsonRpc = false;
149
- defaultRpcLogger;
150
- // Global elicitation callback support (used by streaming chat endpoint)
151
- elicitationCallback;
152
- pendingElicitations = /* @__PURE__ */ new Map();
153
148
  constructor(servers2 = {}, options = {}) {
154
- this.defaultClientVersion = options.defaultClientVersion ?? "1.0.0";
155
- this.defaultCapabilities = { ...options.defaultCapabilities ?? {} };
156
- this.defaultTimeout = options.defaultTimeout ?? DEFAULT_REQUEST_TIMEOUT_MSEC;
157
- this.defaultLogJsonRpc = options.defaultLogJsonRpc ?? false;
149
+ this.clientStates = /* @__PURE__ */ new Map();
150
+ this.notificationHandlers = /* @__PURE__ */ new Map();
151
+ this.elicitationHandlers = /* @__PURE__ */ new Map();
152
+ this.toolsMetadataCache = /* @__PURE__ */ new Map();
153
+ this.defaultLogJsonRpc = false;
154
+ this.pendingElicitations = /* @__PURE__ */ new Map();
155
+ var _a2, _b2, _c, _d;
156
+ this.defaultClientVersion = (_a2 = options.defaultClientVersion) != null ? _a2 : "1.0.0";
157
+ this.defaultCapabilities = { ...(_b2 = options.defaultCapabilities) != null ? _b2 : {} };
158
+ this.defaultTimeout = (_c = options.defaultTimeout) != null ? _c : DEFAULT_REQUEST_TIMEOUT_MSEC;
159
+ this.defaultLogJsonRpc = (_d = options.defaultLogJsonRpc) != null ? _d : false;
158
160
  this.defaultRpcLogger = options.rpcLogger;
159
161
  for (const [id, config] of Object.entries(servers2)) {
160
162
  void this.connectToServer(id, config);
@@ -177,14 +179,16 @@ var MCPClientManager = class {
177
179
  return this.resolveConnectionStatus(this.clientStates.get(serverId));
178
180
  }
179
181
  getServerConfig(serverId) {
180
- return this.clientStates.get(serverId)?.config;
182
+ var _a2;
183
+ return (_a2 = this.clientStates.get(serverId)) == null ? void 0 : _a2.config;
181
184
  }
182
185
  async connectToServer(serverId, config) {
186
+ var _a2;
183
187
  if (this.clientStates.has(serverId)) {
184
188
  throw new Error(`MCP server "${serverId}" is already connected.`);
185
189
  }
186
190
  const timeout = this.getTimeout(config);
187
- const state = this.clientStates.get(serverId) ?? {
191
+ const state = (_a2 = this.clientStates.get(serverId)) != null ? _a2 : {
188
192
  config,
189
193
  timeout
190
194
  };
@@ -199,10 +203,11 @@ var MCPClientManager = class {
199
203
  return state.promise;
200
204
  }
201
205
  const connectionPromise = (async () => {
206
+ var _a22;
202
207
  const client = new Client(
203
208
  {
204
209
  name: serverId,
205
- version: config.version ?? this.defaultClientVersion
210
+ version: (_a22 = config.version) != null ? _a22 : this.defaultClientVersion
206
211
  },
207
212
  {
208
213
  capabilities: this.buildCapabilities(config)
@@ -212,7 +217,8 @@ var MCPClientManager = class {
212
217
  this.applyElicitationHandler(serverId, client);
213
218
  if (config.onError) {
214
219
  client.onerror = (error) => {
215
- config.onError?.(error);
220
+ var _a3;
221
+ (_a3 = config.onError) == null ? void 0 : _a3.call(config, error);
216
222
  };
217
223
  }
218
224
  client.onclose = () => {
@@ -345,11 +351,11 @@ var MCPClientManager = class {
345
351
  return convertMCPToolsToVercelTools(listToolsResult, {
346
352
  schemas: options.schemas,
347
353
  callTool: async ({ name, args, options: callOptions }) => {
348
- const requestOptions = callOptions?.abortSignal ? { signal: callOptions.abortSignal } : void 0;
354
+ const requestOptions = (callOptions == null ? void 0 : callOptions.abortSignal) ? { signal: callOptions.abortSignal } : void 0;
349
355
  const result = await this.executeTool(
350
356
  id,
351
357
  name,
352
- args ?? {},
358
+ args != null ? args : {},
353
359
  requestOptions
354
360
  );
355
361
  return CallToolResultSchema2.parse(result);
@@ -462,7 +468,7 @@ var MCPClientManager = class {
462
468
  }
463
469
  getSessionIdByServer(serverId) {
464
470
  const state = this.clientStates.get(serverId);
465
- if (!state?.transport) {
471
+ if (!(state == null ? void 0 : state.transport)) {
466
472
  throw new Error(`Unknown MCP server "${serverId}".`);
467
473
  }
468
474
  if (state.transport instanceof StreamableHTTPClientTransport) {
@@ -473,12 +479,13 @@ var MCPClientManager = class {
473
479
  );
474
480
  }
475
481
  addNotificationHandler(serverId, schema, handler) {
476
- const serverHandlers = this.notificationHandlers.get(serverId) ?? /* @__PURE__ */ new Map();
477
- const handlersForSchema = serverHandlers.get(schema) ?? /* @__PURE__ */ new Set();
482
+ var _a2, _b2, _c;
483
+ const serverHandlers = (_a2 = this.notificationHandlers.get(serverId)) != null ? _a2 : /* @__PURE__ */ new Map();
484
+ const handlersForSchema = (_b2 = serverHandlers.get(schema)) != null ? _b2 : /* @__PURE__ */ new Set();
478
485
  handlersForSchema.add(handler);
479
486
  serverHandlers.set(schema, handlersForSchema);
480
487
  this.notificationHandlers.set(serverId, serverHandlers);
481
- const client = this.clientStates.get(serverId)?.client;
488
+ const client = (_c = this.clientStates.get(serverId)) == null ? void 0 : _c.client;
482
489
  if (client) {
483
490
  client.setNotificationHandler(
484
491
  schema,
@@ -508,21 +515,24 @@ var MCPClientManager = class {
508
515
  );
509
516
  }
510
517
  getClient(serverId) {
511
- return this.clientStates.get(serverId)?.client;
518
+ var _a2;
519
+ return (_a2 = this.clientStates.get(serverId)) == null ? void 0 : _a2.client;
512
520
  }
513
521
  setElicitationHandler(serverId, handler) {
522
+ var _a2;
514
523
  if (!this.clientStates.has(serverId)) {
515
524
  throw new Error(`Unknown MCP server "${serverId}".`);
516
525
  }
517
526
  this.elicitationHandlers.set(serverId, handler);
518
- const client = this.clientStates.get(serverId)?.client;
527
+ const client = (_a2 = this.clientStates.get(serverId)) == null ? void 0 : _a2.client;
519
528
  if (client) {
520
529
  this.applyElicitationHandler(serverId, client);
521
530
  }
522
531
  }
523
532
  clearElicitationHandler(serverId) {
533
+ var _a2;
524
534
  this.elicitationHandlers.delete(serverId);
525
- const client = this.clientStates.get(serverId)?.client;
535
+ const client = (_a2 = this.clientStates.get(serverId)) == null ? void 0 : _a2.client;
526
536
  if (client) {
527
537
  client.removeRequestHandler("elicitation/create");
528
538
  }
@@ -568,17 +578,19 @@ var MCPClientManager = class {
568
578
  }
569
579
  }
570
580
  async connectViaStdio(serverId, client, config, timeout) {
581
+ var _a2;
571
582
  const underlying = new StdioClientTransport({
572
583
  command: config.command,
573
584
  args: config.args,
574
- env: { ...getDefaultEnvironment(), ...config.env ?? {} }
585
+ env: { ...getDefaultEnvironment(), ...(_a2 = config.env) != null ? _a2 : {} }
575
586
  });
576
587
  const wrapped = this.wrapTransportForLogging(serverId, config, underlying);
577
588
  await client.connect(wrapped, { timeout });
578
589
  return underlying;
579
590
  }
580
591
  async connectViaHttp(serverId, client, config, timeout) {
581
- const preferSSE = config.preferSSE ?? config.url.pathname.endsWith("/sse");
592
+ var _a2;
593
+ const preferSSE = (_a2 = config.preferSSE) != null ? _a2 : config.url.pathname.endsWith("/sse");
582
594
  let streamableError;
583
595
  if (!preferSSE) {
584
596
  const streamableTransport = new StreamableHTTPClientTransport(
@@ -647,7 +659,7 @@ var MCPClientManager = class {
647
659
  createNotificationDispatcher(serverId, schema) {
648
660
  return (notification) => {
649
661
  const serverHandlers = this.notificationHandlers.get(serverId);
650
- const handlersForSchema = serverHandlers?.get(schema);
662
+ const handlersForSchema = serverHandlers == null ? void 0 : serverHandlers.get(schema);
651
663
  if (!handlersForSchema || handlersForSchema.size === 0) {
652
664
  return;
653
665
  }
@@ -670,11 +682,12 @@ var MCPClientManager = class {
670
682
  }
671
683
  if (this.elicitationCallback) {
672
684
  client.setRequestHandler(ElicitRequestSchema, async (request) => {
685
+ var _a2, _b2, _c, _d;
673
686
  const reqId = `elicit_${Date.now()}_${Math.random().toString(36).slice(2, 9)}`;
674
687
  return await this.elicitationCallback({
675
688
  requestId: reqId,
676
- message: request.params?.message,
677
- schema: request.params?.requestedSchema ?? request.params?.schema
689
+ message: (_a2 = request.params) == null ? void 0 : _a2.message,
690
+ schema: (_d = (_b2 = request.params) == null ? void 0 : _b2.requestedSchema) != null ? _d : (_c = request.params) == null ? void 0 : _c.schema
678
691
  });
679
692
  });
680
693
  return;
@@ -682,7 +695,7 @@ var MCPClientManager = class {
682
695
  }
683
696
  async ensureConnected(serverId) {
684
697
  const state = this.clientStates.get(serverId);
685
- if (state?.client) {
698
+ if (state == null ? void 0 : state.client) {
686
699
  return;
687
700
  }
688
701
  if (!state) {
@@ -711,8 +724,9 @@ var MCPClientManager = class {
711
724
  return "disconnected";
712
725
  }
713
726
  withTimeout(serverId, options) {
727
+ var _a2;
714
728
  const state = this.clientStates.get(serverId);
715
- const timeout = state?.timeout ?? (state ? this.getTimeout(state.config) : this.defaultTimeout);
729
+ const timeout = (_a2 = state == null ? void 0 : state.timeout) != null ? _a2 : state ? this.getTimeout(state.config) : this.defaultTimeout;
716
730
  if (!options) {
717
731
  return { timeout };
718
732
  }
@@ -722,9 +736,10 @@ var MCPClientManager = class {
722
736
  return options;
723
737
  }
724
738
  buildCapabilities(config) {
739
+ var _a2;
725
740
  const capabilities = {
726
741
  ...this.defaultCapabilities,
727
- ...config.capabilities ?? {}
742
+ ...(_a2 = config.capabilities) != null ? _a2 : {}
728
743
  };
729
744
  if (!capabilities.elicitation) {
730
745
  capabilities.elicitation = {};
@@ -751,22 +766,22 @@ var MCPClientManager = class {
751
766
  constructor(inner) {
752
767
  this.inner = inner;
753
768
  this.inner.onmessage = (message, extra) => {
769
+ var _a2;
754
770
  try {
755
771
  log({ direction: "receive", message, serverId });
756
772
  } catch {
757
773
  }
758
- this.onmessage?.(message, extra);
774
+ (_a2 = this.onmessage) == null ? void 0 : _a2.call(this, message, extra);
759
775
  };
760
776
  this.inner.onclose = () => {
761
- this.onclose?.();
777
+ var _a2;
778
+ (_a2 = this.onclose) == null ? void 0 : _a2.call(this);
762
779
  };
763
780
  this.inner.onerror = (error) => {
764
- this.onerror?.(error);
781
+ var _a2;
782
+ (_a2 = this.onerror) == null ? void 0 : _a2.call(this, error);
765
783
  };
766
784
  }
767
- onclose;
768
- onerror;
769
- onmessage;
770
785
  async start() {
771
786
  if (typeof this.inner.start === "function") {
772
787
  await this.inner.start();
@@ -843,14 +858,15 @@ var MCPClientManager = class {
843
858
  return true;
844
859
  }
845
860
  getTimeout(config) {
846
- return config.timeout ?? this.defaultTimeout;
861
+ var _a2;
862
+ return (_a2 = config.timeout) != null ? _a2 : this.defaultTimeout;
847
863
  }
848
864
  isStdioConfig(config) {
849
865
  return "command" in config;
850
866
  }
851
867
  getClientById(serverId) {
852
868
  const state = this.clientStates.get(serverId);
853
- if (!state?.client) {
869
+ if (!(state == null ? void 0 : state.client)) {
854
870
  throw new Error(`MCP server "${serverId}" is not connected.`);
855
871
  }
856
872
  return state.client;
@@ -2810,7 +2826,7 @@ import { MCPClient } from "@mastra/mcp";
2810
2826
  import { streamText as streamText2 } from "ai";
2811
2827
 
2812
2828
  // ../node_modules/convex/dist/esm/index.js
2813
- var version = "1.27.5";
2829
+ var version = "1.28.0";
2814
2830
 
2815
2831
  // ../node_modules/convex/dist/esm/values/base64.js
2816
2832
  var lookup = [];
@@ -3226,8 +3242,8 @@ function convexToJson(value) {
3226
3242
  }
3227
3243
 
3228
3244
  // ../node_modules/convex/dist/esm/values/errors.js
3229
- var __defProp = Object.defineProperty;
3230
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3245
+ var __defProp2 = Object.defineProperty;
3246
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3231
3247
  var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
3232
3248
  var _a;
3233
3249
  var _b;
@@ -3248,8 +3264,8 @@ var aBytes = arr();
3248
3264
  var bBytes = arr();
3249
3265
 
3250
3266
  // ../node_modules/convex/dist/esm/browser/logging.js
3251
- var __defProp2 = Object.defineProperty;
3252
- var __defNormalProp2 = (obj, key, value) => key in obj ? __defProp2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3267
+ var __defProp3 = Object.defineProperty;
3268
+ var __defNormalProp2 = (obj, key, value) => key in obj ? __defProp3(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3253
3269
  var __publicField2 = (obj, key, value) => __defNormalProp2(obj, typeof key !== "symbol" ? key + "" : key, value);
3254
3270
  var INFO_COLOR = "color:rgb(0, 145, 255)";
3255
3271
  function prefix_for_source(source) {
@@ -3442,8 +3458,8 @@ function createApi(pathParts = []) {
3442
3458
  var anyApi = createApi();
3443
3459
 
3444
3460
  // ../node_modules/convex/dist/esm/vendor/long.js
3445
- var __defProp3 = Object.defineProperty;
3446
- var __defNormalProp3 = (obj, key, value) => key in obj ? __defProp3(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3461
+ var __defProp4 = Object.defineProperty;
3462
+ var __defNormalProp3 = (obj, key, value) => key in obj ? __defProp4(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3447
3463
  var __publicField3 = (obj, key, value) => __defNormalProp3(obj, typeof key !== "symbol" ? key + "" : key, value);
3448
3464
  var Long = class _Long {
3449
3465
  constructor(low, high) {
@@ -3531,8 +3547,8 @@ import { createRequire } from "module";
3531
3547
  import { resolve as nodePathResolve } from "path";
3532
3548
 
3533
3549
  // ../node_modules/convex/dist/esm/browser/http_client.js
3534
- var __defProp4 = Object.defineProperty;
3535
- var __defNormalProp4 = (obj, key, value) => key in obj ? __defProp4(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3550
+ var __defProp5 = Object.defineProperty;
3551
+ var __defNormalProp4 = (obj, key, value) => key in obj ? __defProp5(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3536
3552
  var __publicField4 = (obj, key, value) => __defNormalProp4(obj, typeof key !== "symbol" ? key + "" : key, value);
3537
3553
  var STATUS_CODE_UDF_FAILED = 560;
3538
3554
  var specifiedFetch = void 0;
@@ -3979,7 +3995,7 @@ function setDefaultWebSocketConstructor(ws) {
3979
3995
  // ../node_modules/convex/dist/esm/browser/simple_client-node.js
3980
3996
  var require2 = createRequire(nodePathResolve("."));
3981
3997
  var __create = Object.create;
3982
- var __defProp5 = Object.defineProperty;
3998
+ var __defProp6 = Object.defineProperty;
3983
3999
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3984
4000
  var __getOwnPropNames = Object.getOwnPropertyNames;
3985
4001
  var __getProtoOf = Object.getPrototypeOf;
@@ -3997,7 +4013,7 @@ var __copyProps = (to, from, except, desc) => {
3997
4013
  if (from && typeof from === "object" || typeof from === "function") {
3998
4014
  for (let key of __getOwnPropNames(from))
3999
4015
  if (!__hasOwnProp.call(to, key) && key !== except)
4000
- __defProp5(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
4016
+ __defProp6(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
4001
4017
  }
4002
4018
  return to;
4003
4019
  };
@@ -4006,7 +4022,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
4006
4022
  // file that has been converted to a CommonJS file using a Babel-
4007
4023
  // compatible transform (i.e. "__esModule" has not been set), then set
4008
4024
  // "default" to the CommonJS "module.exports" for node compatibility.
4009
- isNodeMode || !mod || !mod.__esModule ? __defProp5(target, "default", { value: mod, enumerable: true }) : target,
4025
+ isNodeMode || !mod || !mod.__esModule ? __defProp6(target, "default", { value: mod, enumerable: true }) : target,
4010
4026
  mod
4011
4027
  ));
4012
4028
  var require_stream = __commonJS({