@ivotoby/openapi-mcp-server 0.1.0 → 1.1.0

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/README.md +116 -39
  2. package/dist/bundle.js +1502 -68
  3. package/package.json +26 -10
package/dist/bundle.js CHANGED
@@ -296,9 +296,9 @@ var require_combined_stream = __commonJS({
296
296
  }
297
297
  });
298
298
 
299
- // node_modules/mime-db/db.json
299
+ // node_modules/form-data/node_modules/mime-db/db.json
300
300
  var require_db = __commonJS({
301
- "node_modules/mime-db/db.json"(exports, module) {
301
+ "node_modules/form-data/node_modules/mime-db/db.json"(exports, module) {
302
302
  module.exports = {
303
303
  "application/1d-interleaved-parityfec": {
304
304
  source: "iana"
@@ -8821,16 +8821,16 @@ var require_db = __commonJS({
8821
8821
  }
8822
8822
  });
8823
8823
 
8824
- // node_modules/mime-db/index.js
8824
+ // node_modules/form-data/node_modules/mime-db/index.js
8825
8825
  var require_mime_db = __commonJS({
8826
- "node_modules/mime-db/index.js"(exports, module) {
8826
+ "node_modules/form-data/node_modules/mime-db/index.js"(exports, module) {
8827
8827
  module.exports = require_db();
8828
8828
  }
8829
8829
  });
8830
8830
 
8831
- // node_modules/mime-types/index.js
8831
+ // node_modules/form-data/node_modules/mime-types/index.js
8832
8832
  var require_mime_types = __commonJS({
8833
- "node_modules/mime-types/index.js"(exports) {
8833
+ "node_modules/form-data/node_modules/mime-types/index.js"(exports) {
8834
8834
  "use strict";
8835
8835
  var db = require_mime_db();
8836
8836
  var extname2 = __require("path").extname;
@@ -9127,6 +9127,852 @@ var require_asynckit = __commonJS({
9127
9127
  }
9128
9128
  });
9129
9129
 
9130
+ // node_modules/es-object-atoms/index.js
9131
+ var require_es_object_atoms = __commonJS({
9132
+ "node_modules/es-object-atoms/index.js"(exports, module) {
9133
+ "use strict";
9134
+ module.exports = Object;
9135
+ }
9136
+ });
9137
+
9138
+ // node_modules/es-errors/index.js
9139
+ var require_es_errors = __commonJS({
9140
+ "node_modules/es-errors/index.js"(exports, module) {
9141
+ "use strict";
9142
+ module.exports = Error;
9143
+ }
9144
+ });
9145
+
9146
+ // node_modules/es-errors/eval.js
9147
+ var require_eval = __commonJS({
9148
+ "node_modules/es-errors/eval.js"(exports, module) {
9149
+ "use strict";
9150
+ module.exports = EvalError;
9151
+ }
9152
+ });
9153
+
9154
+ // node_modules/es-errors/range.js
9155
+ var require_range = __commonJS({
9156
+ "node_modules/es-errors/range.js"(exports, module) {
9157
+ "use strict";
9158
+ module.exports = RangeError;
9159
+ }
9160
+ });
9161
+
9162
+ // node_modules/es-errors/ref.js
9163
+ var require_ref = __commonJS({
9164
+ "node_modules/es-errors/ref.js"(exports, module) {
9165
+ "use strict";
9166
+ module.exports = ReferenceError;
9167
+ }
9168
+ });
9169
+
9170
+ // node_modules/es-errors/syntax.js
9171
+ var require_syntax = __commonJS({
9172
+ "node_modules/es-errors/syntax.js"(exports, module) {
9173
+ "use strict";
9174
+ module.exports = SyntaxError;
9175
+ }
9176
+ });
9177
+
9178
+ // node_modules/es-errors/type.js
9179
+ var require_type = __commonJS({
9180
+ "node_modules/es-errors/type.js"(exports, module) {
9181
+ "use strict";
9182
+ module.exports = TypeError;
9183
+ }
9184
+ });
9185
+
9186
+ // node_modules/es-errors/uri.js
9187
+ var require_uri = __commonJS({
9188
+ "node_modules/es-errors/uri.js"(exports, module) {
9189
+ "use strict";
9190
+ module.exports = URIError;
9191
+ }
9192
+ });
9193
+
9194
+ // node_modules/math-intrinsics/abs.js
9195
+ var require_abs = __commonJS({
9196
+ "node_modules/math-intrinsics/abs.js"(exports, module) {
9197
+ "use strict";
9198
+ module.exports = Math.abs;
9199
+ }
9200
+ });
9201
+
9202
+ // node_modules/math-intrinsics/floor.js
9203
+ var require_floor = __commonJS({
9204
+ "node_modules/math-intrinsics/floor.js"(exports, module) {
9205
+ "use strict";
9206
+ module.exports = Math.floor;
9207
+ }
9208
+ });
9209
+
9210
+ // node_modules/math-intrinsics/max.js
9211
+ var require_max = __commonJS({
9212
+ "node_modules/math-intrinsics/max.js"(exports, module) {
9213
+ "use strict";
9214
+ module.exports = Math.max;
9215
+ }
9216
+ });
9217
+
9218
+ // node_modules/math-intrinsics/min.js
9219
+ var require_min = __commonJS({
9220
+ "node_modules/math-intrinsics/min.js"(exports, module) {
9221
+ "use strict";
9222
+ module.exports = Math.min;
9223
+ }
9224
+ });
9225
+
9226
+ // node_modules/math-intrinsics/pow.js
9227
+ var require_pow = __commonJS({
9228
+ "node_modules/math-intrinsics/pow.js"(exports, module) {
9229
+ "use strict";
9230
+ module.exports = Math.pow;
9231
+ }
9232
+ });
9233
+
9234
+ // node_modules/math-intrinsics/round.js
9235
+ var require_round = __commonJS({
9236
+ "node_modules/math-intrinsics/round.js"(exports, module) {
9237
+ "use strict";
9238
+ module.exports = Math.round;
9239
+ }
9240
+ });
9241
+
9242
+ // node_modules/math-intrinsics/isNaN.js
9243
+ var require_isNaN = __commonJS({
9244
+ "node_modules/math-intrinsics/isNaN.js"(exports, module) {
9245
+ "use strict";
9246
+ module.exports = Number.isNaN || function isNaN2(a) {
9247
+ return a !== a;
9248
+ };
9249
+ }
9250
+ });
9251
+
9252
+ // node_modules/math-intrinsics/sign.js
9253
+ var require_sign = __commonJS({
9254
+ "node_modules/math-intrinsics/sign.js"(exports, module) {
9255
+ "use strict";
9256
+ var $isNaN = require_isNaN();
9257
+ module.exports = function sign(number) {
9258
+ if ($isNaN(number) || number === 0) {
9259
+ return number;
9260
+ }
9261
+ return number < 0 ? -1 : 1;
9262
+ };
9263
+ }
9264
+ });
9265
+
9266
+ // node_modules/gopd/gOPD.js
9267
+ var require_gOPD = __commonJS({
9268
+ "node_modules/gopd/gOPD.js"(exports, module) {
9269
+ "use strict";
9270
+ module.exports = Object.getOwnPropertyDescriptor;
9271
+ }
9272
+ });
9273
+
9274
+ // node_modules/gopd/index.js
9275
+ var require_gopd = __commonJS({
9276
+ "node_modules/gopd/index.js"(exports, module) {
9277
+ "use strict";
9278
+ var $gOPD = require_gOPD();
9279
+ if ($gOPD) {
9280
+ try {
9281
+ $gOPD([], "length");
9282
+ } catch (e) {
9283
+ $gOPD = null;
9284
+ }
9285
+ }
9286
+ module.exports = $gOPD;
9287
+ }
9288
+ });
9289
+
9290
+ // node_modules/es-define-property/index.js
9291
+ var require_es_define_property = __commonJS({
9292
+ "node_modules/es-define-property/index.js"(exports, module) {
9293
+ "use strict";
9294
+ var $defineProperty = Object.defineProperty || false;
9295
+ if ($defineProperty) {
9296
+ try {
9297
+ $defineProperty({}, "a", { value: 1 });
9298
+ } catch (e) {
9299
+ $defineProperty = false;
9300
+ }
9301
+ }
9302
+ module.exports = $defineProperty;
9303
+ }
9304
+ });
9305
+
9306
+ // node_modules/has-symbols/shams.js
9307
+ var require_shams = __commonJS({
9308
+ "node_modules/has-symbols/shams.js"(exports, module) {
9309
+ "use strict";
9310
+ module.exports = function hasSymbols() {
9311
+ if (typeof Symbol !== "function" || typeof Object.getOwnPropertySymbols !== "function") {
9312
+ return false;
9313
+ }
9314
+ if (typeof Symbol.iterator === "symbol") {
9315
+ return true;
9316
+ }
9317
+ var obj = {};
9318
+ var sym = Symbol("test");
9319
+ var symObj = Object(sym);
9320
+ if (typeof sym === "string") {
9321
+ return false;
9322
+ }
9323
+ if (Object.prototype.toString.call(sym) !== "[object Symbol]") {
9324
+ return false;
9325
+ }
9326
+ if (Object.prototype.toString.call(symObj) !== "[object Symbol]") {
9327
+ return false;
9328
+ }
9329
+ var symVal = 42;
9330
+ obj[sym] = symVal;
9331
+ for (var _ in obj) {
9332
+ return false;
9333
+ }
9334
+ if (typeof Object.keys === "function" && Object.keys(obj).length !== 0) {
9335
+ return false;
9336
+ }
9337
+ if (typeof Object.getOwnPropertyNames === "function" && Object.getOwnPropertyNames(obj).length !== 0) {
9338
+ return false;
9339
+ }
9340
+ var syms = Object.getOwnPropertySymbols(obj);
9341
+ if (syms.length !== 1 || syms[0] !== sym) {
9342
+ return false;
9343
+ }
9344
+ if (!Object.prototype.propertyIsEnumerable.call(obj, sym)) {
9345
+ return false;
9346
+ }
9347
+ if (typeof Object.getOwnPropertyDescriptor === "function") {
9348
+ var descriptor = (
9349
+ /** @type {PropertyDescriptor} */
9350
+ Object.getOwnPropertyDescriptor(obj, sym)
9351
+ );
9352
+ if (descriptor.value !== symVal || descriptor.enumerable !== true) {
9353
+ return false;
9354
+ }
9355
+ }
9356
+ return true;
9357
+ };
9358
+ }
9359
+ });
9360
+
9361
+ // node_modules/has-symbols/index.js
9362
+ var require_has_symbols = __commonJS({
9363
+ "node_modules/has-symbols/index.js"(exports, module) {
9364
+ "use strict";
9365
+ var origSymbol = typeof Symbol !== "undefined" && Symbol;
9366
+ var hasSymbolSham = require_shams();
9367
+ module.exports = function hasNativeSymbols() {
9368
+ if (typeof origSymbol !== "function") {
9369
+ return false;
9370
+ }
9371
+ if (typeof Symbol !== "function") {
9372
+ return false;
9373
+ }
9374
+ if (typeof origSymbol("foo") !== "symbol") {
9375
+ return false;
9376
+ }
9377
+ if (typeof Symbol("bar") !== "symbol") {
9378
+ return false;
9379
+ }
9380
+ return hasSymbolSham();
9381
+ };
9382
+ }
9383
+ });
9384
+
9385
+ // node_modules/get-proto/Reflect.getPrototypeOf.js
9386
+ var require_Reflect_getPrototypeOf = __commonJS({
9387
+ "node_modules/get-proto/Reflect.getPrototypeOf.js"(exports, module) {
9388
+ "use strict";
9389
+ module.exports = typeof Reflect !== "undefined" && Reflect.getPrototypeOf || null;
9390
+ }
9391
+ });
9392
+
9393
+ // node_modules/get-proto/Object.getPrototypeOf.js
9394
+ var require_Object_getPrototypeOf = __commonJS({
9395
+ "node_modules/get-proto/Object.getPrototypeOf.js"(exports, module) {
9396
+ "use strict";
9397
+ var $Object = require_es_object_atoms();
9398
+ module.exports = $Object.getPrototypeOf || null;
9399
+ }
9400
+ });
9401
+
9402
+ // node_modules/function-bind/implementation.js
9403
+ var require_implementation = __commonJS({
9404
+ "node_modules/function-bind/implementation.js"(exports, module) {
9405
+ "use strict";
9406
+ var ERROR_MESSAGE = "Function.prototype.bind called on incompatible ";
9407
+ var toStr = Object.prototype.toString;
9408
+ var max = Math.max;
9409
+ var funcType = "[object Function]";
9410
+ var concatty = function concatty2(a, b) {
9411
+ var arr = [];
9412
+ for (var i = 0; i < a.length; i += 1) {
9413
+ arr[i] = a[i];
9414
+ }
9415
+ for (var j = 0; j < b.length; j += 1) {
9416
+ arr[j + a.length] = b[j];
9417
+ }
9418
+ return arr;
9419
+ };
9420
+ var slicy = function slicy2(arrLike, offset) {
9421
+ var arr = [];
9422
+ for (var i = offset || 0, j = 0; i < arrLike.length; i += 1, j += 1) {
9423
+ arr[j] = arrLike[i];
9424
+ }
9425
+ return arr;
9426
+ };
9427
+ var joiny = function(arr, joiner) {
9428
+ var str = "";
9429
+ for (var i = 0; i < arr.length; i += 1) {
9430
+ str += arr[i];
9431
+ if (i + 1 < arr.length) {
9432
+ str += joiner;
9433
+ }
9434
+ }
9435
+ return str;
9436
+ };
9437
+ module.exports = function bind2(that) {
9438
+ var target = this;
9439
+ if (typeof target !== "function" || toStr.apply(target) !== funcType) {
9440
+ throw new TypeError(ERROR_MESSAGE + target);
9441
+ }
9442
+ var args = slicy(arguments, 1);
9443
+ var bound;
9444
+ var binder = function() {
9445
+ if (this instanceof bound) {
9446
+ var result = target.apply(
9447
+ this,
9448
+ concatty(args, arguments)
9449
+ );
9450
+ if (Object(result) === result) {
9451
+ return result;
9452
+ }
9453
+ return this;
9454
+ }
9455
+ return target.apply(
9456
+ that,
9457
+ concatty(args, arguments)
9458
+ );
9459
+ };
9460
+ var boundLength = max(0, target.length - args.length);
9461
+ var boundArgs = [];
9462
+ for (var i = 0; i < boundLength; i++) {
9463
+ boundArgs[i] = "$" + i;
9464
+ }
9465
+ bound = Function("binder", "return function (" + joiny(boundArgs, ",") + "){ return binder.apply(this,arguments); }")(binder);
9466
+ if (target.prototype) {
9467
+ var Empty = function Empty2() {
9468
+ };
9469
+ Empty.prototype = target.prototype;
9470
+ bound.prototype = new Empty();
9471
+ Empty.prototype = null;
9472
+ }
9473
+ return bound;
9474
+ };
9475
+ }
9476
+ });
9477
+
9478
+ // node_modules/function-bind/index.js
9479
+ var require_function_bind = __commonJS({
9480
+ "node_modules/function-bind/index.js"(exports, module) {
9481
+ "use strict";
9482
+ var implementation = require_implementation();
9483
+ module.exports = Function.prototype.bind || implementation;
9484
+ }
9485
+ });
9486
+
9487
+ // node_modules/call-bind-apply-helpers/functionCall.js
9488
+ var require_functionCall = __commonJS({
9489
+ "node_modules/call-bind-apply-helpers/functionCall.js"(exports, module) {
9490
+ "use strict";
9491
+ module.exports = Function.prototype.call;
9492
+ }
9493
+ });
9494
+
9495
+ // node_modules/call-bind-apply-helpers/functionApply.js
9496
+ var require_functionApply = __commonJS({
9497
+ "node_modules/call-bind-apply-helpers/functionApply.js"(exports, module) {
9498
+ "use strict";
9499
+ module.exports = Function.prototype.apply;
9500
+ }
9501
+ });
9502
+
9503
+ // node_modules/call-bind-apply-helpers/reflectApply.js
9504
+ var require_reflectApply = __commonJS({
9505
+ "node_modules/call-bind-apply-helpers/reflectApply.js"(exports, module) {
9506
+ "use strict";
9507
+ module.exports = typeof Reflect !== "undefined" && Reflect && Reflect.apply;
9508
+ }
9509
+ });
9510
+
9511
+ // node_modules/call-bind-apply-helpers/actualApply.js
9512
+ var require_actualApply = __commonJS({
9513
+ "node_modules/call-bind-apply-helpers/actualApply.js"(exports, module) {
9514
+ "use strict";
9515
+ var bind2 = require_function_bind();
9516
+ var $apply = require_functionApply();
9517
+ var $call = require_functionCall();
9518
+ var $reflectApply = require_reflectApply();
9519
+ module.exports = $reflectApply || bind2.call($call, $apply);
9520
+ }
9521
+ });
9522
+
9523
+ // node_modules/call-bind-apply-helpers/index.js
9524
+ var require_call_bind_apply_helpers = __commonJS({
9525
+ "node_modules/call-bind-apply-helpers/index.js"(exports, module) {
9526
+ "use strict";
9527
+ var bind2 = require_function_bind();
9528
+ var $TypeError = require_type();
9529
+ var $call = require_functionCall();
9530
+ var $actualApply = require_actualApply();
9531
+ module.exports = function callBindBasic(args) {
9532
+ if (args.length < 1 || typeof args[0] !== "function") {
9533
+ throw new $TypeError("a function is required");
9534
+ }
9535
+ return $actualApply(bind2, $call, args);
9536
+ };
9537
+ }
9538
+ });
9539
+
9540
+ // node_modules/dunder-proto/get.js
9541
+ var require_get = __commonJS({
9542
+ "node_modules/dunder-proto/get.js"(exports, module) {
9543
+ "use strict";
9544
+ var callBind = require_call_bind_apply_helpers();
9545
+ var gOPD = require_gopd();
9546
+ var hasProtoAccessor;
9547
+ try {
9548
+ hasProtoAccessor = /** @type {{ __proto__?: typeof Array.prototype }} */
9549
+ [].__proto__ === Array.prototype;
9550
+ } catch (e) {
9551
+ if (!e || typeof e !== "object" || !("code" in e) || e.code !== "ERR_PROTO_ACCESS") {
9552
+ throw e;
9553
+ }
9554
+ }
9555
+ var desc = !!hasProtoAccessor && gOPD && gOPD(
9556
+ Object.prototype,
9557
+ /** @type {keyof typeof Object.prototype} */
9558
+ "__proto__"
9559
+ );
9560
+ var $Object = Object;
9561
+ var $getPrototypeOf = $Object.getPrototypeOf;
9562
+ module.exports = desc && typeof desc.get === "function" ? callBind([desc.get]) : typeof $getPrototypeOf === "function" ? (
9563
+ /** @type {import('./get')} */
9564
+ function getDunder(value) {
9565
+ return $getPrototypeOf(value == null ? value : $Object(value));
9566
+ }
9567
+ ) : false;
9568
+ }
9569
+ });
9570
+
9571
+ // node_modules/get-proto/index.js
9572
+ var require_get_proto = __commonJS({
9573
+ "node_modules/get-proto/index.js"(exports, module) {
9574
+ "use strict";
9575
+ var reflectGetProto = require_Reflect_getPrototypeOf();
9576
+ var originalGetProto = require_Object_getPrototypeOf();
9577
+ var getDunderProto = require_get();
9578
+ module.exports = reflectGetProto ? function getProto(O) {
9579
+ return reflectGetProto(O);
9580
+ } : originalGetProto ? function getProto(O) {
9581
+ if (!O || typeof O !== "object" && typeof O !== "function") {
9582
+ throw new TypeError("getProto: not an object");
9583
+ }
9584
+ return originalGetProto(O);
9585
+ } : getDunderProto ? function getProto(O) {
9586
+ return getDunderProto(O);
9587
+ } : null;
9588
+ }
9589
+ });
9590
+
9591
+ // node_modules/hasown/index.js
9592
+ var require_hasown = __commonJS({
9593
+ "node_modules/hasown/index.js"(exports, module) {
9594
+ "use strict";
9595
+ var call = Function.prototype.call;
9596
+ var $hasOwn = Object.prototype.hasOwnProperty;
9597
+ var bind2 = require_function_bind();
9598
+ module.exports = bind2.call(call, $hasOwn);
9599
+ }
9600
+ });
9601
+
9602
+ // node_modules/get-intrinsic/index.js
9603
+ var require_get_intrinsic = __commonJS({
9604
+ "node_modules/get-intrinsic/index.js"(exports, module) {
9605
+ "use strict";
9606
+ var undefined2;
9607
+ var $Object = require_es_object_atoms();
9608
+ var $Error = require_es_errors();
9609
+ var $EvalError = require_eval();
9610
+ var $RangeError = require_range();
9611
+ var $ReferenceError = require_ref();
9612
+ var $SyntaxError = require_syntax();
9613
+ var $TypeError = require_type();
9614
+ var $URIError = require_uri();
9615
+ var abs = require_abs();
9616
+ var floor = require_floor();
9617
+ var max = require_max();
9618
+ var min = require_min();
9619
+ var pow = require_pow();
9620
+ var round = require_round();
9621
+ var sign = require_sign();
9622
+ var $Function = Function;
9623
+ var getEvalledConstructor = function(expressionSyntax) {
9624
+ try {
9625
+ return $Function('"use strict"; return (' + expressionSyntax + ").constructor;")();
9626
+ } catch (e) {
9627
+ }
9628
+ };
9629
+ var $gOPD = require_gopd();
9630
+ var $defineProperty = require_es_define_property();
9631
+ var throwTypeError = function() {
9632
+ throw new $TypeError();
9633
+ };
9634
+ var ThrowTypeError = $gOPD ? function() {
9635
+ try {
9636
+ arguments.callee;
9637
+ return throwTypeError;
9638
+ } catch (calleeThrows) {
9639
+ try {
9640
+ return $gOPD(arguments, "callee").get;
9641
+ } catch (gOPDthrows) {
9642
+ return throwTypeError;
9643
+ }
9644
+ }
9645
+ }() : throwTypeError;
9646
+ var hasSymbols = require_has_symbols()();
9647
+ var getProto = require_get_proto();
9648
+ var $ObjectGPO = require_Object_getPrototypeOf();
9649
+ var $ReflectGPO = require_Reflect_getPrototypeOf();
9650
+ var $apply = require_functionApply();
9651
+ var $call = require_functionCall();
9652
+ var needsEval = {};
9653
+ var TypedArray = typeof Uint8Array === "undefined" || !getProto ? undefined2 : getProto(Uint8Array);
9654
+ var INTRINSICS = {
9655
+ __proto__: null,
9656
+ "%AggregateError%": typeof AggregateError === "undefined" ? undefined2 : AggregateError,
9657
+ "%Array%": Array,
9658
+ "%ArrayBuffer%": typeof ArrayBuffer === "undefined" ? undefined2 : ArrayBuffer,
9659
+ "%ArrayIteratorPrototype%": hasSymbols && getProto ? getProto([][Symbol.iterator]()) : undefined2,
9660
+ "%AsyncFromSyncIteratorPrototype%": undefined2,
9661
+ "%AsyncFunction%": needsEval,
9662
+ "%AsyncGenerator%": needsEval,
9663
+ "%AsyncGeneratorFunction%": needsEval,
9664
+ "%AsyncIteratorPrototype%": needsEval,
9665
+ "%Atomics%": typeof Atomics === "undefined" ? undefined2 : Atomics,
9666
+ "%BigInt%": typeof BigInt === "undefined" ? undefined2 : BigInt,
9667
+ "%BigInt64Array%": typeof BigInt64Array === "undefined" ? undefined2 : BigInt64Array,
9668
+ "%BigUint64Array%": typeof BigUint64Array === "undefined" ? undefined2 : BigUint64Array,
9669
+ "%Boolean%": Boolean,
9670
+ "%DataView%": typeof DataView === "undefined" ? undefined2 : DataView,
9671
+ "%Date%": Date,
9672
+ "%decodeURI%": decodeURI,
9673
+ "%decodeURIComponent%": decodeURIComponent,
9674
+ "%encodeURI%": encodeURI,
9675
+ "%encodeURIComponent%": encodeURIComponent,
9676
+ "%Error%": $Error,
9677
+ "%eval%": eval,
9678
+ // eslint-disable-line no-eval
9679
+ "%EvalError%": $EvalError,
9680
+ "%Float16Array%": typeof Float16Array === "undefined" ? undefined2 : Float16Array,
9681
+ "%Float32Array%": typeof Float32Array === "undefined" ? undefined2 : Float32Array,
9682
+ "%Float64Array%": typeof Float64Array === "undefined" ? undefined2 : Float64Array,
9683
+ "%FinalizationRegistry%": typeof FinalizationRegistry === "undefined" ? undefined2 : FinalizationRegistry,
9684
+ "%Function%": $Function,
9685
+ "%GeneratorFunction%": needsEval,
9686
+ "%Int8Array%": typeof Int8Array === "undefined" ? undefined2 : Int8Array,
9687
+ "%Int16Array%": typeof Int16Array === "undefined" ? undefined2 : Int16Array,
9688
+ "%Int32Array%": typeof Int32Array === "undefined" ? undefined2 : Int32Array,
9689
+ "%isFinite%": isFinite,
9690
+ "%isNaN%": isNaN,
9691
+ "%IteratorPrototype%": hasSymbols && getProto ? getProto(getProto([][Symbol.iterator]())) : undefined2,
9692
+ "%JSON%": typeof JSON === "object" ? JSON : undefined2,
9693
+ "%Map%": typeof Map === "undefined" ? undefined2 : Map,
9694
+ "%MapIteratorPrototype%": typeof Map === "undefined" || !hasSymbols || !getProto ? undefined2 : getProto((/* @__PURE__ */ new Map())[Symbol.iterator]()),
9695
+ "%Math%": Math,
9696
+ "%Number%": Number,
9697
+ "%Object%": $Object,
9698
+ "%Object.getOwnPropertyDescriptor%": $gOPD,
9699
+ "%parseFloat%": parseFloat,
9700
+ "%parseInt%": parseInt,
9701
+ "%Promise%": typeof Promise === "undefined" ? undefined2 : Promise,
9702
+ "%Proxy%": typeof Proxy === "undefined" ? undefined2 : Proxy,
9703
+ "%RangeError%": $RangeError,
9704
+ "%ReferenceError%": $ReferenceError,
9705
+ "%Reflect%": typeof Reflect === "undefined" ? undefined2 : Reflect,
9706
+ "%RegExp%": RegExp,
9707
+ "%Set%": typeof Set === "undefined" ? undefined2 : Set,
9708
+ "%SetIteratorPrototype%": typeof Set === "undefined" || !hasSymbols || !getProto ? undefined2 : getProto((/* @__PURE__ */ new Set())[Symbol.iterator]()),
9709
+ "%SharedArrayBuffer%": typeof SharedArrayBuffer === "undefined" ? undefined2 : SharedArrayBuffer,
9710
+ "%String%": String,
9711
+ "%StringIteratorPrototype%": hasSymbols && getProto ? getProto(""[Symbol.iterator]()) : undefined2,
9712
+ "%Symbol%": hasSymbols ? Symbol : undefined2,
9713
+ "%SyntaxError%": $SyntaxError,
9714
+ "%ThrowTypeError%": ThrowTypeError,
9715
+ "%TypedArray%": TypedArray,
9716
+ "%TypeError%": $TypeError,
9717
+ "%Uint8Array%": typeof Uint8Array === "undefined" ? undefined2 : Uint8Array,
9718
+ "%Uint8ClampedArray%": typeof Uint8ClampedArray === "undefined" ? undefined2 : Uint8ClampedArray,
9719
+ "%Uint16Array%": typeof Uint16Array === "undefined" ? undefined2 : Uint16Array,
9720
+ "%Uint32Array%": typeof Uint32Array === "undefined" ? undefined2 : Uint32Array,
9721
+ "%URIError%": $URIError,
9722
+ "%WeakMap%": typeof WeakMap === "undefined" ? undefined2 : WeakMap,
9723
+ "%WeakRef%": typeof WeakRef === "undefined" ? undefined2 : WeakRef,
9724
+ "%WeakSet%": typeof WeakSet === "undefined" ? undefined2 : WeakSet,
9725
+ "%Function.prototype.call%": $call,
9726
+ "%Function.prototype.apply%": $apply,
9727
+ "%Object.defineProperty%": $defineProperty,
9728
+ "%Object.getPrototypeOf%": $ObjectGPO,
9729
+ "%Math.abs%": abs,
9730
+ "%Math.floor%": floor,
9731
+ "%Math.max%": max,
9732
+ "%Math.min%": min,
9733
+ "%Math.pow%": pow,
9734
+ "%Math.round%": round,
9735
+ "%Math.sign%": sign,
9736
+ "%Reflect.getPrototypeOf%": $ReflectGPO
9737
+ };
9738
+ if (getProto) {
9739
+ try {
9740
+ null.error;
9741
+ } catch (e) {
9742
+ errorProto = getProto(getProto(e));
9743
+ INTRINSICS["%Error.prototype%"] = errorProto;
9744
+ }
9745
+ }
9746
+ var errorProto;
9747
+ var doEval = function doEval2(name) {
9748
+ var value;
9749
+ if (name === "%AsyncFunction%") {
9750
+ value = getEvalledConstructor("async function () {}");
9751
+ } else if (name === "%GeneratorFunction%") {
9752
+ value = getEvalledConstructor("function* () {}");
9753
+ } else if (name === "%AsyncGeneratorFunction%") {
9754
+ value = getEvalledConstructor("async function* () {}");
9755
+ } else if (name === "%AsyncGenerator%") {
9756
+ var fn = doEval2("%AsyncGeneratorFunction%");
9757
+ if (fn) {
9758
+ value = fn.prototype;
9759
+ }
9760
+ } else if (name === "%AsyncIteratorPrototype%") {
9761
+ var gen = doEval2("%AsyncGenerator%");
9762
+ if (gen && getProto) {
9763
+ value = getProto(gen.prototype);
9764
+ }
9765
+ }
9766
+ INTRINSICS[name] = value;
9767
+ return value;
9768
+ };
9769
+ var LEGACY_ALIASES = {
9770
+ __proto__: null,
9771
+ "%ArrayBufferPrototype%": ["ArrayBuffer", "prototype"],
9772
+ "%ArrayPrototype%": ["Array", "prototype"],
9773
+ "%ArrayProto_entries%": ["Array", "prototype", "entries"],
9774
+ "%ArrayProto_forEach%": ["Array", "prototype", "forEach"],
9775
+ "%ArrayProto_keys%": ["Array", "prototype", "keys"],
9776
+ "%ArrayProto_values%": ["Array", "prototype", "values"],
9777
+ "%AsyncFunctionPrototype%": ["AsyncFunction", "prototype"],
9778
+ "%AsyncGenerator%": ["AsyncGeneratorFunction", "prototype"],
9779
+ "%AsyncGeneratorPrototype%": ["AsyncGeneratorFunction", "prototype", "prototype"],
9780
+ "%BooleanPrototype%": ["Boolean", "prototype"],
9781
+ "%DataViewPrototype%": ["DataView", "prototype"],
9782
+ "%DatePrototype%": ["Date", "prototype"],
9783
+ "%ErrorPrototype%": ["Error", "prototype"],
9784
+ "%EvalErrorPrototype%": ["EvalError", "prototype"],
9785
+ "%Float32ArrayPrototype%": ["Float32Array", "prototype"],
9786
+ "%Float64ArrayPrototype%": ["Float64Array", "prototype"],
9787
+ "%FunctionPrototype%": ["Function", "prototype"],
9788
+ "%Generator%": ["GeneratorFunction", "prototype"],
9789
+ "%GeneratorPrototype%": ["GeneratorFunction", "prototype", "prototype"],
9790
+ "%Int8ArrayPrototype%": ["Int8Array", "prototype"],
9791
+ "%Int16ArrayPrototype%": ["Int16Array", "prototype"],
9792
+ "%Int32ArrayPrototype%": ["Int32Array", "prototype"],
9793
+ "%JSONParse%": ["JSON", "parse"],
9794
+ "%JSONStringify%": ["JSON", "stringify"],
9795
+ "%MapPrototype%": ["Map", "prototype"],
9796
+ "%NumberPrototype%": ["Number", "prototype"],
9797
+ "%ObjectPrototype%": ["Object", "prototype"],
9798
+ "%ObjProto_toString%": ["Object", "prototype", "toString"],
9799
+ "%ObjProto_valueOf%": ["Object", "prototype", "valueOf"],
9800
+ "%PromisePrototype%": ["Promise", "prototype"],
9801
+ "%PromiseProto_then%": ["Promise", "prototype", "then"],
9802
+ "%Promise_all%": ["Promise", "all"],
9803
+ "%Promise_reject%": ["Promise", "reject"],
9804
+ "%Promise_resolve%": ["Promise", "resolve"],
9805
+ "%RangeErrorPrototype%": ["RangeError", "prototype"],
9806
+ "%ReferenceErrorPrototype%": ["ReferenceError", "prototype"],
9807
+ "%RegExpPrototype%": ["RegExp", "prototype"],
9808
+ "%SetPrototype%": ["Set", "prototype"],
9809
+ "%SharedArrayBufferPrototype%": ["SharedArrayBuffer", "prototype"],
9810
+ "%StringPrototype%": ["String", "prototype"],
9811
+ "%SymbolPrototype%": ["Symbol", "prototype"],
9812
+ "%SyntaxErrorPrototype%": ["SyntaxError", "prototype"],
9813
+ "%TypedArrayPrototype%": ["TypedArray", "prototype"],
9814
+ "%TypeErrorPrototype%": ["TypeError", "prototype"],
9815
+ "%Uint8ArrayPrototype%": ["Uint8Array", "prototype"],
9816
+ "%Uint8ClampedArrayPrototype%": ["Uint8ClampedArray", "prototype"],
9817
+ "%Uint16ArrayPrototype%": ["Uint16Array", "prototype"],
9818
+ "%Uint32ArrayPrototype%": ["Uint32Array", "prototype"],
9819
+ "%URIErrorPrototype%": ["URIError", "prototype"],
9820
+ "%WeakMapPrototype%": ["WeakMap", "prototype"],
9821
+ "%WeakSetPrototype%": ["WeakSet", "prototype"]
9822
+ };
9823
+ var bind2 = require_function_bind();
9824
+ var hasOwn = require_hasown();
9825
+ var $concat = bind2.call($call, Array.prototype.concat);
9826
+ var $spliceApply = bind2.call($apply, Array.prototype.splice);
9827
+ var $replace = bind2.call($call, String.prototype.replace);
9828
+ var $strSlice = bind2.call($call, String.prototype.slice);
9829
+ var $exec = bind2.call($call, RegExp.prototype.exec);
9830
+ var rePropName = /[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g;
9831
+ var reEscapeChar = /\\(\\)?/g;
9832
+ var stringToPath = function stringToPath2(string) {
9833
+ var first = $strSlice(string, 0, 1);
9834
+ var last = $strSlice(string, -1);
9835
+ if (first === "%" && last !== "%") {
9836
+ throw new $SyntaxError("invalid intrinsic syntax, expected closing `%`");
9837
+ } else if (last === "%" && first !== "%") {
9838
+ throw new $SyntaxError("invalid intrinsic syntax, expected opening `%`");
9839
+ }
9840
+ var result = [];
9841
+ $replace(string, rePropName, function(match, number, quote, subString) {
9842
+ result[result.length] = quote ? $replace(subString, reEscapeChar, "$1") : number || match;
9843
+ });
9844
+ return result;
9845
+ };
9846
+ var getBaseIntrinsic = function getBaseIntrinsic2(name, allowMissing) {
9847
+ var intrinsicName = name;
9848
+ var alias;
9849
+ if (hasOwn(LEGACY_ALIASES, intrinsicName)) {
9850
+ alias = LEGACY_ALIASES[intrinsicName];
9851
+ intrinsicName = "%" + alias[0] + "%";
9852
+ }
9853
+ if (hasOwn(INTRINSICS, intrinsicName)) {
9854
+ var value = INTRINSICS[intrinsicName];
9855
+ if (value === needsEval) {
9856
+ value = doEval(intrinsicName);
9857
+ }
9858
+ if (typeof value === "undefined" && !allowMissing) {
9859
+ throw new $TypeError("intrinsic " + name + " exists, but is not available. Please file an issue!");
9860
+ }
9861
+ return {
9862
+ alias,
9863
+ name: intrinsicName,
9864
+ value
9865
+ };
9866
+ }
9867
+ throw new $SyntaxError("intrinsic " + name + " does not exist!");
9868
+ };
9869
+ module.exports = function GetIntrinsic(name, allowMissing) {
9870
+ if (typeof name !== "string" || name.length === 0) {
9871
+ throw new $TypeError("intrinsic name must be a non-empty string");
9872
+ }
9873
+ if (arguments.length > 1 && typeof allowMissing !== "boolean") {
9874
+ throw new $TypeError('"allowMissing" argument must be a boolean');
9875
+ }
9876
+ if ($exec(/^%?[^%]*%?$/, name) === null) {
9877
+ throw new $SyntaxError("`%` may not be present anywhere but at the beginning and end of the intrinsic name");
9878
+ }
9879
+ var parts = stringToPath(name);
9880
+ var intrinsicBaseName = parts.length > 0 ? parts[0] : "";
9881
+ var intrinsic = getBaseIntrinsic("%" + intrinsicBaseName + "%", allowMissing);
9882
+ var intrinsicRealName = intrinsic.name;
9883
+ var value = intrinsic.value;
9884
+ var skipFurtherCaching = false;
9885
+ var alias = intrinsic.alias;
9886
+ if (alias) {
9887
+ intrinsicBaseName = alias[0];
9888
+ $spliceApply(parts, $concat([0, 1], alias));
9889
+ }
9890
+ for (var i = 1, isOwn = true; i < parts.length; i += 1) {
9891
+ var part = parts[i];
9892
+ var first = $strSlice(part, 0, 1);
9893
+ var last = $strSlice(part, -1);
9894
+ if ((first === '"' || first === "'" || first === "`" || (last === '"' || last === "'" || last === "`")) && first !== last) {
9895
+ throw new $SyntaxError("property names with quotes must have matching quotes");
9896
+ }
9897
+ if (part === "constructor" || !isOwn) {
9898
+ skipFurtherCaching = true;
9899
+ }
9900
+ intrinsicBaseName += "." + part;
9901
+ intrinsicRealName = "%" + intrinsicBaseName + "%";
9902
+ if (hasOwn(INTRINSICS, intrinsicRealName)) {
9903
+ value = INTRINSICS[intrinsicRealName];
9904
+ } else if (value != null) {
9905
+ if (!(part in value)) {
9906
+ if (!allowMissing) {
9907
+ throw new $TypeError("base intrinsic for " + name + " exists, but the property is not available.");
9908
+ }
9909
+ return void undefined2;
9910
+ }
9911
+ if ($gOPD && i + 1 >= parts.length) {
9912
+ var desc = $gOPD(value, part);
9913
+ isOwn = !!desc;
9914
+ if (isOwn && "get" in desc && !("originalValue" in desc.get)) {
9915
+ value = desc.get;
9916
+ } else {
9917
+ value = value[part];
9918
+ }
9919
+ } else {
9920
+ isOwn = hasOwn(value, part);
9921
+ value = value[part];
9922
+ }
9923
+ if (isOwn && !skipFurtherCaching) {
9924
+ INTRINSICS[intrinsicRealName] = value;
9925
+ }
9926
+ }
9927
+ }
9928
+ return value;
9929
+ };
9930
+ }
9931
+ });
9932
+
9933
+ // node_modules/has-tostringtag/shams.js
9934
+ var require_shams2 = __commonJS({
9935
+ "node_modules/has-tostringtag/shams.js"(exports, module) {
9936
+ "use strict";
9937
+ var hasSymbols = require_shams();
9938
+ module.exports = function hasToStringTagShams() {
9939
+ return hasSymbols() && !!Symbol.toStringTag;
9940
+ };
9941
+ }
9942
+ });
9943
+
9944
+ // node_modules/es-set-tostringtag/index.js
9945
+ var require_es_set_tostringtag = __commonJS({
9946
+ "node_modules/es-set-tostringtag/index.js"(exports, module) {
9947
+ "use strict";
9948
+ var GetIntrinsic = require_get_intrinsic();
9949
+ var $defineProperty = GetIntrinsic("%Object.defineProperty%", true);
9950
+ var hasToStringTag = require_shams2()();
9951
+ var hasOwn = require_hasown();
9952
+ var $TypeError = require_type();
9953
+ var toStringTag2 = hasToStringTag ? Symbol.toStringTag : null;
9954
+ module.exports = function setToStringTag(object, value) {
9955
+ var overrideIfSet = arguments.length > 2 && !!arguments[2] && arguments[2].force;
9956
+ var nonConfigurable = arguments.length > 2 && !!arguments[2] && arguments[2].nonConfigurable;
9957
+ if (typeof overrideIfSet !== "undefined" && typeof overrideIfSet !== "boolean" || typeof nonConfigurable !== "undefined" && typeof nonConfigurable !== "boolean") {
9958
+ throw new $TypeError("if provided, the `overrideIfSet` and `nonConfigurable` options must be booleans");
9959
+ }
9960
+ if (toStringTag2 && (overrideIfSet || !hasOwn(object, toStringTag2))) {
9961
+ if ($defineProperty) {
9962
+ $defineProperty(object, toStringTag2, {
9963
+ configurable: !nonConfigurable,
9964
+ enumerable: false,
9965
+ value,
9966
+ writable: false
9967
+ });
9968
+ } else {
9969
+ object[toStringTag2] = value;
9970
+ }
9971
+ }
9972
+ };
9973
+ }
9974
+ });
9975
+
9130
9976
  // node_modules/form-data/lib/populate.js
9131
9977
  var require_populate = __commonJS({
9132
9978
  "node_modules/form-data/lib/populate.js"(exports, module) {
@@ -9145,13 +9991,14 @@ var require_form_data = __commonJS({
9145
9991
  var CombinedStream = require_combined_stream();
9146
9992
  var util3 = __require("util");
9147
9993
  var path = __require("path");
9148
- var http2 = __require("http");
9994
+ var http3 = __require("http");
9149
9995
  var https2 = __require("https");
9150
9996
  var parseUrl = __require("url").parse;
9151
9997
  var fs = __require("fs");
9152
9998
  var Stream = __require("stream").Stream;
9153
9999
  var mime = require_mime_types();
9154
10000
  var asynckit = require_asynckit();
10001
+ var setToStringTag = require_es_set_tostringtag();
9155
10002
  var populate = require_populate();
9156
10003
  module.exports = FormData3;
9157
10004
  util3.inherits(FormData3, CombinedStream);
@@ -9201,7 +10048,7 @@ var require_form_data = __commonJS({
9201
10048
  }
9202
10049
  this._valueLength += valueLength;
9203
10050
  this._overheadLength += Buffer.byteLength(header) + FormData3.LINE_BREAK.length;
9204
- if (!value || !value.path && !(value.readable && value.hasOwnProperty("httpVersion")) && !(value instanceof Stream)) {
10051
+ if (!value || !value.path && !(value.readable && Object.prototype.hasOwnProperty.call(value, "httpVersion")) && !(value instanceof Stream)) {
9205
10052
  return;
9206
10053
  }
9207
10054
  if (!options.knownLength) {
@@ -9209,7 +10056,7 @@ var require_form_data = __commonJS({
9209
10056
  }
9210
10057
  };
9211
10058
  FormData3.prototype._lengthRetriever = function(value, callback) {
9212
- if (value.hasOwnProperty("fd")) {
10059
+ if (Object.prototype.hasOwnProperty.call(value, "fd")) {
9213
10060
  if (value.end != void 0 && value.end != Infinity && value.start != void 0) {
9214
10061
  callback(null, value.end + 1 - (value.start ? value.start : 0));
9215
10062
  } else {
@@ -9223,9 +10070,9 @@ var require_form_data = __commonJS({
9223
10070
  callback(null, fileSize);
9224
10071
  });
9225
10072
  }
9226
- } else if (value.hasOwnProperty("httpVersion")) {
10073
+ } else if (Object.prototype.hasOwnProperty.call(value, "httpVersion")) {
9227
10074
  callback(null, +value.headers["content-length"]);
9228
- } else if (value.hasOwnProperty("httpModule")) {
10075
+ } else if (Object.prototype.hasOwnProperty.call(value, "httpModule")) {
9229
10076
  value.on("response", function(response) {
9230
10077
  value.pause();
9231
10078
  callback(null, +response.headers["content-length"]);
@@ -9253,16 +10100,17 @@ var require_form_data = __commonJS({
9253
10100
  }
9254
10101
  var header;
9255
10102
  for (var prop in headers) {
9256
- if (!headers.hasOwnProperty(prop)) continue;
9257
- header = headers[prop];
9258
- if (header == null) {
9259
- continue;
9260
- }
9261
- if (!Array.isArray(header)) {
9262
- header = [header];
9263
- }
9264
- if (header.length) {
9265
- contents += prop + ": " + header.join("; ") + FormData3.LINE_BREAK;
10103
+ if (Object.prototype.hasOwnProperty.call(headers, prop)) {
10104
+ header = headers[prop];
10105
+ if (header == null) {
10106
+ continue;
10107
+ }
10108
+ if (!Array.isArray(header)) {
10109
+ header = [header];
10110
+ }
10111
+ if (header.length) {
10112
+ contents += prop + ": " + header.join("; ") + FormData3.LINE_BREAK;
10113
+ }
9266
10114
  }
9267
10115
  }
9268
10116
  return "--" + this.getBoundary() + FormData3.LINE_BREAK + contents + FormData3.LINE_BREAK;
@@ -9273,7 +10121,7 @@ var require_form_data = __commonJS({
9273
10121
  filename = path.normalize(options.filepath).replace(/\\/g, "/");
9274
10122
  } else if (options.filename || value.name || value.path) {
9275
10123
  filename = path.basename(options.filename || value.name || value.path);
9276
- } else if (value.readable && value.hasOwnProperty("httpVersion")) {
10124
+ } else if (value.readable && Object.prototype.hasOwnProperty.call(value, "httpVersion")) {
9277
10125
  filename = path.basename(value.client._httpMessage.path || "");
9278
10126
  }
9279
10127
  if (filename) {
@@ -9289,7 +10137,7 @@ var require_form_data = __commonJS({
9289
10137
  if (!contentType && value.path) {
9290
10138
  contentType = mime.lookup(value.path);
9291
10139
  }
9292
- if (!contentType && value.readable && value.hasOwnProperty("httpVersion")) {
10140
+ if (!contentType && value.readable && Object.prototype.hasOwnProperty.call(value, "httpVersion")) {
9293
10141
  contentType = value.headers["content-type"];
9294
10142
  }
9295
10143
  if (!contentType && (options.filepath || options.filename)) {
@@ -9319,7 +10167,7 @@ var require_form_data = __commonJS({
9319
10167
  "content-type": "multipart/form-data; boundary=" + this.getBoundary()
9320
10168
  };
9321
10169
  for (header in userHeaders) {
9322
- if (userHeaders.hasOwnProperty(header)) {
10170
+ if (Object.prototype.hasOwnProperty.call(userHeaders, header)) {
9323
10171
  formHeaders[header.toLowerCase()] = userHeaders[header];
9324
10172
  }
9325
10173
  }
@@ -9415,7 +10263,7 @@ var require_form_data = __commonJS({
9415
10263
  if (options.protocol == "https:") {
9416
10264
  request = https2.request(options);
9417
10265
  } else {
9418
- request = http2.request(options);
10266
+ request = http3.request(options);
9419
10267
  }
9420
10268
  this.getLength(function(err, length) {
9421
10269
  if (err && err !== "Unknown stream") {
@@ -9450,6 +10298,7 @@ var require_form_data = __commonJS({
9450
10298
  FormData3.prototype.toString = function() {
9451
10299
  return "[object FormData]";
9452
10300
  };
10301
+ setToStringTag(FormData3, "FormData");
9453
10302
  }
9454
10303
  });
9455
10304
 
@@ -10311,7 +11160,7 @@ var require_follow_redirects = __commonJS({
10311
11160
  "node_modules/follow-redirects/index.js"(exports, module) {
10312
11161
  var url2 = __require("url");
10313
11162
  var URL2 = url2.URL;
10314
- var http2 = __require("http");
11163
+ var http3 = __require("http");
10315
11164
  var https2 = __require("https");
10316
11165
  var Writable = __require("stream").Writable;
10317
11166
  var assert = __require("assert");
@@ -10797,7 +11646,7 @@ var require_follow_redirects = __commonJS({
10797
11646
  function isURL(value) {
10798
11647
  return URL2 && value instanceof URL2;
10799
11648
  }
10800
- module.exports = wrap2({ http: http2, https: https2 });
11649
+ module.exports = wrap2({ http: http3, https: https2 });
10801
11650
  module.exports.wrap = wrap2;
10802
11651
  }
10803
11652
  });
@@ -10807,10 +11656,7 @@ import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js"
10807
11656
 
10808
11657
  // src/server.ts
10809
11658
  import { Server } from "@modelcontextprotocol/sdk/server/index.js";
10810
- import {
10811
- ListToolsRequestSchema,
10812
- CallToolRequestSchema
10813
- } from "@modelcontextprotocol/sdk/types.js";
11659
+ import { ListToolsRequestSchema, CallToolRequestSchema } from "@modelcontextprotocol/sdk/types.js";
10814
11660
 
10815
11661
  // node_modules/axios/lib/helpers/bind.js
10816
11662
  function bind(fn, thisArg) {
@@ -14146,12 +14992,12 @@ var OpenAPISpecLoader = class {
14146
14992
  for (const [method, operation] of Object.entries(pathItem)) {
14147
14993
  if (method === "parameters" || !operation) continue;
14148
14994
  const op = operation;
14149
- const cleanPath = path.replace(/^\//, "");
14150
- const toolId = `${method.toUpperCase()}-${cleanPath}`.replace(
14995
+ const cleanPath = path.replace(/^\//, "").replace(/\{([^}]+)\}/g, "$1");
14996
+ const toolId = `${method.toUpperCase()}-${cleanPath}`.replace(/[^a-zA-Z0-9-]/g, "-");
14997
+ const name = (op.operationId || op.summary || `${method.toUpperCase()} ${path}`).replace(
14151
14998
  /[^a-zA-Z0-9-]/g,
14152
14999
  "-"
14153
15000
  );
14154
- const name = (op.operationId || op.summary || `${method.toUpperCase()} ${path}`).replace(/[^a-zA-Z0-9-]/g, "-");
14155
15001
  const tool = {
14156
15002
  name,
14157
15003
  description: op.description || `Make a ${method.toUpperCase()} request to ${path}`,
@@ -14161,19 +15007,24 @@ var OpenAPISpecLoader = class {
14161
15007
  }
14162
15008
  };
14163
15009
  if (op.parameters) {
15010
+ const requiredParams = [];
14164
15011
  for (const param of op.parameters) {
14165
15012
  if ("name" in param && "in" in param) {
14166
15013
  const paramSchema = param.schema;
14167
- tool.inputSchema.properties[param.name] = {
14168
- type: paramSchema.type || "string",
14169
- description: param.description || `${param.name} parameter`
14170
- };
14171
- if (param.required) {
14172
- tool.inputSchema.required = tool.inputSchema.required || [];
14173
- tool.inputSchema.required.push(param.name);
15014
+ if (tool.inputSchema && tool.inputSchema.properties) {
15015
+ tool.inputSchema.properties[param.name] = {
15016
+ type: paramSchema.type || "string",
15017
+ description: param.description || `${param.name} parameter`
15018
+ };
15019
+ }
15020
+ if (param.required === true) {
15021
+ requiredParams.push(param.name);
14174
15022
  }
14175
15023
  }
14176
15024
  }
15025
+ if (requiredParams.length > 0 && tool.inputSchema) {
15026
+ tool.inputSchema.required = requiredParams;
15027
+ }
14177
15028
  }
14178
15029
  tools.set(toolId, tool);
14179
15030
  }
@@ -14234,12 +15085,11 @@ var ToolsManager = class {
14234
15085
  var ApiClient = class {
14235
15086
  /**
14236
15087
  * Create a new API client
14237
- *
15088
+ *
14238
15089
  * @param baseUrl - Base URL for the API
14239
15090
  * @param headers - Optional headers to include with every request
14240
15091
  */
14241
15092
  constructor(baseUrl, headers = {}) {
14242
- this.baseUrl = baseUrl;
14243
15093
  this.headers = headers;
14244
15094
  this.axiosInstance = axios_default.create({
14245
15095
  baseURL: baseUrl.endsWith("/") ? baseUrl : `${baseUrl}/`
@@ -14248,7 +15098,7 @@ var ApiClient = class {
14248
15098
  axiosInstance;
14249
15099
  /**
14250
15100
  * Execute an API call based on the tool ID and parameters
14251
- *
15101
+ *
14252
15102
  * @param toolId - The tool ID in format METHOD-path-parts
14253
15103
  * @param params - Parameters for the API call
14254
15104
  * @returns The API response data
@@ -14280,7 +15130,7 @@ var ApiClient = class {
14280
15130
  }
14281
15131
  /**
14282
15132
  * Parse a tool ID into HTTP method and path
14283
- *
15133
+ *
14284
15134
  * @param toolId - Tool ID in format METHOD-path-parts
14285
15135
  * @returns Object containing method and path
14286
15136
  */
@@ -14292,7 +15142,7 @@ var ApiClient = class {
14292
15142
  /**
14293
15143
  * Process query parameters for GET requests
14294
15144
  * Converts arrays to comma-separated strings
14295
- *
15145
+ *
14296
15146
  * @param params - The original parameters
14297
15147
  * @returns Processed parameters
14298
15148
  */
@@ -14311,13 +15161,18 @@ var ApiClient = class {
14311
15161
 
14312
15162
  // src/server.ts
14313
15163
  var OpenAPIServer = class {
15164
+ server;
15165
+ toolsManager;
15166
+ apiClient;
14314
15167
  constructor(config) {
14315
- this.config = config;
14316
15168
  this.server = new Server(
14317
15169
  { name: config.name, version: config.version },
14318
15170
  {
14319
15171
  capabilities: {
14320
- tools: {}
15172
+ tools: {
15173
+ list: true,
15174
+ execute: true
15175
+ }
14321
15176
  }
14322
15177
  }
14323
15178
  );
@@ -14325,9 +15180,6 @@ var OpenAPIServer = class {
14325
15180
  this.apiClient = new ApiClient(config.apiBaseUrl, config.headers);
14326
15181
  this.initializeHandlers();
14327
15182
  }
14328
- server;
14329
- toolsManager;
14330
- apiClient;
14331
15183
  /**
14332
15184
  * Initialize request handlers
14333
15185
  */
@@ -14341,7 +15193,7 @@ var OpenAPIServer = class {
14341
15193
  const { id, name, arguments: params } = request.params;
14342
15194
  console.error("Received request:", request.params);
14343
15195
  console.error("Using parameters from arguments:", params);
14344
- const idOrName = id || name;
15196
+ const idOrName = typeof id === "string" ? id : typeof name === "string" ? name : "";
14345
15197
  if (!idOrName) {
14346
15198
  throw new Error("Tool ID or name is required");
14347
15199
  }
@@ -14355,10 +15207,7 @@ var OpenAPIServer = class {
14355
15207
  const { toolId, tool } = toolInfo;
14356
15208
  console.error(`Executing tool: ${toolId} (${tool.name})`);
14357
15209
  try {
14358
- const result = await this.apiClient.executeApiCall(
14359
- toolId,
14360
- params || {}
14361
- );
15210
+ const result = await this.apiClient.executeApiCall(toolId, params || {});
14362
15211
  return {
14363
15212
  content: [
14364
15213
  {
@@ -19253,7 +20102,22 @@ function parseHeaders(headerStr) {
19253
20102
  return headers;
19254
20103
  }
19255
20104
  function loadConfig() {
19256
- const argv = yargs_default(hideBin(process.argv)).option("api-base-url", {
20105
+ const argv = yargs_default(hideBin(process.argv)).option("transport", {
20106
+ alias: "t",
20107
+ type: "string",
20108
+ choices: ["stdio", "http"],
20109
+ description: "Transport type to use (stdio or http)"
20110
+ }).option("port", {
20111
+ alias: "p",
20112
+ type: "number",
20113
+ description: "HTTP port for HTTP transport"
20114
+ }).option("host", {
20115
+ type: "string",
20116
+ description: "HTTP host for HTTP transport"
20117
+ }).option("path", {
20118
+ type: "string",
20119
+ description: "HTTP endpoint path for HTTP transport"
20120
+ }).option("api-base-url", {
19257
20121
  alias: "u",
19258
20122
  type: "string",
19259
20123
  description: "Base URL for the API"
@@ -19273,18 +20137,23 @@ function loadConfig() {
19273
20137
  alias: "v",
19274
20138
  type: "string",
19275
20139
  description: "Server version"
19276
- }).help().argv;
20140
+ }).help().parseSync();
20141
+ let transportType;
20142
+ if (argv.transport === "http" || process.env.TRANSPORT_TYPE === "http") {
20143
+ transportType = "http";
20144
+ } else {
20145
+ transportType = "stdio";
20146
+ }
20147
+ const httpPort = argv.port ?? (process.env.HTTP_PORT ? parseInt(process.env.HTTP_PORT, 10) : 3e3);
20148
+ const httpHost = argv.host || process.env.HTTP_HOST || "127.0.0.1";
20149
+ const endpointPath = argv.path || process.env.ENDPOINT_PATH || "/mcp";
19277
20150
  const apiBaseUrl = argv["api-base-url"] || process.env.API_BASE_URL;
19278
20151
  const openApiSpec = argv["openapi-spec"] || process.env.OPENAPI_SPEC_PATH;
19279
20152
  if (!apiBaseUrl) {
19280
- throw new Error(
19281
- "API base URL is required (--api-base-url or API_BASE_URL)"
19282
- );
20153
+ throw new Error("API base URL is required (--api-base-url or API_BASE_URL)");
19283
20154
  }
19284
20155
  if (!openApiSpec) {
19285
- throw new Error(
19286
- "OpenAPI spec is required (--openapi-spec or OPENAPI_SPEC_PATH)"
19287
- );
20156
+ throw new Error("OpenAPI spec is required (--openapi-spec or OPENAPI_SPEC_PATH)");
19288
20157
  }
19289
20158
  const headers = parseHeaders(argv.headers || process.env.API_HEADERS);
19290
20159
  return {
@@ -19292,18 +20161,582 @@ function loadConfig() {
19292
20161
  version: argv.version || process.env.SERVER_VERSION || "1.0.0",
19293
20162
  apiBaseUrl,
19294
20163
  openApiSpec,
19295
- headers
20164
+ headers,
20165
+ transportType,
20166
+ httpPort,
20167
+ httpHost,
20168
+ endpointPath
19296
20169
  };
19297
20170
  }
19298
20171
 
20172
+ // src/transport/StreamableHttpServerTransport.ts
20173
+ import {
20174
+ isInitializeRequest,
20175
+ isJSONRPCRequest,
20176
+ isJSONRPCResponse
20177
+ } from "@modelcontextprotocol/sdk/types.js";
20178
+ import * as http2 from "http";
20179
+ import { randomUUID } from "crypto";
20180
+ var StreamableHttpServerTransport = class {
20181
+ // Maps request IDs to session IDs
20182
+ /**
20183
+ * Initialize a new StreamableHttpServerTransport
20184
+ *
20185
+ * @param port HTTP port to listen on
20186
+ * @param host Host to bind to (default: 127.0.0.1)
20187
+ * @param endpointPath Endpoint path (default: /mcp)
20188
+ */
20189
+ constructor(port, host = "127.0.0.1", endpointPath = "/mcp") {
20190
+ this.port = port;
20191
+ this.host = host;
20192
+ this.endpointPath = endpointPath;
20193
+ this.server = http2.createServer(this.handleRequest.bind(this));
20194
+ }
20195
+ server;
20196
+ sessions = /* @__PURE__ */ new Map();
20197
+ started = false;
20198
+ maxBodySize = 4 * 1024 * 1024;
20199
+ // 4MB max request size
20200
+ requestSessionMap = /* @__PURE__ */ new Map();
20201
+ /**
20202
+ * Callback when message is received
20203
+ */
20204
+ onmessage;
20205
+ /**
20206
+ * Callback when error occurs
20207
+ */
20208
+ onerror;
20209
+ /**
20210
+ * Callback when transport closes
20211
+ */
20212
+ onclose;
20213
+ /**
20214
+ * Start the transport
20215
+ */
20216
+ async start() {
20217
+ if (this.started) {
20218
+ throw new Error("Transport already started");
20219
+ }
20220
+ return new Promise((resolve5, reject) => {
20221
+ this.server.listen(this.port, this.host, () => {
20222
+ this.started = true;
20223
+ console.error(
20224
+ `Streamable HTTP transport listening on http://${this.host}:${this.port}${this.endpointPath}`
20225
+ );
20226
+ resolve5();
20227
+ });
20228
+ this.server.on("error", (err) => {
20229
+ reject(err);
20230
+ if (this.onerror) {
20231
+ this.onerror(err);
20232
+ }
20233
+ });
20234
+ });
20235
+ }
20236
+ /**
20237
+ * Close the transport
20238
+ */
20239
+ async close() {
20240
+ for (const session of this.sessions.values()) {
20241
+ for (const response of session.activeResponses) {
20242
+ try {
20243
+ response.end();
20244
+ } catch (err) {
20245
+ }
20246
+ }
20247
+ }
20248
+ this.sessions.clear();
20249
+ return new Promise((resolve5, reject) => {
20250
+ this.server.close((err) => {
20251
+ if (err) {
20252
+ reject(err instanceof Error ? err : new Error(String(err)));
20253
+ } else {
20254
+ this.started = false;
20255
+ if (this.onclose) {
20256
+ this.onclose();
20257
+ }
20258
+ resolve5();
20259
+ }
20260
+ });
20261
+ });
20262
+ }
20263
+ /**
20264
+ * Send message to client(s)
20265
+ *
20266
+ * @param message JSON-RPC message
20267
+ */
20268
+ async send(message) {
20269
+ console.error(`StreamableHttpServerTransport: Sending message: ${JSON.stringify(message)}`);
20270
+ let targetSessionId;
20271
+ let messageIdForThisResponse = null;
20272
+ if (isJSONRPCResponse(message) && message.id !== null) {
20273
+ messageIdForThisResponse = message.id;
20274
+ targetSessionId = this.requestSessionMap.get(messageIdForThisResponse);
20275
+ console.error(
20276
+ `StreamableHttpServerTransport: Potential target session for response ID ${messageIdForThisResponse}: ${targetSessionId}`
20277
+ );
20278
+ if (targetSessionId && this.initResponseHandlers.has(targetSessionId)) {
20279
+ console.error(
20280
+ `StreamableHttpServerTransport: Session ${targetSessionId} has initResponseHandlers. Invoking them for message ID ${messageIdForThisResponse}.`
20281
+ );
20282
+ const handlers = this.initResponseHandlers.get(targetSessionId);
20283
+ [...handlers].forEach((handler) => handler(message));
20284
+ if (!this.requestSessionMap.has(messageIdForThisResponse)) {
20285
+ console.error(
20286
+ `StreamableHttpServerTransport: Response for ID ${messageIdForThisResponse} was handled by an initResponseHandler (e.g., synchronous POST response for initialize or tools/list).`
20287
+ );
20288
+ return;
20289
+ } else {
20290
+ console.error(
20291
+ `StreamableHttpServerTransport: Response for ID ${messageIdForThisResponse} was NOT exclusively handled by an initResponseHandler or handler did not remove from requestSessionMap. Proceeding to GET stream / broadcast if applicable.`
20292
+ );
20293
+ }
20294
+ }
20295
+ if (this.requestSessionMap.has(messageIdForThisResponse)) {
20296
+ console.error(
20297
+ `StreamableHttpServerTransport: Deleting request ID ${messageIdForThisResponse} from requestSessionMap as it's being processed for GET stream or broadcast.`
20298
+ );
20299
+ this.requestSessionMap.delete(messageIdForThisResponse);
20300
+ }
20301
+ }
20302
+ if (!targetSessionId) {
20303
+ const idForLog = messageIdForThisResponse !== null ? messageIdForThisResponse : isJSONRPCRequest(message) ? message.id : "N/A";
20304
+ console.warn(
20305
+ `StreamableHttpServerTransport: No specific target session for message (ID: ${idForLog}). Broadcasting to all applicable sessions.`
20306
+ );
20307
+ for (const [sid, session2] of this.sessions.entries()) {
20308
+ if (session2.initialized && session2.activeResponses.size > 0) {
20309
+ this.sendMessageToSession(sid, session2, message);
20310
+ }
20311
+ }
20312
+ return;
20313
+ }
20314
+ const session = this.sessions.get(targetSessionId);
20315
+ if (session && session.activeResponses.size > 0) {
20316
+ console.error(
20317
+ `StreamableHttpServerTransport: Sending message (ID: ${messageIdForThisResponse}) to GET stream for session ${targetSessionId} (${session.activeResponses.size} active connections).`
20318
+ );
20319
+ this.sendMessageToSession(targetSessionId, session, message);
20320
+ } else if (targetSessionId) {
20321
+ console.error(
20322
+ `StreamableHttpServerTransport: No active GET connections for session ${targetSessionId} to send message (ID: ${messageIdForThisResponse}). Message might not be delivered if not handled by POST.`
20323
+ );
20324
+ }
20325
+ }
20326
+ /**
20327
+ * Helper method to send a message to a specific session
20328
+ */
20329
+ sendMessageToSession(sessionId, session, message) {
20330
+ const messageStr = `data: ${JSON.stringify(message)}
20331
+
20332
+ `;
20333
+ for (const response of session.activeResponses) {
20334
+ try {
20335
+ response.write(messageStr);
20336
+ } catch (err) {
20337
+ session.activeResponses.delete(response);
20338
+ if (this.onerror) {
20339
+ this.onerror(new Error(`Failed to write to response: ${err.message}`));
20340
+ }
20341
+ }
20342
+ }
20343
+ }
20344
+ /**
20345
+ * Handle HTTP request
20346
+ */
20347
+ handleRequest(req, res) {
20348
+ if (req.url !== this.endpointPath) {
20349
+ res.writeHead(404);
20350
+ res.end();
20351
+ return;
20352
+ }
20353
+ this.validateOrigin(req, res);
20354
+ switch (req.method) {
20355
+ case "POST":
20356
+ this.handlePostRequest(req, res);
20357
+ break;
20358
+ case "GET":
20359
+ this.handleGetRequest(req, res);
20360
+ break;
20361
+ case "DELETE":
20362
+ this.handleDeleteRequest(req, res);
20363
+ break;
20364
+ default:
20365
+ res.writeHead(405, { Allow: "POST, GET, DELETE" });
20366
+ res.end(
20367
+ JSON.stringify({
20368
+ jsonrpc: "2.0",
20369
+ error: {
20370
+ code: -32e3,
20371
+ message: "Method not allowed"
20372
+ },
20373
+ id: null
20374
+ })
20375
+ );
20376
+ }
20377
+ }
20378
+ /**
20379
+ * Validate origin header to prevent DNS rebinding attacks
20380
+ */
20381
+ validateOrigin(req, res) {
20382
+ const origin2 = req.headers.origin;
20383
+ if (!origin2) {
20384
+ return true;
20385
+ }
20386
+ try {
20387
+ const originUrl = new URL(origin2);
20388
+ const isLocalhost = originUrl.hostname === "localhost" || originUrl.hostname === "127.0.0.1";
20389
+ if (!isLocalhost) {
20390
+ res.writeHead(403);
20391
+ res.end(
20392
+ JSON.stringify({
20393
+ jsonrpc: "2.0",
20394
+ error: {
20395
+ code: -32e3,
20396
+ message: "Origin not allowed"
20397
+ },
20398
+ id: null
20399
+ })
20400
+ );
20401
+ return false;
20402
+ }
20403
+ return true;
20404
+ } catch (err) {
20405
+ res.writeHead(400);
20406
+ res.end(
20407
+ JSON.stringify({
20408
+ jsonrpc: "2.0",
20409
+ error: {
20410
+ code: -32e3,
20411
+ message: "Invalid origin"
20412
+ },
20413
+ id: null
20414
+ })
20415
+ );
20416
+ return false;
20417
+ }
20418
+ }
20419
+ /**
20420
+ * Handle POST request
20421
+ */
20422
+ handlePostRequest(req, res) {
20423
+ const contentType = req.headers["content-type"];
20424
+ if (!contentType || !contentType.includes("application/json")) {
20425
+ res.writeHead(415);
20426
+ res.end(
20427
+ JSON.stringify({
20428
+ jsonrpc: "2.0",
20429
+ error: {
20430
+ code: -32e3,
20431
+ message: "Unsupported Media Type: Content-Type must be application/json"
20432
+ },
20433
+ id: null
20434
+ })
20435
+ );
20436
+ return;
20437
+ }
20438
+ let body = "";
20439
+ let size = 0;
20440
+ req.on("data", (chunk) => {
20441
+ size += chunk.length;
20442
+ if (size > this.maxBodySize) {
20443
+ res.writeHead(413);
20444
+ res.end(
20445
+ JSON.stringify({
20446
+ jsonrpc: "2.0",
20447
+ error: {
20448
+ code: -32e3,
20449
+ message: "Request entity too large"
20450
+ },
20451
+ id: null
20452
+ })
20453
+ );
20454
+ req.destroy();
20455
+ return;
20456
+ }
20457
+ body += chunk.toString();
20458
+ });
20459
+ req.on("end", () => {
20460
+ try {
20461
+ const message = JSON.parse(body);
20462
+ if (isInitializeRequest(message)) {
20463
+ this.handleInitializeRequest(message, req, res);
20464
+ } else if (isJSONRPCRequest(message) && message.method === "tools/list") {
20465
+ const sessionId = req.headers["mcp-session-id"];
20466
+ if (!sessionId || !this.sessions.has(sessionId)) {
20467
+ res.writeHead(400);
20468
+ res.end(
20469
+ JSON.stringify({
20470
+ jsonrpc: "2.0",
20471
+ error: {
20472
+ code: -32e3,
20473
+ message: "Invalid session. A valid Mcp-Session-Id header is required."
20474
+ },
20475
+ id: "id" in message ? message.id : null
20476
+ })
20477
+ );
20478
+ return;
20479
+ }
20480
+ const session = this.sessions.get(sessionId);
20481
+ if (message.id !== void 0 && message.id !== null) {
20482
+ this.requestSessionMap.set(message.id, sessionId);
20483
+ if (!session.pendingRequests) {
20484
+ session.pendingRequests = /* @__PURE__ */ new Set();
20485
+ }
20486
+ session.pendingRequests.add(message.id);
20487
+ }
20488
+ const responseHandler = (responseMessage) => {
20489
+ if (isJSONRPCResponse(responseMessage) && responseMessage.id === message.id) {
20490
+ res.setHeader("Content-Type", "application/json");
20491
+ res.writeHead(200);
20492
+ res.end(JSON.stringify(responseMessage));
20493
+ this.removeInitResponseHandler(sessionId, responseHandler);
20494
+ if (message.id !== void 0 && message.id !== null) {
20495
+ this.requestSessionMap.delete(message.id);
20496
+ session.pendingRequests.delete(message.id);
20497
+ }
20498
+ }
20499
+ };
20500
+ this.addInitResponseHandler(sessionId, responseHandler);
20501
+ if (session.messageHandler) {
20502
+ session.messageHandler(message);
20503
+ } else {
20504
+ this.removeInitResponseHandler(sessionId, responseHandler);
20505
+ res.writeHead(500);
20506
+ res.end(
20507
+ JSON.stringify({
20508
+ jsonrpc: "2.0",
20509
+ error: {
20510
+ code: -32603,
20511
+ message: "Internal error: No message handler available"
20512
+ },
20513
+ id: "id" in message ? message.id : null
20514
+ })
20515
+ );
20516
+ }
20517
+ } else {
20518
+ const sessionId = req.headers["mcp-session-id"];
20519
+ if (!sessionId || !this.sessions.has(sessionId)) {
20520
+ res.writeHead(400);
20521
+ res.end(
20522
+ JSON.stringify({
20523
+ jsonrpc: "2.0",
20524
+ error: {
20525
+ code: -32e3,
20526
+ message: "Invalid session. A valid Mcp-Session-Id header is required."
20527
+ },
20528
+ id: "id" in message ? message.id : null
20529
+ })
20530
+ );
20531
+ return;
20532
+ }
20533
+ const session = this.sessions.get(sessionId);
20534
+ if (isJSONRPCRequest(message)) {
20535
+ if (session.messageHandler) {
20536
+ if (message.id !== void 0 && message.id !== null) {
20537
+ this.requestSessionMap.set(message.id, sessionId);
20538
+ if (!session.pendingRequests) {
20539
+ session.pendingRequests = /* @__PURE__ */ new Set();
20540
+ }
20541
+ session.pendingRequests.add(message.id);
20542
+ }
20543
+ session.messageHandler(message);
20544
+ res.writeHead(202);
20545
+ res.end();
20546
+ }
20547
+ } else {
20548
+ if (session.messageHandler) {
20549
+ session.messageHandler(message);
20550
+ res.writeHead(202);
20551
+ res.end();
20552
+ }
20553
+ }
20554
+ }
20555
+ } catch (err) {
20556
+ res.writeHead(400);
20557
+ res.end(
20558
+ JSON.stringify({
20559
+ jsonrpc: "2.0",
20560
+ error: {
20561
+ code: -32700,
20562
+ message: "Parse error",
20563
+ data: String(err)
20564
+ },
20565
+ id: null
20566
+ })
20567
+ );
20568
+ if (this.onerror) {
20569
+ this.onerror(new Error(`Parse error: ${String(err)}`));
20570
+ }
20571
+ }
20572
+ });
20573
+ req.on("error", (err) => {
20574
+ if (this.onerror) {
20575
+ this.onerror(err instanceof Error ? err : new Error(String(err)));
20576
+ }
20577
+ });
20578
+ }
20579
+ /**
20580
+ * Handle initialization request
20581
+ */
20582
+ handleInitializeRequest(message, _req, res) {
20583
+ const sessionId = randomUUID();
20584
+ this.sessions.set(sessionId, {
20585
+ // eslint-disable-next-line @typescript-eslint/explicit-function-return-type
20586
+ messageHandler: this.onmessage || (() => {
20587
+ }),
20588
+ activeResponses: /* @__PURE__ */ new Set(),
20589
+ initialized: true,
20590
+ pendingRequests: /* @__PURE__ */ new Set()
20591
+ });
20592
+ if ("id" in message && message.id !== null && message.id !== void 0) {
20593
+ this.requestSessionMap.set(message.id, sessionId);
20594
+ }
20595
+ res.setHeader("Content-Type", "application/json");
20596
+ res.setHeader("Mcp-Session-Id", sessionId);
20597
+ const responseHandler = (responseMessage) => {
20598
+ if (isJSONRPCResponse(responseMessage) && "id" in message && responseMessage.id === message.id) {
20599
+ res.writeHead(200);
20600
+ res.end(JSON.stringify(responseMessage));
20601
+ this.removeInitResponseHandler(sessionId, responseHandler);
20602
+ this.requestSessionMap.delete(message.id);
20603
+ }
20604
+ };
20605
+ this.addInitResponseHandler(sessionId, responseHandler);
20606
+ if (this.onmessage) {
20607
+ this.onmessage(message);
20608
+ } else {
20609
+ this.removeInitResponseHandler(sessionId, responseHandler);
20610
+ res.writeHead(500);
20611
+ res.end(
20612
+ JSON.stringify({
20613
+ jsonrpc: "2.0",
20614
+ error: {
20615
+ code: -32603,
20616
+ message: "Internal error: No message handler available"
20617
+ },
20618
+ id: "id" in message ? message.id : null
20619
+ })
20620
+ );
20621
+ }
20622
+ }
20623
+ /**
20624
+ * Add initialize response handler
20625
+ */
20626
+ initResponseHandlers = /* @__PURE__ */ new Map();
20627
+ addInitResponseHandler(sessionId, handler) {
20628
+ if (!this.initResponseHandlers.has(sessionId)) {
20629
+ this.initResponseHandlers.set(sessionId, []);
20630
+ }
20631
+ this.initResponseHandlers.get(sessionId).push(handler);
20632
+ }
20633
+ removeInitResponseHandler(sessionId, handler) {
20634
+ if (this.initResponseHandlers.has(sessionId)) {
20635
+ const handlers = this.initResponseHandlers.get(sessionId);
20636
+ const index = handlers.indexOf(handler);
20637
+ if (index !== -1) {
20638
+ handlers.splice(index, 1);
20639
+ }
20640
+ if (handlers.length === 0) {
20641
+ this.initResponseHandlers.delete(sessionId);
20642
+ }
20643
+ }
20644
+ }
20645
+ /**
20646
+ * Handle GET request (streaming connection)
20647
+ */
20648
+ handleGetRequest(req, res) {
20649
+ const sessionId = req.headers["mcp-session-id"];
20650
+ if (!sessionId || !this.sessions.has(sessionId)) {
20651
+ res.writeHead(400);
20652
+ res.end(
20653
+ JSON.stringify({
20654
+ jsonrpc: "2.0",
20655
+ error: {
20656
+ code: -32e3,
20657
+ message: "Invalid session. A valid Mcp-Session-Id header is required."
20658
+ },
20659
+ id: null
20660
+ })
20661
+ );
20662
+ return;
20663
+ }
20664
+ const session = this.sessions.get(sessionId);
20665
+ res.setHeader("Content-Type", "text/event-stream");
20666
+ res.setHeader("Connection", "keep-alive");
20667
+ res.setHeader("Cache-Control", "no-cache, no-transform");
20668
+ res.setHeader("Transfer-Encoding", "chunked");
20669
+ res.setHeader("Mcp-Session-Id", sessionId);
20670
+ res.writeHead(200);
20671
+ session.activeResponses.add(res);
20672
+ req.on("close", () => {
20673
+ session.activeResponses.delete(res);
20674
+ });
20675
+ res.on("error", (err) => {
20676
+ session.activeResponses.delete(res);
20677
+ if (this.onerror) {
20678
+ this.onerror(err);
20679
+ }
20680
+ });
20681
+ }
20682
+ /**
20683
+ * Handle DELETE request (session termination)
20684
+ */
20685
+ handleDeleteRequest(req, res) {
20686
+ const sessionId = req.headers["mcp-session-id"];
20687
+ if (!sessionId || !this.sessions.has(sessionId)) {
20688
+ res.writeHead(400);
20689
+ res.end(
20690
+ JSON.stringify({
20691
+ jsonrpc: "2.0",
20692
+ error: {
20693
+ code: -32e3,
20694
+ message: "Invalid session. A valid Mcp-Session-Id header is required."
20695
+ },
20696
+ id: null
20697
+ })
20698
+ );
20699
+ return;
20700
+ }
20701
+ const session = this.sessions.get(sessionId);
20702
+ for (const response of session.activeResponses) {
20703
+ try {
20704
+ response.end();
20705
+ } catch (err) {
20706
+ }
20707
+ }
20708
+ if (session.pendingRequests) {
20709
+ for (const requestId of session.pendingRequests) {
20710
+ this.requestSessionMap.delete(requestId);
20711
+ }
20712
+ }
20713
+ this.sessions.delete(sessionId);
20714
+ res.writeHead(204);
20715
+ res.end();
20716
+ }
20717
+ };
20718
+
19299
20719
  // src/index.ts
19300
20720
  async function main() {
19301
20721
  try {
19302
20722
  const config = loadConfig();
19303
20723
  const server = new OpenAPIServer(config);
19304
- const transport = new StdioServerTransport();
19305
- await server.start(transport);
19306
- console.error("OpenAPI MCP Server running on stdio");
20724
+ let transport;
20725
+ if (config.transportType === "http") {
20726
+ transport = new StreamableHttpServerTransport(
20727
+ config.httpPort,
20728
+ config.httpHost,
20729
+ config.endpointPath
20730
+ );
20731
+ await server.start(transport);
20732
+ console.error(
20733
+ `OpenAPI MCP Server running on http://${config.httpHost}:${config.httpPort}${config.endpointPath}`
20734
+ );
20735
+ } else {
20736
+ transport = new StdioServerTransport();
20737
+ await server.start(transport);
20738
+ console.error("OpenAPI MCP Server running on stdio");
20739
+ }
19307
20740
  } catch (error) {
19308
20741
  console.error("Failed to start server:", error);
19309
20742
  process.exit(1);
@@ -19314,6 +20747,7 @@ export {
19314
20747
  ApiClient,
19315
20748
  OpenAPIServer,
19316
20749
  OpenAPISpecLoader,
20750
+ StreamableHttpServerTransport,
19317
20751
  ToolsManager,
19318
20752
  loadConfig,
19319
20753
  parseHeaders