@mcp-z/client 2.0.0 → 2.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 (62) hide show
  1. package/dist/cjs/auth/capability-discovery.js +11 -5
  2. package/dist/cjs/auth/capability-discovery.js.map +1 -1
  3. package/dist/cjs/auth/types.d.cts +11 -0
  4. package/dist/cjs/auth/types.d.ts +11 -0
  5. package/dist/cjs/auth/types.js.map +1 -1
  6. package/dist/cjs/client-helpers.d.cts +5 -6
  7. package/dist/cjs/client-helpers.d.ts +5 -6
  8. package/dist/cjs/client-helpers.js +8 -8
  9. package/dist/cjs/client-helpers.js.map +1 -1
  10. package/dist/cjs/connection/connect-client.d.cts +1 -11
  11. package/dist/cjs/connection/connect-client.d.ts +1 -11
  12. package/dist/cjs/connection/connect-client.js +20 -41
  13. package/dist/cjs/connection/connect-client.js.map +1 -1
  14. package/dist/cjs/connection/existing-process-transport.d.cts +1 -2
  15. package/dist/cjs/connection/existing-process-transport.d.ts +1 -2
  16. package/dist/cjs/connection/existing-process-transport.js +3 -3
  17. package/dist/cjs/connection/existing-process-transport.js.map +1 -1
  18. package/dist/cjs/dcr/dcr-authenticator.d.cts +30 -4
  19. package/dist/cjs/dcr/dcr-authenticator.d.ts +30 -4
  20. package/dist/cjs/dcr/dcr-authenticator.js +57 -24
  21. package/dist/cjs/dcr/dcr-authenticator.js.map +1 -1
  22. package/dist/cjs/lib/url-utils.d.cts +17 -0
  23. package/dist/cjs/lib/url-utils.d.ts +17 -0
  24. package/dist/cjs/lib/url-utils.js +20 -0
  25. package/dist/cjs/lib/url-utils.js.map +1 -1
  26. package/dist/cjs/response-wrappers.d.cts +1 -1
  27. package/dist/cjs/response-wrappers.d.ts +1 -1
  28. package/dist/cjs/response-wrappers.js.map +1 -1
  29. package/dist/cjs/search/search.d.cts +1 -1
  30. package/dist/cjs/search/search.d.ts +1 -1
  31. package/dist/cjs/search/search.js.map +1 -1
  32. package/dist/esm/auth/capability-discovery.js +11 -5
  33. package/dist/esm/auth/capability-discovery.js.map +1 -1
  34. package/dist/esm/auth/types.d.ts +11 -0
  35. package/dist/esm/auth/types.js.map +1 -1
  36. package/dist/esm/client-helpers.d.ts +5 -6
  37. package/dist/esm/client-helpers.js +8 -8
  38. package/dist/esm/client-helpers.js.map +1 -1
  39. package/dist/esm/connection/connect-client.d.ts +1 -11
  40. package/dist/esm/connection/connect-client.js +12 -32
  41. package/dist/esm/connection/connect-client.js.map +1 -1
  42. package/dist/esm/connection/existing-process-transport.d.ts +1 -2
  43. package/dist/esm/connection/existing-process-transport.js +1 -1
  44. package/dist/esm/connection/existing-process-transport.js.map +1 -1
  45. package/dist/esm/dcr/dcr-authenticator.d.ts +30 -4
  46. package/dist/esm/dcr/dcr-authenticator.js +56 -23
  47. package/dist/esm/dcr/dcr-authenticator.js.map +1 -1
  48. package/dist/esm/lib/url-utils.d.ts +17 -0
  49. package/dist/esm/lib/url-utils.js +32 -0
  50. package/dist/esm/lib/url-utils.js.map +1 -1
  51. package/dist/esm/response-wrappers.d.ts +1 -1
  52. package/dist/esm/response-wrappers.js.map +1 -1
  53. package/dist/esm/search/search.d.ts +1 -1
  54. package/dist/esm/search/search.js.map +1 -1
  55. package/package.json +3 -3
  56. package/dist/cjs/monkey-patches.d.cts +0 -6
  57. package/dist/cjs/monkey-patches.d.ts +0 -6
  58. package/dist/cjs/monkey-patches.js +0 -233
  59. package/dist/cjs/monkey-patches.js.map +0 -1
  60. package/dist/esm/monkey-patches.d.ts +0 -6
  61. package/dist/esm/monkey-patches.js +0 -32
  62. package/dist/esm/monkey-patches.js.map +0 -1
@@ -1,233 +0,0 @@
1
- /**
2
- * Monkey patches for MCP SDK bugs
3
- *
4
- * These patches fix bugs in dependencies that haven't been fixed upstream yet.
5
- */ "use strict";
6
- Object.defineProperty(exports, "__esModule", {
7
- value: true
8
- });
9
- var _protocol = require("@modelcontextprotocol/sdk/shared/protocol.js");
10
- function _array_like_to_array(arr, len) {
11
- if (len == null || len > arr.length) len = arr.length;
12
- for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
13
- return arr2;
14
- }
15
- function _array_with_holes(arr) {
16
- if (Array.isArray(arr)) return arr;
17
- }
18
- function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
19
- try {
20
- var info = gen[key](arg);
21
- var value = info.value;
22
- } catch (error) {
23
- reject(error);
24
- return;
25
- }
26
- if (info.done) resolve(value);
27
- else Promise.resolve(value).then(_next, _throw);
28
- }
29
- function _async_to_generator(fn) {
30
- return function() {
31
- var self = this, args = arguments;
32
- return new Promise(function(resolve, reject) {
33
- var gen = fn.apply(self, args);
34
- function _next(value) {
35
- asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
36
- }
37
- function _throw(err) {
38
- asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
39
- }
40
- _next(undefined);
41
- });
42
- };
43
- }
44
- function _iterable_to_array_limit(arr, i) {
45
- var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
46
- if (_i == null) return;
47
- var _arr = [];
48
- var _n = true;
49
- var _d = false;
50
- var _s, _e;
51
- try {
52
- for(_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true){
53
- _arr.push(_s.value);
54
- if (i && _arr.length === i) break;
55
- }
56
- } catch (err) {
57
- _d = true;
58
- _e = err;
59
- } finally{
60
- try {
61
- if (!_n && _i["return"] != null) _i["return"]();
62
- } finally{
63
- if (_d) throw _e;
64
- }
65
- }
66
- return _arr;
67
- }
68
- function _non_iterable_rest() {
69
- throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
70
- }
71
- function _sliced_to_array(arr, i) {
72
- return _array_with_holes(arr) || _iterable_to_array_limit(arr, i) || _unsupported_iterable_to_array(arr, i) || _non_iterable_rest();
73
- }
74
- function _ts_generator(thisArg, body) {
75
- var f, y, t, _ = {
76
- label: 0,
77
- sent: function() {
78
- if (t[0] & 1) throw t[1];
79
- return t[1];
80
- },
81
- trys: [],
82
- ops: []
83
- }, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype), d = Object.defineProperty;
84
- return d(g, "next", {
85
- value: verb(0)
86
- }), d(g, "throw", {
87
- value: verb(1)
88
- }), d(g, "return", {
89
- value: verb(2)
90
- }), typeof Symbol === "function" && d(g, Symbol.iterator, {
91
- value: function() {
92
- return this;
93
- }
94
- }), g;
95
- function verb(n) {
96
- return function(v) {
97
- return step([
98
- n,
99
- v
100
- ]);
101
- };
102
- }
103
- function step(op) {
104
- if (f) throw new TypeError("Generator is already executing.");
105
- while(g && (g = 0, op[0] && (_ = 0)), _)try {
106
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
107
- if (y = 0, t) op = [
108
- op[0] & 2,
109
- t.value
110
- ];
111
- switch(op[0]){
112
- case 0:
113
- case 1:
114
- t = op;
115
- break;
116
- case 4:
117
- _.label++;
118
- return {
119
- value: op[1],
120
- done: false
121
- };
122
- case 5:
123
- _.label++;
124
- y = op[1];
125
- op = [
126
- 0
127
- ];
128
- continue;
129
- case 7:
130
- op = _.ops.pop();
131
- _.trys.pop();
132
- continue;
133
- default:
134
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
135
- _ = 0;
136
- continue;
137
- }
138
- if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
139
- _.label = op[1];
140
- break;
141
- }
142
- if (op[0] === 6 && _.label < t[1]) {
143
- _.label = t[1];
144
- t = op;
145
- break;
146
- }
147
- if (t && _.label < t[2]) {
148
- _.label = t[2];
149
- _.ops.push(op);
150
- break;
151
- }
152
- if (t[2]) _.ops.pop();
153
- _.trys.pop();
154
- continue;
155
- }
156
- op = body.call(thisArg, _);
157
- } catch (e) {
158
- op = [
159
- 6,
160
- e
161
- ];
162
- y = 0;
163
- } finally{
164
- f = t = 0;
165
- }
166
- if (op[0] & 5) throw op[1];
167
- return {
168
- value: op[0] ? op[1] : void 0,
169
- done: true
170
- };
171
- }
172
- }
173
- function _unsupported_iterable_to_array(o, minLen) {
174
- if (!o) return;
175
- if (typeof o === "string") return _array_like_to_array(o, minLen);
176
- var n = Object.prototype.toString.call(o).slice(8, -1);
177
- if (n === "Object" && o.constructor) n = o.constructor.name;
178
- if (n === "Map" || n === "Set") return Array.from(n);
179
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
180
- }
181
- /**
182
- * FIX: Protocol.close() doesn't clear pending timeouts
183
- *
184
- * BUG: The MCP SDK's Protocol.close() only closes the transport but does NOT
185
- * clear pending timeouts from the internal _timeoutInfo Map. This causes Node.js
186
- * to hang until timeouts fire (default 60 seconds).
187
- *
188
- * PATCH: Wrap Protocol.close() to clear all pending timeouts before closing.
189
- *
190
- * TO TEST IF STILL NEEDED:
191
- * 1. Comment out this patch
192
- * 2. Run: npm run test:unit
193
- * 3. If tests hang ~60 seconds after completing, bug still exists
194
- * 4. If tests exit promptly, SDK is fixed and this can be removed
195
- *
196
- * UPSTREAM: https://github.com/modelcontextprotocol/typescript-sdk/issues/XXX
197
- */ var originalClose = _protocol.Protocol.prototype.close;
198
- _protocol.Protocol.prototype.close = function() {
199
- return _async_to_generator(function() {
200
- var self, _iteratorNormalCompletion, _didIteratorError, _iteratorError, _iterator, _step, _step_value, info;
201
- return _ts_generator(this, function(_state) {
202
- self = this;
203
- if (self._timeoutInfo) {
204
- _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
205
- try {
206
- for(_iterator = self._timeoutInfo[Symbol.iterator](); !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
207
- _step_value = _sliced_to_array(_step.value, 2), info = _step_value[1];
208
- clearTimeout(info.timeoutId);
209
- }
210
- } catch (err) {
211
- _didIteratorError = true;
212
- _iteratorError = err;
213
- } finally{
214
- try {
215
- if (!_iteratorNormalCompletion && _iterator.return != null) {
216
- _iterator.return();
217
- }
218
- } finally{
219
- if (_didIteratorError) {
220
- throw _iteratorError;
221
- }
222
- }
223
- }
224
- self._timeoutInfo.clear();
225
- }
226
- return [
227
- 2,
228
- originalClose.call(this)
229
- ];
230
- });
231
- }).call(this);
232
- };
233
- /* CJS INTEROP */ if (exports.__esModule && exports.default) { try { Object.defineProperty(exports.default, '__esModule', { value: true }); for (var key in exports) { exports.default[key] = exports[key]; } } catch (_) {}; module.exports = exports.default; }
@@ -1 +0,0 @@
1
- {"version":3,"sources":["/Users/kevin/Dev/OpenSource/ai/mcp-z/client/src/monkey-patches.ts"],"sourcesContent":["/**\n * Monkey patches for MCP SDK bugs\n *\n * These patches fix bugs in dependencies that haven't been fixed upstream yet.\n */\n\nimport { Protocol } from '@modelcontextprotocol/sdk/shared/protocol.js';\n\n/**\n * FIX: Protocol.close() doesn't clear pending timeouts\n *\n * BUG: The MCP SDK's Protocol.close() only closes the transport but does NOT\n * clear pending timeouts from the internal _timeoutInfo Map. This causes Node.js\n * to hang until timeouts fire (default 60 seconds).\n *\n * PATCH: Wrap Protocol.close() to clear all pending timeouts before closing.\n *\n * TO TEST IF STILL NEEDED:\n * 1. Comment out this patch\n * 2. Run: npm run test:unit\n * 3. If tests hang ~60 seconds after completing, bug still exists\n * 4. If tests exit promptly, SDK is fixed and this can be removed\n *\n * UPSTREAM: https://github.com/modelcontextprotocol/typescript-sdk/issues/XXX\n */\nconst originalClose = Protocol.prototype.close;\nProtocol.prototype.close = async function () {\n const self = this as unknown as { _timeoutInfo?: Map<unknown, { timeoutId: ReturnType<typeof setTimeout> }> };\n if (self._timeoutInfo) {\n for (const [, info] of self._timeoutInfo) {\n clearTimeout(info.timeoutId);\n }\n self._timeoutInfo.clear();\n }\n return originalClose.call(this);\n};\n"],"names":["originalClose","Protocol","prototype","close","self","info","_timeoutInfo","clearTimeout","timeoutId","clear","call"],"mappings":"AAAA;;;;CAIC;;;;wBAEwB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEzB;;;;;;;;;;;;;;;;CAgBC,GACD,IAAMA,gBAAgBC,kBAAQ,CAACC,SAAS,CAACC,KAAK;AAC9CF,kBAAQ,CAACC,SAAS,CAACC,KAAK,GAAG;;YACnBC,MAEC,2BAAA,mBAAA,gBAAA,WAAA,oBAASC;;YAFVD,OAAO,IAAI;YACjB,IAAIA,KAAKE,YAAY,EAAE;gBAChB,kCAAA,2BAAA;;oBAAL,IAAK,YAAkBF,KAAKE,YAAY,uBAAnC,6BAAA,QAAA,yBAAA,iCAAqC;uDAArC,iBAASD;wBACZE,aAAaF,KAAKG,SAAS;oBAC7B;;oBAFK;oBAAA;;;6BAAA,6BAAA;4BAAA;;;4BAAA;kCAAA;;;;gBAGLJ,KAAKE,YAAY,CAACG,KAAK;YACzB;YACA;;gBAAOT,cAAcU,IAAI,CAAC,IAAI;;;IAChC"}
@@ -1,6 +0,0 @@
1
- /**
2
- * Monkey patches for MCP SDK bugs
3
- *
4
- * These patches fix bugs in dependencies that haven't been fixed upstream yet.
5
- */
6
- export {};
@@ -1,32 +0,0 @@
1
- /**
2
- * Monkey patches for MCP SDK bugs
3
- *
4
- * These patches fix bugs in dependencies that haven't been fixed upstream yet.
5
- */ import { Protocol } from '@modelcontextprotocol/sdk/shared/protocol.js';
6
- /**
7
- * FIX: Protocol.close() doesn't clear pending timeouts
8
- *
9
- * BUG: The MCP SDK's Protocol.close() only closes the transport but does NOT
10
- * clear pending timeouts from the internal _timeoutInfo Map. This causes Node.js
11
- * to hang until timeouts fire (default 60 seconds).
12
- *
13
- * PATCH: Wrap Protocol.close() to clear all pending timeouts before closing.
14
- *
15
- * TO TEST IF STILL NEEDED:
16
- * 1. Comment out this patch
17
- * 2. Run: npm run test:unit
18
- * 3. If tests hang ~60 seconds after completing, bug still exists
19
- * 4. If tests exit promptly, SDK is fixed and this can be removed
20
- *
21
- * UPSTREAM: https://github.com/modelcontextprotocol/typescript-sdk/issues/XXX
22
- */ const originalClose = Protocol.prototype.close;
23
- Protocol.prototype.close = async function() {
24
- const self = this;
25
- if (self._timeoutInfo) {
26
- for (const [, info] of self._timeoutInfo){
27
- clearTimeout(info.timeoutId);
28
- }
29
- self._timeoutInfo.clear();
30
- }
31
- return originalClose.call(this);
32
- };
@@ -1 +0,0 @@
1
- {"version":3,"sources":["/Users/kevin/Dev/OpenSource/ai/mcp-z/client/src/monkey-patches.ts"],"sourcesContent":["/**\n * Monkey patches for MCP SDK bugs\n *\n * These patches fix bugs in dependencies that haven't been fixed upstream yet.\n */\n\nimport { Protocol } from '@modelcontextprotocol/sdk/shared/protocol.js';\n\n/**\n * FIX: Protocol.close() doesn't clear pending timeouts\n *\n * BUG: The MCP SDK's Protocol.close() only closes the transport but does NOT\n * clear pending timeouts from the internal _timeoutInfo Map. This causes Node.js\n * to hang until timeouts fire (default 60 seconds).\n *\n * PATCH: Wrap Protocol.close() to clear all pending timeouts before closing.\n *\n * TO TEST IF STILL NEEDED:\n * 1. Comment out this patch\n * 2. Run: npm run test:unit\n * 3. If tests hang ~60 seconds after completing, bug still exists\n * 4. If tests exit promptly, SDK is fixed and this can be removed\n *\n * UPSTREAM: https://github.com/modelcontextprotocol/typescript-sdk/issues/XXX\n */\nconst originalClose = Protocol.prototype.close;\nProtocol.prototype.close = async function () {\n const self = this as unknown as { _timeoutInfo?: Map<unknown, { timeoutId: ReturnType<typeof setTimeout> }> };\n if (self._timeoutInfo) {\n for (const [, info] of self._timeoutInfo) {\n clearTimeout(info.timeoutId);\n }\n self._timeoutInfo.clear();\n }\n return originalClose.call(this);\n};\n"],"names":["Protocol","originalClose","prototype","close","self","_timeoutInfo","info","clearTimeout","timeoutId","clear","call"],"mappings":"AAAA;;;;CAIC,GAED,SAASA,QAAQ,QAAQ,+CAA+C;AAExE;;;;;;;;;;;;;;;;CAgBC,GACD,MAAMC,gBAAgBD,SAASE,SAAS,CAACC,KAAK;AAC9CH,SAASE,SAAS,CAACC,KAAK,GAAG;IACzB,MAAMC,OAAO,IAAI;IACjB,IAAIA,KAAKC,YAAY,EAAE;QACrB,KAAK,MAAM,GAAGC,KAAK,IAAIF,KAAKC,YAAY,CAAE;YACxCE,aAAaD,KAAKE,SAAS;QAC7B;QACAJ,KAAKC,YAAY,CAACI,KAAK;IACzB;IACA,OAAOR,cAAcS,IAAI,CAAC,IAAI;AAChC"}