@settlemint/sdk-mcp 2.1.1 → 2.1.3-mainc3827cca

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.
Files changed (3) hide show
  1. package/dist/mcp.js +308 -102
  2. package/dist/mcp.js.map +15 -14
  3. package/package.json +4 -4
package/dist/mcp.js CHANGED
@@ -22251,6 +22251,9 @@ var require_utils2 = __commonJS((exports) => {
22251
22251
  exports.isNodeReadable = isNodeReadable;
22252
22252
  exports.isIterable = isIterable;
22253
22253
  exports.shouldRedirect = shouldRedirect;
22254
+ exports.wrapIncomingMessageWithPassthrough = wrapIncomingMessageWithPassthrough;
22255
+ var node_stream_1 = __require("node:stream");
22256
+ var promises_1 = __require("node:stream/promises");
22254
22257
  function isHeadersInstance(obj) {
22255
22258
  return obj?.forEach != null;
22256
22259
  }
@@ -22286,6 +22289,19 @@ var require_utils2 = __commonJS((exports) => {
22286
22289
  function shouldRedirect(status) {
22287
22290
  return status === 301 || status === 302 || status === 303 || status === 307 || status === 308;
22288
22291
  }
22292
+ function wrapIncomingMessageWithPassthrough({ incomingMessage, signal, passThrough = new node_stream_1.PassThrough, onError = (e) => {
22293
+ passThrough.destroy(e);
22294
+ } }) {
22295
+ (0, promises_1.pipeline)(incomingMessage, passThrough, {
22296
+ signal,
22297
+ end: true
22298
+ }).then(() => {
22299
+ if (!incomingMessage.destroyed) {
22300
+ incomingMessage.resume();
22301
+ }
22302
+ }).catch(onError);
22303
+ return passThrough;
22304
+ }
22289
22305
  });
22290
22306
 
22291
22307
  // ../../node_modules/@whatwg-node/node-fetch/cjs/ReadableStream.js
@@ -23324,7 +23340,6 @@ var require_Body = __commonJS((exports) => {
23324
23340
  var node_buffer_1 = __require("node:buffer");
23325
23341
  var node_http_1 = __require("node:http");
23326
23342
  var node_stream_1 = __require("node:stream");
23327
- var promises_1 = __require("node:stream/promises");
23328
23343
  var busboy_1 = tslib_1.__importDefault(require_lib());
23329
23344
  var promise_helpers_1 = require_cjs();
23330
23345
  var Blob_js_1 = require_Blob();
@@ -23716,17 +23731,10 @@ var require_Body = __commonJS((exports) => {
23716
23731
  };
23717
23732
  }
23718
23733
  if (bodyInit instanceof node_http_1.IncomingMessage) {
23719
- const passThrough = new node_stream_1.PassThrough({
23734
+ const passThrough = (0, utils_js_1.wrapIncomingMessageWithPassthrough)({
23735
+ incomingMessage: bodyInit,
23720
23736
  signal
23721
23737
  });
23722
- if (signal) {
23723
- (0, promises_1.pipeline)(bodyInit, passThrough, {
23724
- signal,
23725
- end: true
23726
- }).catch((e) => {
23727
- passThrough.destroy(e);
23728
- });
23729
- }
23730
23738
  return {
23731
23739
  bodyType: BodyInitType.Readable,
23732
23740
  contentType: null,
@@ -24141,7 +24149,6 @@ var require_fetchCurl = __commonJS((exports) => {
24141
24149
  Object.defineProperty(exports, "__esModule", { value: true });
24142
24150
  exports.fetchCurl = fetchCurl;
24143
24151
  var node_stream_1 = __require("node:stream");
24144
- var promises_1 = __require("node:stream/promises");
24145
24152
  var node_tls_1 = __require("node:tls");
24146
24153
  var promise_helpers_1 = require_cjs();
24147
24154
  var Response_js_1 = require_Response();
@@ -24232,15 +24239,11 @@ var require_fetchCurl = __commonJS((exports) => {
24232
24239
  }
24233
24240
  });
24234
24241
  curlHandle.once("stream", function streamListener(stream, status, headersBuf) {
24235
- const outputStream = new node_stream_1.PassThrough;
24236
- (0, promises_1.pipeline)(stream, outputStream, {
24237
- end: true,
24238
- signal: fetchRequest.signal
24239
- }).then(() => {
24240
- if (!stream.destroyed) {
24241
- stream.resume();
24242
- }
24243
- }).catch(deferredPromise.reject);
24242
+ const outputStream = (0, utils_js_1.wrapIncomingMessageWithPassthrough)({
24243
+ incomingMessage: stream,
24244
+ signal: fetchRequest.signal,
24245
+ onError: deferredPromise.reject
24246
+ });
24244
24247
  const headersFlat = headersBuf.toString("utf8").split(/\r?\n|\r/g).filter((headerFilter) => {
24245
24248
  if (headerFilter && !headerFilter.startsWith("HTTP/")) {
24246
24249
  if (fetchRequest.redirect === "error" && headerFilter.toLowerCase().includes("location") && (0, utils_js_1.shouldRedirect)(status)) {
@@ -24427,7 +24430,6 @@ var require_fetchNodeHttp = __commonJS((exports) => {
24427
24430
  var node_http_1 = __require("node:http");
24428
24431
  var node_https_1 = __require("node:https");
24429
24432
  var node_stream_1 = __require("node:stream");
24430
- var promises_1 = __require("node:stream/promises");
24431
24433
  var node_zlib_1 = __require("node:zlib");
24432
24434
  var Request_js_1 = require_Request();
24433
24435
  var Response_js_1 = require_Response();
@@ -24505,14 +24507,12 @@ var require_fetchNodeHttp = __commonJS((exports) => {
24505
24507
  }
24506
24508
  }
24507
24509
  if (outputStream != null) {
24508
- (0, promises_1.pipeline)(nodeResponse, outputStream, {
24510
+ outputStream = (0, utils_js_1.wrapIncomingMessageWithPassthrough)({
24511
+ incomingMessage: nodeResponse,
24512
+ passThrough: outputStream,
24509
24513
  signal: fetchRequest.signal,
24510
- end: true
24511
- }).then(() => {
24512
- if (!nodeResponse.destroyed) {
24513
- nodeResponse.resume();
24514
- }
24515
- }).catch(reject);
24514
+ onError: reject
24515
+ });
24516
24516
  }
24517
24517
  const statusCode = nodeResponse.statusCode || 200;
24518
24518
  let statusText = nodeResponse.statusMessage || node_http_1.STATUS_CODES[statusCode];
@@ -27223,7 +27223,7 @@ var require_dist2 = __commonJS((exports) => {
27223
27223
  // ../../node_modules/@dotenvx/dotenvx/package.json
27224
27224
  var require_package = __commonJS((exports, module) => {
27225
27225
  module.exports = {
27226
- version: "1.39.0",
27226
+ version: "1.39.1",
27227
27227
  name: "@dotenvx/dotenvx",
27228
27228
  description: "a better dotenv–from the creator of `dotenv`",
27229
27229
  author: "@motdotla",
@@ -29715,7 +29715,7 @@ var require_fsx = __commonJS((exports, module) => {
29715
29715
  var require_package2 = __commonJS((exports, module) => {
29716
29716
  module.exports = {
29717
29717
  name: "dotenv",
29718
- version: "16.4.7",
29718
+ version: "16.5.0",
29719
29719
  description: "Loads environment variables from .env file",
29720
29720
  main: "lib/main.js",
29721
29721
  types: "lib/main.d.ts",
@@ -29746,6 +29746,7 @@ var require_package2 = __commonJS((exports, module) => {
29746
29746
  type: "git",
29747
29747
  url: "git://github.com/motdotla/dotenv.git"
29748
29748
  },
29749
+ homepage: "https://github.com/motdotla/dotenv#readme",
29749
29750
  funding: "https://dotenvx.com",
29750
29751
  keywords: [
29751
29752
  "dotenv",
@@ -29831,9 +29832,6 @@ var require_main = __commonJS((exports, module) => {
29831
29832
  }
29832
29833
  return DotenvModule.parse(decrypted);
29833
29834
  }
29834
- function _log(message) {
29835
- console.log(`[dotenv@${version}][INFO] ${message}`);
29836
- }
29837
29835
  function _warn(message) {
29838
29836
  console.log(`[dotenv@${version}][WARN] ${message}`);
29839
29837
  }
@@ -29906,7 +29904,10 @@ var require_main = __commonJS((exports, module) => {
29906
29904
  return envPath[0] === "~" ? path.join(os.homedir(), envPath.slice(1)) : envPath;
29907
29905
  }
29908
29906
  function _configVault(options) {
29909
- _log("Loading env from encrypted .env.vault");
29907
+ const debug = Boolean(options && options.debug);
29908
+ if (debug) {
29909
+ _debug("Loading env from encrypted .env.vault");
29910
+ }
29910
29911
  const parsed = DotenvModule._parseVault(options);
29911
29912
  let processEnv = process.env;
29912
29913
  if (options && options.processEnv != null) {
@@ -44530,6 +44531,58 @@ function buildGraphQLWSExecutor(clientOptionsOrClient) {
44530
44531
  return executor2;
44531
44532
  }
44532
44533
 
44534
+ // ../../node_modules/@graphql-hive/signal/dist/index.js
44535
+ var isNode = !globalThis.Bun && globalThis.process?.release?.name === "node";
44536
+ var anySignalRegistry = isNode ? new FinalizationRegistry((cb) => cb()) : null;
44537
+ var controllerInSignalSy = Symbol("CONTROLLER_IN_SIGNAL");
44538
+ function abortSignalAny(signals) {
44539
+ if (signals.length === 0) {
44540
+ return;
44541
+ }
44542
+ if (signals.length === 1) {
44543
+ return signals[0];
44544
+ }
44545
+ if (!isNode) {
44546
+ return AbortSignal.any(signals);
44547
+ }
44548
+ for (const signal of signals) {
44549
+ if (signal.aborted) {
44550
+ return signal;
44551
+ }
44552
+ }
44553
+ const ctrl = new AbortController;
44554
+ const ctrlRef = new WeakRef(ctrl);
44555
+ const eventListenerPairs = [];
44556
+ let retainedSignalsCount = signals.length;
44557
+ for (const signal of signals) {
44558
+ let abort2 = function() {
44559
+ ctrlRef.deref()?.abort(signalRef.deref()?.reason);
44560
+ };
44561
+ const signalRef = new WeakRef(signal);
44562
+ signal.addEventListener("abort", abort2);
44563
+ eventListenerPairs.push([signalRef, abort2]);
44564
+ anySignalRegistry.register(signal, () => !--retainedSignalsCount && dispose(), signal);
44565
+ }
44566
+ function dispose() {
44567
+ for (const [signalRef, abort2] of eventListenerPairs) {
44568
+ const signal = signalRef.deref();
44569
+ if (signal) {
44570
+ signal.removeEventListener("abort", abort2);
44571
+ anySignalRegistry.unregister(signal);
44572
+ }
44573
+ const ctrl2 = ctrlRef.deref();
44574
+ if (ctrl2) {
44575
+ anySignalRegistry.unregister(ctrl2.signal);
44576
+ delete ctrl2.signal[controllerInSignalSy];
44577
+ }
44578
+ }
44579
+ }
44580
+ ctrl.signal.addEventListener("abort", dispose);
44581
+ anySignalRegistry.register(ctrl.signal, dispose, ctrl.signal);
44582
+ ctrl.signal[controllerInSignalSy] = ctrl;
44583
+ return ctrl.signal;
44584
+ }
44585
+
44533
44586
  // ../../node_modules/@whatwg-node/fetch/dist/node-ponyfill.js
44534
44587
  var createNodePonyfill = require_create_node_ponyfill();
44535
44588
  var shouldSkipPonyfill = require_shouldSkipPonyfill();
@@ -46020,9 +46073,10 @@ function prepareGETUrl({
46020
46073
  }
46021
46074
  function buildHTTPExecutor(options) {
46022
46075
  const printFn = options?.print ?? defaultPrintFn;
46023
- const disposeCtrl = new AbortController;
46076
+ let disposeCtrl;
46024
46077
  const serviceName = options?.serviceName;
46025
46078
  const baseExecutor = (request, excludeQuery) => {
46079
+ disposeCtrl ||= new AbortController;
46026
46080
  if (disposeCtrl.signal.aborted) {
46027
46081
  return createResultForAbort(disposeCtrl.signal.reason);
46028
46082
  }
@@ -46066,8 +46120,9 @@ function buildHTTPExecutor(options) {
46066
46120
  if (subscriptionCtrl) {
46067
46121
  signals.push(subscriptionCtrl.signal);
46068
46122
  }
46069
- const signal = AbortSignal.any(signals);
46123
+ const signal = abortSignalAny(signals);
46070
46124
  const upstreamErrorExtensions = {
46125
+ code: "DOWNSTREAM_SERVICE_ERROR",
46071
46126
  serviceName,
46072
46127
  request: {
46073
46128
  method
@@ -46224,6 +46279,14 @@ function buildHTTPExecutor(options) {
46224
46279
  ]
46225
46280
  };
46226
46281
  }
46282
+ } else {
46283
+ return {
46284
+ errors: [
46285
+ createGraphQLError("No response returned", {
46286
+ extensions: upstreamErrorExtensions
46287
+ })
46288
+ ]
46289
+ };
46227
46290
  }
46228
46291
  } else {
46229
46292
  return result;
@@ -46247,7 +46310,7 @@ function buildHTTPExecutor(options) {
46247
46310
  let result;
46248
46311
  let attempt = 0;
46249
46312
  function retryAttempt() {
46250
- if (disposeCtrl.signal.aborted) {
46313
+ if (disposeCtrl?.signal.aborted) {
46251
46314
  return createResultForAbort(disposeCtrl.signal.reason);
46252
46315
  }
46253
46316
  attempt++;
@@ -46274,14 +46337,16 @@ function buildHTTPExecutor(options) {
46274
46337
  [DisposableSymbols.dispose]: {
46275
46338
  get() {
46276
46339
  return function dispose() {
46277
- return disposeCtrl.abort(options?.getDisposeReason?.());
46340
+ disposeCtrl?.abort(options?.getDisposeReason?.());
46341
+ disposeCtrl = undefined;
46278
46342
  };
46279
46343
  }
46280
46344
  },
46281
46345
  [DisposableSymbols.asyncDispose]: {
46282
46346
  get() {
46283
46347
  return function asyncDispose() {
46284
- return disposeCtrl.abort(options?.getDisposeReason?.());
46348
+ disposeCtrl?.abort(options?.getDisposeReason?.());
46349
+ disposeCtrl = undefined;
46285
46350
  };
46286
46351
  }
46287
46352
  }
@@ -46901,13 +46966,14 @@ function executeField(exeContext, parentType, source, fieldNodes, path, asyncPay
46901
46966
  if (isPromise(completed)) {
46902
46967
  return completed.then(undefined, (rawError) => {
46903
46968
  if (rawError instanceof AggregateError) {
46904
- return new AggregateError(rawError.errors.map((rawErrorItem) => {
46969
+ let result2;
46970
+ for (let rawErrorItem of rawError.errors) {
46905
46971
  rawErrorItem = coerceError(rawErrorItem);
46906
46972
  const error2 = import_graphql47.locatedError(rawErrorItem, fieldNodes, pathToArray(path));
46907
- const handledError2 = handleFieldError(error2, returnType, errors2);
46973
+ result2 = handleFieldError(error2, returnType, errors2);
46908
46974
  filterSubsequentPayloads(exeContext, path, asyncPayloadRecord);
46909
- return handledError2;
46910
- }));
46975
+ }
46976
+ return result2;
46911
46977
  }
46912
46978
  rawError = coerceError(rawError);
46913
46979
  const error = import_graphql47.locatedError(rawError, fieldNodes, pathToArray(path));
@@ -46919,11 +46985,14 @@ function executeField(exeContext, parentType, source, fieldNodes, path, asyncPay
46919
46985
  return completed;
46920
46986
  } catch (rawError) {
46921
46987
  if (rawError instanceof AggregateError) {
46922
- return new AggregateError(rawError.errors.map((rawErrorItem) => {
46923
- const coercedError2 = coerceError(rawErrorItem);
46924
- const error2 = import_graphql47.locatedError(coercedError2, fieldNodes, pathToArray(path));
46925
- return handleFieldError(error2, returnType, errors2);
46926
- }));
46988
+ let result;
46989
+ for (let rawErrorItem of rawError.errors) {
46990
+ rawErrorItem = coerceError(rawErrorItem);
46991
+ const error2 = import_graphql47.locatedError(rawErrorItem, fieldNodes, pathToArray(path));
46992
+ result = handleFieldError(error2, returnType, errors2);
46993
+ filterSubsequentPayloads(exeContext, path, asyncPayloadRecord);
46994
+ }
46995
+ return result;
46927
46996
  }
46928
46997
  const coercedError = coerceError(rawError);
46929
46998
  const error = import_graphql47.locatedError(coercedError, fieldNodes, pathToArray(path));
@@ -54526,14 +54595,17 @@ var JSONRPCRequestSchema = z.object({
54526
54595
  jsonrpc: z.literal(JSONRPC_VERSION),
54527
54596
  id: RequestIdSchema
54528
54597
  }).merge(RequestSchema).strict();
54598
+ var isJSONRPCRequest = (value) => JSONRPCRequestSchema.safeParse(value).success;
54529
54599
  var JSONRPCNotificationSchema = z.object({
54530
54600
  jsonrpc: z.literal(JSONRPC_VERSION)
54531
54601
  }).merge(NotificationSchema).strict();
54602
+ var isJSONRPCNotification = (value) => JSONRPCNotificationSchema.safeParse(value).success;
54532
54603
  var JSONRPCResponseSchema = z.object({
54533
54604
  jsonrpc: z.literal(JSONRPC_VERSION),
54534
54605
  id: RequestIdSchema,
54535
54606
  result: ResultSchema
54536
54607
  }).strict();
54608
+ var isJSONRPCResponse = (value) => JSONRPCResponseSchema.safeParse(value).success;
54537
54609
  var ErrorCode;
54538
54610
  (function(ErrorCode2) {
54539
54611
  ErrorCode2[ErrorCode2["ConnectionClosed"] = -32000] = "ConnectionClosed";
@@ -54553,6 +54625,7 @@ var JSONRPCErrorSchema = z.object({
54553
54625
  data: z.optional(z.unknown())
54554
54626
  })
54555
54627
  }).strict();
54628
+ var isJSONRPCError = (value) => JSONRPCErrorSchema.safeParse(value).success;
54556
54629
  var JSONRPCMessageSchema = z.union([
54557
54630
  JSONRPCRequestSchema,
54558
54631
  JSONRPCNotificationSchema,
@@ -55003,13 +55076,15 @@ class Protocol {
55003
55076
  this._transport.onerror = (error) => {
55004
55077
  this._onerror(error);
55005
55078
  };
55006
- this._transport.onmessage = (message) => {
55007
- if (!("method" in message)) {
55079
+ this._transport.onmessage = (message, extra) => {
55080
+ if (isJSONRPCResponse(message) || isJSONRPCError(message)) {
55008
55081
  this._onresponse(message);
55009
- } else if ("id" in message) {
55010
- this._onrequest(message);
55011
- } else {
55082
+ } else if (isJSONRPCRequest(message)) {
55083
+ this._onrequest(message, extra);
55084
+ } else if (isJSONRPCNotification(message)) {
55012
55085
  this._onnotification(message);
55086
+ } else {
55087
+ this._onerror(new Error(`Unknown message type: ${JSON.stringify(message)}`));
55013
55088
  }
55014
55089
  };
55015
55090
  await this._transport.start();
@@ -55038,7 +55113,7 @@ class Protocol {
55038
55113
  }
55039
55114
  Promise.resolve().then(() => handler(notification)).catch((error) => this._onerror(new Error(`Uncaught error in notification handler: ${error}`)));
55040
55115
  }
55041
- _onrequest(request) {
55116
+ _onrequest(request, extra) {
55042
55117
  var _a, _b, _c;
55043
55118
  const handler = (_a = this._requestHandlers.get(request.method)) !== null && _a !== undefined ? _a : this.fallbackRequestHandler;
55044
55119
  if (handler === undefined) {
@@ -55054,11 +55129,14 @@ class Protocol {
55054
55129
  }
55055
55130
  const abortController = new AbortController;
55056
55131
  this._requestHandlerAbortControllers.set(request.id, abortController);
55057
- const extra = {
55132
+ const fullExtra = {
55058
55133
  signal: abortController.signal,
55059
- sessionId: (_c = this._transport) === null || _c === undefined ? undefined : _c.sessionId
55134
+ sessionId: (_c = this._transport) === null || _c === undefined ? undefined : _c.sessionId,
55135
+ sendNotification: (notification) => this.notification(notification, { relatedRequestId: request.id }),
55136
+ sendRequest: (r, resultSchema, options) => this.request(r, resultSchema, { ...options, relatedRequestId: request.id }),
55137
+ authInfo: extra === null || extra === undefined ? undefined : extra.authInfo
55060
55138
  };
55061
- Promise.resolve().then(() => handler(request, extra)).then((result) => {
55139
+ Promise.resolve().then(() => handler(request, fullExtra)).then((result) => {
55062
55140
  var _a2;
55063
55141
  if (abortController.signal.aborted) {
55064
55142
  return;
@@ -55115,7 +55193,7 @@ class Protocol {
55115
55193
  this._responseHandlers.delete(messageId);
55116
55194
  this._progressHandlers.delete(messageId);
55117
55195
  this._cleanupTimeout(messageId);
55118
- if ("result" in response) {
55196
+ if (isJSONRPCResponse(response)) {
55119
55197
  handler(response);
55120
55198
  } else {
55121
55199
  const error = new McpError(response.error.code, response.error.message, response.error.data);
@@ -55130,6 +55208,7 @@ class Protocol {
55130
55208
  await ((_a = this._transport) === null || _a === undefined ? undefined : _a.close());
55131
55209
  }
55132
55210
  request(request, resultSchema, options) {
55211
+ const { relatedRequestId, resumptionToken, onresumptiontoken } = options !== null && options !== undefined ? options : {};
55133
55212
  return new Promise((resolve, reject2) => {
55134
55213
  var _a, _b, _c, _d, _e;
55135
55214
  if (!this._transport) {
@@ -55165,7 +55244,7 @@ class Protocol {
55165
55244
  requestId: messageId,
55166
55245
  reason: String(reason)
55167
55246
  }
55168
- }).catch((error) => this._onerror(new Error(`Failed to send cancellation: ${error}`)));
55247
+ }, { relatedRequestId, resumptionToken, onresumptiontoken }).catch((error) => this._onerror(new Error(`Failed to send cancellation: ${error}`)));
55169
55248
  reject2(reason);
55170
55249
  };
55171
55250
  this._responseHandlers.set(messageId, (response) => {
@@ -55190,13 +55269,13 @@ class Protocol {
55190
55269
  const timeout = (_d = options === null || options === undefined ? undefined : options.timeout) !== null && _d !== undefined ? _d : DEFAULT_REQUEST_TIMEOUT_MSEC;
55191
55270
  const timeoutHandler = () => cancel(new McpError(ErrorCode.RequestTimeout, "Request timed out", { timeout }));
55192
55271
  this._setupTimeout(messageId, timeout, options === null || options === undefined ? undefined : options.maxTotalTimeout, timeoutHandler, (_e = options === null || options === undefined ? undefined : options.resetTimeoutOnProgress) !== null && _e !== undefined ? _e : false);
55193
- this._transport.send(jsonrpcRequest).catch((error) => {
55272
+ this._transport.send(jsonrpcRequest, { relatedRequestId, resumptionToken, onresumptiontoken }).catch((error) => {
55194
55273
  this._cleanupTimeout(messageId);
55195
55274
  reject2(error);
55196
55275
  });
55197
55276
  });
55198
55277
  }
55199
- async notification(notification) {
55278
+ async notification(notification, options) {
55200
55279
  if (!this._transport) {
55201
55280
  throw new Error("Not connected");
55202
55281
  }
@@ -55205,12 +55284,14 @@ class Protocol {
55205
55284
  ...notification,
55206
55285
  jsonrpc: "2.0"
55207
55286
  };
55208
- await this._transport.send(jsonrpcNotification);
55287
+ await this._transport.send(jsonrpcNotification, options);
55209
55288
  }
55210
55289
  setRequestHandler(requestSchema, handler) {
55211
55290
  const method = requestSchema.shape.method.value;
55212
55291
  this.assertRequestHandlerCapability(method);
55213
- this._requestHandlers.set(method, (request, extra) => Promise.resolve(handler(requestSchema.parse(request), extra)));
55292
+ this._requestHandlers.set(method, (request, extra) => {
55293
+ return Promise.resolve(handler(requestSchema.parse(request), extra));
55294
+ });
55214
55295
  }
55215
55296
  removeRequestHandler(method) {
55216
55297
  this._requestHandlers.delete(method);
@@ -56672,10 +56753,12 @@ class McpServer {
56672
56753
  this.server.assertCanSetRequestHandler(ListToolsRequestSchema.shape.method.value);
56673
56754
  this.server.assertCanSetRequestHandler(CallToolRequestSchema.shape.method.value);
56674
56755
  this.server.registerCapabilities({
56675
- tools: {}
56756
+ tools: {
56757
+ listChanged: true
56758
+ }
56676
56759
  });
56677
56760
  this.server.setRequestHandler(ListToolsRequestSchema, () => ({
56678
- tools: Object.entries(this._registeredTools).map(([name, tool]) => {
56761
+ tools: Object.entries(this._registeredTools).filter(([, tool]) => tool.enabled).map(([name, tool]) => {
56679
56762
  return {
56680
56763
  name,
56681
56764
  description: tool.description,
@@ -56690,6 +56773,9 @@ class McpServer {
56690
56773
  if (!tool) {
56691
56774
  throw new McpError(ErrorCode.InvalidParams, `Tool ${request.params.name} not found`);
56692
56775
  }
56776
+ if (!tool.enabled) {
56777
+ throw new McpError(ErrorCode.InvalidParams, `Tool ${request.params.name} disabled`);
56778
+ }
56693
56779
  if (tool.inputSchema) {
56694
56780
  const parseResult = await tool.inputSchema.safeParseAsync(request.params.arguments);
56695
56781
  if (!parseResult.success) {
@@ -56749,7 +56835,10 @@ class McpServer {
56749
56835
  async handlePromptCompletion(request, ref) {
56750
56836
  const prompt = this._registeredPrompts[ref.name];
56751
56837
  if (!prompt) {
56752
- throw new McpError(ErrorCode.InvalidParams, `Prompt ${request.params.ref.name} not found`);
56838
+ throw new McpError(ErrorCode.InvalidParams, `Prompt ${ref.name} not found`);
56839
+ }
56840
+ if (!prompt.enabled) {
56841
+ throw new McpError(ErrorCode.InvalidParams, `Prompt ${ref.name} disabled`);
56753
56842
  }
56754
56843
  if (!prompt.argsSchema) {
56755
56844
  return EMPTY_COMPLETION_RESULT;
@@ -56785,10 +56874,12 @@ class McpServer {
56785
56874
  this.server.assertCanSetRequestHandler(ListResourceTemplatesRequestSchema.shape.method.value);
56786
56875
  this.server.assertCanSetRequestHandler(ReadResourceRequestSchema.shape.method.value);
56787
56876
  this.server.registerCapabilities({
56788
- resources: {}
56877
+ resources: {
56878
+ listChanged: true
56879
+ }
56789
56880
  });
56790
56881
  this.server.setRequestHandler(ListResourcesRequestSchema, async (request, extra) => {
56791
- const resources = Object.entries(this._registeredResources).map(([uri, resource]) => ({
56882
+ const resources = Object.entries(this._registeredResources).filter(([_, resource]) => resource.enabled).map(([uri, resource]) => ({
56792
56883
  uri,
56793
56884
  name: resource.name,
56794
56885
  ...resource.metadata
@@ -56820,6 +56911,9 @@ class McpServer {
56820
56911
  const uri = new URL(request.params.uri);
56821
56912
  const resource = this._registeredResources[uri.toString()];
56822
56913
  if (resource) {
56914
+ if (!resource.enabled) {
56915
+ throw new McpError(ErrorCode.InvalidParams, `Resource ${uri} disabled`);
56916
+ }
56823
56917
  return resource.readCallback(uri, extra);
56824
56918
  }
56825
56919
  for (const template of Object.values(this._registeredResourceTemplates)) {
@@ -56840,10 +56934,12 @@ class McpServer {
56840
56934
  this.server.assertCanSetRequestHandler(ListPromptsRequestSchema.shape.method.value);
56841
56935
  this.server.assertCanSetRequestHandler(GetPromptRequestSchema.shape.method.value);
56842
56936
  this.server.registerCapabilities({
56843
- prompts: {}
56937
+ prompts: {
56938
+ listChanged: true
56939
+ }
56844
56940
  });
56845
56941
  this.server.setRequestHandler(ListPromptsRequestSchema, () => ({
56846
- prompts: Object.entries(this._registeredPrompts).map(([name, prompt]) => {
56942
+ prompts: Object.entries(this._registeredPrompts).filter(([, prompt]) => prompt.enabled).map(([name, prompt]) => {
56847
56943
  return {
56848
56944
  name,
56849
56945
  description: prompt.description,
@@ -56856,6 +56952,9 @@ class McpServer {
56856
56952
  if (!prompt) {
56857
56953
  throw new McpError(ErrorCode.InvalidParams, `Prompt ${request.params.name} not found`);
56858
56954
  }
56955
+ if (!prompt.enabled) {
56956
+ throw new McpError(ErrorCode.InvalidParams, `Prompt ${request.params.name} disabled`);
56957
+ }
56859
56958
  if (prompt.argsSchema) {
56860
56959
  const parseResult = await prompt.argsSchema.safeParseAsync(request.params.arguments);
56861
56960
  if (!parseResult.success) {
@@ -56882,22 +56981,69 @@ class McpServer {
56882
56981
  if (this._registeredResources[uriOrTemplate]) {
56883
56982
  throw new Error(`Resource ${uriOrTemplate} is already registered`);
56884
56983
  }
56885
- this._registeredResources[uriOrTemplate] = {
56984
+ const registeredResource = {
56886
56985
  name,
56887
56986
  metadata,
56888
- readCallback
56987
+ readCallback,
56988
+ enabled: true,
56989
+ disable: () => registeredResource.update({ enabled: false }),
56990
+ enable: () => registeredResource.update({ enabled: true }),
56991
+ remove: () => registeredResource.update({ uri: null }),
56992
+ update: (updates) => {
56993
+ if (typeof updates.uri !== "undefined" && updates.uri !== uriOrTemplate) {
56994
+ delete this._registeredResources[uriOrTemplate];
56995
+ if (updates.uri)
56996
+ this._registeredResources[updates.uri] = registeredResource;
56997
+ }
56998
+ if (typeof updates.name !== "undefined")
56999
+ registeredResource.name = updates.name;
57000
+ if (typeof updates.metadata !== "undefined")
57001
+ registeredResource.metadata = updates.metadata;
57002
+ if (typeof updates.callback !== "undefined")
57003
+ registeredResource.readCallback = updates.callback;
57004
+ if (typeof updates.enabled !== "undefined")
57005
+ registeredResource.enabled = updates.enabled;
57006
+ this.sendResourceListChanged();
57007
+ }
56889
57008
  };
57009
+ this._registeredResources[uriOrTemplate] = registeredResource;
57010
+ this.setResourceRequestHandlers();
57011
+ this.sendResourceListChanged();
57012
+ return registeredResource;
56890
57013
  } else {
56891
57014
  if (this._registeredResourceTemplates[name]) {
56892
57015
  throw new Error(`Resource template ${name} is already registered`);
56893
57016
  }
56894
- this._registeredResourceTemplates[name] = {
57017
+ const registeredResourceTemplate = {
56895
57018
  resourceTemplate: uriOrTemplate,
56896
57019
  metadata,
56897
- readCallback
57020
+ readCallback,
57021
+ enabled: true,
57022
+ disable: () => registeredResourceTemplate.update({ enabled: false }),
57023
+ enable: () => registeredResourceTemplate.update({ enabled: true }),
57024
+ remove: () => registeredResourceTemplate.update({ name: null }),
57025
+ update: (updates) => {
57026
+ if (typeof updates.name !== "undefined" && updates.name !== name) {
57027
+ delete this._registeredResourceTemplates[name];
57028
+ if (updates.name)
57029
+ this._registeredResourceTemplates[updates.name] = registeredResourceTemplate;
57030
+ }
57031
+ if (typeof updates.template !== "undefined")
57032
+ registeredResourceTemplate.resourceTemplate = updates.template;
57033
+ if (typeof updates.metadata !== "undefined")
57034
+ registeredResourceTemplate.metadata = updates.metadata;
57035
+ if (typeof updates.callback !== "undefined")
57036
+ registeredResourceTemplate.readCallback = updates.callback;
57037
+ if (typeof updates.enabled !== "undefined")
57038
+ registeredResourceTemplate.enabled = updates.enabled;
57039
+ this.sendResourceListChanged();
57040
+ }
56898
57041
  };
57042
+ this._registeredResourceTemplates[name] = registeredResourceTemplate;
57043
+ this.setResourceRequestHandlers();
57044
+ this.sendResourceListChanged();
57045
+ return registeredResourceTemplate;
56899
57046
  }
56900
- this.setResourceRequestHandlers();
56901
57047
  }
56902
57048
  tool(name, ...rest) {
56903
57049
  if (this._registeredTools[name]) {
@@ -56912,12 +57058,35 @@ class McpServer {
56912
57058
  paramsSchema = rest.shift();
56913
57059
  }
56914
57060
  const cb = rest[0];
56915
- this._registeredTools[name] = {
57061
+ const registeredTool = {
56916
57062
  description,
56917
57063
  inputSchema: paramsSchema === undefined ? undefined : z.object(paramsSchema),
56918
- callback: cb
57064
+ callback: cb,
57065
+ enabled: true,
57066
+ disable: () => registeredTool.update({ enabled: false }),
57067
+ enable: () => registeredTool.update({ enabled: true }),
57068
+ remove: () => registeredTool.update({ name: null }),
57069
+ update: (updates) => {
57070
+ if (typeof updates.name !== "undefined" && updates.name !== name) {
57071
+ delete this._registeredTools[name];
57072
+ if (updates.name)
57073
+ this._registeredTools[updates.name] = registeredTool;
57074
+ }
57075
+ if (typeof updates.description !== "undefined")
57076
+ registeredTool.description = updates.description;
57077
+ if (typeof updates.paramsSchema !== "undefined")
57078
+ registeredTool.inputSchema = z.object(updates.paramsSchema);
57079
+ if (typeof updates.callback !== "undefined")
57080
+ registeredTool.callback = updates.callback;
57081
+ if (typeof updates.enabled !== "undefined")
57082
+ registeredTool.enabled = updates.enabled;
57083
+ this.sendToolListChanged();
57084
+ }
56919
57085
  };
57086
+ this._registeredTools[name] = registeredTool;
56920
57087
  this.setToolRequestHandlers();
57088
+ this.sendToolListChanged();
57089
+ return registeredTool;
56921
57090
  }
56922
57091
  prompt(name, ...rest) {
56923
57092
  if (this._registeredPrompts[name]) {
@@ -56932,12 +57101,53 @@ class McpServer {
56932
57101
  argsSchema = rest.shift();
56933
57102
  }
56934
57103
  const cb = rest[0];
56935
- this._registeredPrompts[name] = {
57104
+ const registeredPrompt = {
56936
57105
  description,
56937
57106
  argsSchema: argsSchema === undefined ? undefined : z.object(argsSchema),
56938
- callback: cb
57107
+ callback: cb,
57108
+ enabled: true,
57109
+ disable: () => registeredPrompt.update({ enabled: false }),
57110
+ enable: () => registeredPrompt.update({ enabled: true }),
57111
+ remove: () => registeredPrompt.update({ name: null }),
57112
+ update: (updates) => {
57113
+ if (typeof updates.name !== "undefined" && updates.name !== name) {
57114
+ delete this._registeredPrompts[name];
57115
+ if (updates.name)
57116
+ this._registeredPrompts[updates.name] = registeredPrompt;
57117
+ }
57118
+ if (typeof updates.description !== "undefined")
57119
+ registeredPrompt.description = updates.description;
57120
+ if (typeof updates.argsSchema !== "undefined")
57121
+ registeredPrompt.argsSchema = z.object(updates.argsSchema);
57122
+ if (typeof updates.callback !== "undefined")
57123
+ registeredPrompt.callback = updates.callback;
57124
+ if (typeof updates.enabled !== "undefined")
57125
+ registeredPrompt.enabled = updates.enabled;
57126
+ this.sendPromptListChanged();
57127
+ }
56939
57128
  };
57129
+ this._registeredPrompts[name] = registeredPrompt;
56940
57130
  this.setPromptRequestHandlers();
57131
+ this.sendPromptListChanged();
57132
+ return registeredPrompt;
57133
+ }
57134
+ isConnected() {
57135
+ return this.server.transport !== undefined;
57136
+ }
57137
+ sendResourceListChanged() {
57138
+ if (this.isConnected()) {
57139
+ this.server.sendResourceListChanged();
57140
+ }
57141
+ }
57142
+ sendToolListChanged() {
57143
+ if (this.isConnected()) {
57144
+ this.server.sendToolListChanged();
57145
+ }
57146
+ }
57147
+ sendPromptListChanged() {
57148
+ if (this.isConnected()) {
57149
+ this.server.sendPromptListChanged();
57150
+ }
56941
57151
  }
56942
57152
  }
56943
57153
  var EMPTY_OBJECT_JSON_SCHEMA = {
@@ -62625,7 +62835,7 @@ var {
62625
62835
  var package_default = {
62626
62836
  name: "@settlemint/sdk-mcp",
62627
62837
  description: "MCP interface for SettleMint SDK, providing development tools and project management capabilities",
62628
- version: "2.1.1",
62838
+ version: "2.1.3-mainc3827cca",
62629
62839
  type: "module",
62630
62840
  private: false,
62631
62841
  license: "FSL-1.1-MIT",
@@ -62666,9 +62876,9 @@ var package_default = {
62666
62876
  dependencies: {
62667
62877
  "@graphql-tools/load": "8.1.0",
62668
62878
  "@graphql-tools/url-loader": "8.0.31",
62669
- "@modelcontextprotocol/sdk": "1.9.0",
62670
- "@settlemint/sdk-js": "2.1.1",
62671
- "@settlemint/sdk-utils": "2.1.1",
62879
+ "@modelcontextprotocol/sdk": "1.10.0",
62880
+ "@settlemint/sdk-js": "2.1.3-mainc3827cca",
62881
+ "@settlemint/sdk-utils": "2.1.3-mainc3827cca",
62672
62882
  "@commander-js/extra-typings": "11.1.0",
62673
62883
  commander: "11.1.0",
62674
62884
  zod: "3.24.2"
@@ -63835,7 +64045,7 @@ async function fetchWithRetry(input, init, maxRetries = 5, initialSleepTime = 30
63835
64045
 
63836
64046
  // ../../node_modules/environment/index.js
63837
64047
  var isBrowser = globalThis.window?.document !== undefined;
63838
- var isNode = globalThis.process?.versions?.node !== undefined;
64048
+ var isNode2 = globalThis.process?.versions?.node !== undefined;
63839
64049
  var isBun = globalThis.process?.versions?.bun !== undefined;
63840
64050
  var isDeno = globalThis.Deno?.version?.deno !== undefined;
63841
64051
  var isElectron = globalThis.process?.versions?.electron !== undefined;
@@ -66275,24 +66485,18 @@ function generateResponse(pincode, salt, challenge) {
66275
66485
  const hashedPincode = hashPincode(pincode, salt);
66276
66486
  return createHash("sha256").update(`${hashedPincode}_${challenge}`).digest("hex");
66277
66487
  }
66278
- async function getPincodeVerificationResponse({
66488
+ async function getPincodeVerificationChallenges({
66279
66489
  userWalletAddress,
66280
- pincode,
66281
66490
  accessToken,
66282
66491
  instance,
66283
66492
  nodeId
66284
66493
  }) {
66285
- const response = await fetch(`${instance}/cm/nodes/${encodeURIComponent(nodeId)}/user-wallets/${encodeURIComponent(userWalletAddress)}/verifications/challenges`, {
66494
+ const response = await fetch(`${instance}/cm/nodes/${encodeURIComponent(nodeId)}/user-wallets/${encodeURIComponent(userWalletAddress)}/verifications/challenges?type=PINCODE`, {
66286
66495
  method: "POST",
66287
66496
  headers: {
66288
66497
  "Content-Type": "application/json",
66289
66498
  "x-auth-token": accessToken
66290
- },
66291
- body: JSON.stringify({
66292
- pincode,
66293
- verificationType: "PINCODE",
66294
- name: "pincode"
66295
- })
66499
+ }
66296
66500
  });
66297
66501
  if (!response.ok) {
66298
66502
  if (response.status === 404) {
@@ -66301,15 +66505,16 @@ async function getPincodeVerificationResponse({
66301
66505
  throw new Error("Failed to get verification challenge");
66302
66506
  }
66303
66507
  const verificationChallenges = await response.json();
66304
- if (!verificationChallenges.length) {
66305
- throw new Error("No verification challenges received");
66306
- }
66307
- const firstChallenge = verificationChallenges[0];
66308
- const challenge = firstChallenge?.challenge;
66309
- if (!challenge?.secret || !challenge?.salt) {
66508
+ return verificationChallenges;
66509
+ }
66510
+ function getPincodeVerificationChallengeResponse({
66511
+ verificationChallenge,
66512
+ pincode
66513
+ }) {
66514
+ if (!verificationChallenge?.challenge?.secret || !verificationChallenge?.challenge?.salt) {
66310
66515
  throw new Error("Could not authenticate pin code, invalid challenge format");
66311
66516
  }
66312
- const { secret, salt } = challenge;
66517
+ const { secret, salt } = verificationChallenge.challenge;
66313
66518
  return generateResponse(pincode, salt, secret);
66314
66519
  }
66315
66520
  function createSettleMintClient(options) {
@@ -66411,7 +66616,8 @@ function createSettleMintClient(options) {
66411
66616
  config: getPlatformConfig(gqlClient)
66412
66617
  },
66413
66618
  wallet: {
66414
- pincodeVerificationResponse: (args) => getPincodeVerificationResponse({
66619
+ pincodeVerificationChallengeResponse: getPincodeVerificationChallengeResponse,
66620
+ pincodeVerificationChallenges: (args) => getPincodeVerificationChallenges({
66415
66621
  ...args,
66416
66622
  instance: validatedOptions.instance,
66417
66623
  accessToken: validatedOptions.accessToken
@@ -68090,4 +68296,4 @@ await main().catch((error2) => {
68090
68296
  process.exit(1);
68091
68297
  });
68092
68298
 
68093
- //# debugId=29A96A4A2B64D19364756E2164756E21
68299
+ //# debugId=074C86FEF5CC8E3064756E2164756E21