@opentiny/next 0.1.1 → 0.1.2

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/client.js +293 -269
  2. package/package.json +4 -3
  3. package/server.js +213 -196
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opentiny/next",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "author": "Chunhui Mo",
@@ -12,11 +12,12 @@
12
12
  ],
13
13
  "main": "client.js",
14
14
  "module": "client.js",
15
+ "types": "client.d.ts",
15
16
  "description": "OpenTiny NEXT",
16
17
  "dependencies": {
17
- "@modelcontextprotocol/sdk": "^1.11.0",
18
+ "@modelcontextprotocol/sdk": "^1.12.0",
18
19
  "jsonwebtoken": "^9.0.2",
19
- "zod": "^3.24.4"
20
+ "zod": "^3.25.30"
20
21
  },
21
22
  "peerDependencies": {
22
23
  "express": "^4.21.2"
package/server.js CHANGED
@@ -1,273 +1,290 @@
1
- import R from "jsonwebtoken";
1
+ import k from "jsonwebtoken";
2
2
  import { McpServer as P } from "@modelcontextprotocol/sdk/server/mcp.js";
3
- import { Client as G } from "@modelcontextprotocol/sdk/client/index.js";
4
- import { SSEServerTransport as E } from "@modelcontextprotocol/sdk/server/sse.js";
5
- import { StreamableHTTPServerTransport as C } from "@modelcontextprotocol/sdk/server/streamableHttp.js";
6
- import { isInitializeRequest as D } from "@modelcontextprotocol/sdk/types.js";
3
+ import { Client as j } from "@modelcontextprotocol/sdk/client/index.js";
4
+ import { SSEServerTransport as G } from "@modelcontextprotocol/sdk/server/sse.js";
5
+ import { StreamableHTTPServerTransport as W } from "@modelcontextprotocol/sdk/server/streamableHttp.js";
6
+ import { isInitializeRequest as H } from "@modelcontextprotocol/sdk/types.js";
7
7
  (function(e, a) {
8
- const x = _, s = e();
8
+ const x = w, t = e();
9
9
  for (; ; )
10
10
  try {
11
- if (-parseInt(x(214)) / 1 + -parseInt(x(218)) / 2 + -parseInt(x(209)) / 3 * (-parseInt(x(215)) / 4) + -parseInt(x(180)) / 5 * (-parseInt(x(206)) / 6) + -parseInt(x(202)) / 7 * (-parseInt(x(216)) / 8) + -parseInt(x(178)) / 9 + -parseInt(x(187)) / 10 * (-parseInt(x(196)) / 11) === a) break;
12
- s.push(s.shift());
11
+ if (parseInt(x(218)) / 1 + parseInt(x(199)) / 2 * (parseInt(x(219)) / 3) + parseInt(x(175)) / 4 * (parseInt(x(216)) / 5) + -parseInt(x(186)) / 6 + parseInt(x(221)) / 7 + -parseInt(x(176)) / 8 + -parseInt(x(200)) / 9 * (-parseInt(x(179)) / 10) === a) break;
12
+ t.push(t.shift());
13
13
  } catch {
14
- s.push(s.shift());
14
+ t.push(t.shift());
15
15
  }
16
- })(v, 21221 + 415033 * -3 + 1911515 * 1);
16
+ })(y, -881597 * -1 + 119772 + 1 * -550231);
17
17
  const J = async (e, a) => {
18
- const x = _, s = { LHerf: x(190), emwBK: x(201), HohQv: "resources/read", WQgCS: x(195), Xzrrt: x(179), cXnlb: "ping", RFwiY: x(198), Ahdht: "logging/setLevel", gQXkS: x(182) };
19
- let r;
20
- const { id: o, method: l, params: u } = a;
21
- if (l) {
22
- switch (l) {
23
- case s[x(217)]:
24
- r = await e._client[x(207)](u);
18
+ const x = w, t = { UEbhm: x(183), oAXlP: x(178), WtABw: x(214), whlca: x(212), tIXdr: x(220), qcPAX: x(209), XvPig: x(188), JTRNp: x(190), qfCYO: x(208), sYWLX: x(177), GUEcj: x(204), rqait: function(g, I) {
19
+ return g !== I;
20
+ }, ZXHPq: "initialize", ngGcA: function(g, I) {
21
+ return g !== I;
22
+ }, BkyoX: "notifications/initialized" };
23
+ let n;
24
+ const { id: o, method: u, params: d } = a;
25
+ if (u) {
26
+ switch (u) {
27
+ case t.UEbhm:
28
+ n = await e[x(184)][x(193)](d);
25
29
  break;
26
- case x(175):
27
- r = await e[x(186)][x(189)](u);
30
+ case t[x(217)]:
31
+ n = await e[x(184)][x(210)](d);
28
32
  break;
29
- case "resources/list":
30
- r = await e._client[x(181)](u);
33
+ case t.WtABw:
34
+ n = await e[x(184)][x(197)](d);
31
35
  break;
32
- case s[x(191)]:
33
- r = await e[x(186)].listResourceTemplates(u);
36
+ case t.whlca:
37
+ n = await e[x(184)][x(205)](d);
34
38
  break;
35
- case s[x(177)]:
36
- r = await e._client[x(193)](u);
39
+ case t[x(215)]:
40
+ n = await e[x(184)][x(206)](d);
37
41
  break;
38
- case x(212):
39
- r = await e._client.subscribeResource(u);
42
+ case t[x(213)]:
43
+ n = await e._client[x(194)](d);
40
44
  break;
41
- case s[x(184)]:
42
- r = await e[x(186)][x(176)](u);
45
+ case t[x(187)]:
46
+ n = await e[x(184)][x(191)](d);
43
47
  break;
44
- case s[x(185)]:
45
- r = await e[x(186)][x(208)](u);
48
+ case t[x(211)]:
49
+ n = await e._client[x(201)](d);
46
50
  break;
47
- case x(210):
48
- r = await e[x(186)][x(199)](u);
51
+ case x(192):
52
+ n = await e._client[x(185)](d);
49
53
  break;
50
- case s[x(211)]:
51
- r = await e._client.ping();
54
+ case t[x(202)]:
55
+ n = await e[x(184)].ping();
52
56
  break;
53
- case s[x(183)]:
54
- r = await e[x(186)][x(200)](u);
57
+ case x(195):
58
+ n = await e._client[x(182)](d);
55
59
  break;
56
- case s[x(192)]:
57
- r = await e[x(186)][x(203)](u);
60
+ case t.sYWLX:
61
+ n = await e[x(184)][x(198)](d);
58
62
  break;
59
63
  }
60
- return r && await e[x(188)]({ result: r, jsonrpc: s[x(205)], id: o }), r;
64
+ return n ? await e.send({ result: n, jsonrpc: t[x(173)], id: o }) : t[x(207)](u, t.ZXHPq) && t[x(189)](u, t[x(196)]) && await e[x(184)].notification({ method: u, params: d }), n;
61
65
  }
62
- };
63
- function _(e, a) {
64
- const x = v();
65
- return _ = function(s, r) {
66
- return s = s - (1 * -9967 + -4408 + 150 * 97), x[s];
67
- }, _(e, a);
68
- }
69
- const V = (e) => {
70
- const a = _, x = { ZSjeW: function(r, o, l) {
71
- return r(o, l);
72
- }, SdJQA: function(r, o) {
73
- return r === o;
74
- } }, s = e[a(197)];
75
- e[a(197)] = async (r) => {
76
- const o = a;
66
+ }, Q = (e) => {
67
+ const a = w, x = e[a(180)];
68
+ e.onmessage = async (t) => {
77
69
  if (e._client) {
78
- let l;
70
+ let n;
79
71
  try {
80
- l = await x[o(204)](J, e, r);
72
+ n = await J(e, t);
81
73
  } catch {
82
74
  }
83
- if (x[o(213)](l, void 0) && s) try {
84
- s[o(194)](e, r);
75
+ if (n === void 0 && x) try {
76
+ x.call(e, t);
85
77
  } catch {
86
78
  }
87
79
  }
88
80
  };
89
81
  };
90
- function v() {
91
- const e = ["tools/call", "unsubscribeResource", "HohQv", "2695725XEZTcm", "prompts/get", "15CDBgfz", "listResources", "2.0", "RFwiY", "WQgCS", "Xzrrt", "_client", "10ztjwvo", "send", "callTool", "tools/list", "emwBK", "Ahdht", "readResource", "call", "resources/unsubscribe", "13116598RDpWam", "onmessage", "completion/complete", "listPrompts", "complete", "resources/templates/list", "70658JIuKys", "setLoggingLevel", "ZSjeW", "gQXkS", "378336OAexTi", "listTools", "getPrompt", "34179buwJLm", "prompts/list", "cXnlb", "resources/subscribe", "SdJQA", "613434GgqIlU", "24KfGjls", "352PgssEG", "LHerf", "586968oouJmA"];
92
- return v = function() {
82
+ function y() {
83
+ const e = ["subscribeResource", "completion/complete", "BkyoX", "listResources", "setLoggingLevel", "2nfVMYE", "4658121OnjWIa", "getPrompt", "qfCYO", "call", "2.0", "listResourceTemplates", "readResource", "rqait", "ping", "resources/subscribe", "callTool", "JTRNp", "resources/templates/list", "qcPAX", "resources/list", "tIXdr", "41695Alwzct", "oAXlP", "57809DUJokX", "633801CObcPM", "resources/read", "90160Rfxluj", "GUEcj", "_onnotification", "116RQcWYD", "2003064CmpooN", "logging/setLevel", "tools/call", "10kZfGly", "onmessage", "send", "complete", "tools/list", "_client", "listPrompts", "2039010icNUrh", "XvPig", "resources/unsubscribe", "ngGcA", "prompts/get", "unsubscribeResource", "prompts/list", "listTools"];
84
+ return y = function() {
93
85
  return e;
94
- }, v();
86
+ }, y();
95
87
  }
96
88
  function w(e, a) {
97
- var x = y();
98
- return w = function(s, r) {
99
- s = s - (-43 * 217 + 7655 + -113 * -19);
100
- var o = x[s];
101
- return o;
89
+ const x = y();
90
+ return w = function(t, n) {
91
+ return t = t - 173, x[t];
102
92
  }, w(e, a);
103
93
  }
94
+ const C = (e, a) => {
95
+ const x = w, t = a[x(174)];
96
+ a[x(174)] = async (n) => {
97
+ const o = x, u = { ...n, jsonrpc: "2.0" };
98
+ try {
99
+ await e[o(181)](u);
100
+ } catch {
101
+ }
102
+ t[o(203)](a, n);
103
+ };
104
+ };
105
+ var D = S;
104
106
  (function(e, a) {
105
- for (var x = w, s = e(); ; )
107
+ for (var x = S, t = e(); ; )
106
108
  try {
107
- var r = parseInt(x(471)) / 1 + parseInt(x(481)) / 2 * (parseInt(x(475)) / 3) + parseInt(x(473)) / 4 * (-parseInt(x(472)) / 5) + -parseInt(x(482)) / 6 + parseInt(x(476)) / 7 + -parseInt(x(478)) / 8 + -parseInt(x(480)) / 9 * (-parseInt(x(477)) / 10);
108
- if (r === a) break;
109
- s.push(s.shift());
109
+ var n = -parseInt(x(134)) / 1 * (parseInt(x(135)) / 2) + parseInt(x(138)) / 3 * (-parseInt(x(140)) / 4) + parseInt(x(141)) / 5 + parseInt(x(144)) / 6 + -parseInt(x(136)) / 7 + -parseInt(x(139)) / 8 * (-parseInt(x(137)) / 9) + parseInt(x(142)) / 10 * (-parseInt(x(133)) / 11);
110
+ if (n === a) break;
111
+ t.push(t.shift());
110
112
  } catch {
111
- s.push(s.shift());
113
+ t.push(t.shift());
112
114
  }
113
- })(y, -300663 * 1 + -46 * 3722 + -4 * -157219);
114
- function y() {
115
- var e = ["736940YvXfNU", "_client", "351VaYOnl", "2054339FKDeBh", "10iDnLyM", "1006992tpTscA", "handleMessage", "96147EaQlKd", "3764PZZCEc", "360384sMoAEh", "2820IAqjWz", "5sHGHIA"];
116
- return y = function() {
115
+ })(v, -378 * -536 + -676713 + 871001);
116
+ function v() {
117
+ var e = ["90FhTYCt", "3231eKQXJK", "229048GrFSjN", "1604trGGin", "3444620cbfjjS", "85610yeTJXe", "RzZnC", "1533066kYdFaR", "handleMessage", "44lRVVtk", "3739hAyMUb", "92bQDuBo", "1370138KPPDpj"];
118
+ return v = function() {
117
119
  return e;
118
- }, y();
120
+ }, v();
119
121
  }
120
- class Y extends E {
121
- constructor(a, x, s) {
122
- var r = w;
123
- super(a, x), this[r(474)] = s;
122
+ function S(e, a) {
123
+ var x = v();
124
+ return S = function(t, n) {
125
+ t = t - (17 * 63 + 11 * 776 + -9474 * 1);
126
+ var o = x[t];
127
+ return o;
128
+ }, S(e, a);
129
+ }
130
+ class O extends G {
131
+ constructor(a, x, t) {
132
+ var n = { DvouG: function(o, u, d) {
133
+ return o(u, d);
134
+ } };
135
+ super(a, x), this._client = t, n.DvouG(C, this, t);
124
136
  }
125
- async handleMessage(a) {
126
- var x = w;
127
- V(this), await super[x(479)](a);
137
+ async [D(145)](a) {
138
+ var x = D, t = { RzZnC: function(n, o) {
139
+ return n(o);
140
+ } };
141
+ t[x(143)](Q, this), await super[x(145)](a);
128
142
  }
129
143
  }
130
- var H = g;
131
- function g(e, a) {
132
- var x = S();
133
- return g = function(s, r) {
134
- s = s - (175 * 44 + 5283 + -12719);
135
- var o = x[s];
136
- return o;
137
- }, g(e, a);
138
- }
139
144
  (function(e, a) {
140
- for (var x = g, s = e(); ; )
145
+ for (var x = q, t = e(); ; )
141
146
  try {
142
- var r = -parseInt(x(269)) / 1 * (parseInt(x(275)) / 2) + -parseInt(x(278)) / 3 * (parseInt(x(264)) / 4) + -parseInt(x(272)) / 5 * (-parseInt(x(277)) / 6) + parseInt(x(276)) / 7 * (-parseInt(x(265)) / 8) + -parseInt(x(274)) / 9 * (-parseInt(x(267)) / 10) + parseInt(x(270)) / 11 * (parseInt(x(271)) / 12) + parseInt(x(268)) / 13;
143
- if (r === a) break;
144
- s.push(s.shift());
147
+ var n = parseInt(x(375)) / 1 * (parseInt(x(383)) / 2) + parseInt(x(385)) / 3 * (-parseInt(x(378)) / 4) + -parseInt(x(379)) / 5 * (parseInt(x(382)) / 6) + parseInt(x(376)) / 7 + parseInt(x(381)) / 8 * (-parseInt(x(377)) / 9) + -parseInt(x(387)) / 10 + parseInt(x(386)) / 11;
148
+ if (n === a) break;
149
+ t.push(t.shift());
145
150
  } catch {
146
- s.push(s.shift());
151
+ t.push(t.shift());
147
152
  }
148
- })(S, 338708 + 8830 * 52 + -113446);
149
- class j extends C {
153
+ })(R, 255 * 6691 + 302586 + 471 * -2313);
154
+ function q(e, a) {
155
+ var x = R();
156
+ return q = function(t, n) {
157
+ t = t - (7233 * 1 + 3357 + -10215);
158
+ var o = x[t];
159
+ return o;
160
+ }, q(e, a);
161
+ }
162
+ function R() {
163
+ var e = ["1168432WQtPui", "50376LSHMKd", "372882eQbwfo", "_client", "2091171WQOSbY", "48860207OppNYK", "9383580LLBEbR", "5sAqcJs", "4396000ZZnvEP", "81qsJpNj", "8evXmgq", "855QEgaxF", "MJZHU"];
164
+ return R = function() {
165
+ return e;
166
+ }, R();
167
+ }
168
+ class A extends W {
150
169
  constructor(a, x) {
151
- var s = g;
152
- super(a), this[s(279)] = x;
153
- }
154
- async [H(266)](a, x, s) {
155
- var r = H, o = { iVowj: function(l, u) {
156
- return l(u);
170
+ var t = q, n = { MJZHU: function(o, u, d) {
171
+ return o(u, d);
157
172
  } };
158
- o[r(273)](V, this), await super[r(266)](a, x, s);
173
+ super(a), this[t(384)] = x, n[t(380)](C, this, x);
174
+ }
175
+ async handlePostRequest(a, x, t) {
176
+ Q(this), await super.handlePostRequest(a, x, t);
159
177
  }
160
178
  }
161
- function S() {
162
- var e = ["_client", "6428lqivWx", "29288CzqRmW", "handlePostRequest", "690RHSMrO", "26362180eTNHMT", "2hDVhMr", "9099937trIaXV", "12VhPJUq", "95tarehR", "iVowj", "71433IELkru", "1122424QxeVeD", "2513qtRRon", "48588ccGIEj", "813iFSbuL"];
163
- return S = function() {
179
+ const m = _;
180
+ function T() {
181
+ const e = ["FWaXz", "handlePostMessage", "handleRequest", "status", "dSXgW", "writeHead", "method", "OjQoD", "36ygWaEl", "JsYDt", "No client found", "iDFWf", "Method not allowed.", "mcp-session-id", "initialize", "connect", "query", "sign", "lUOag", "HS256", "mcp-proxy-client", "GET", "18gymWJJ", "158590GyUVUH", "7175289mlwQaq", "uVdyU", "client", "close", "json", "fjDmA", "JDcfR", "EfZyg", "191470yqzChw", "57999ReStrj", "5348CQCobi", "authorization", "end", "params", "mkiiB", "headers", "viTgi", "referer", "FTBGR", "set", "stringify", "1422BFcOKr", "message", "CdwrN", "rWUbT", "send", "split", "qQSXc", "notifications/initialized", "Invalid or missing session ID", "QotXH", "mcp-server", "sessionId", "GET, POST, DELETE", "verify", "mcp-proxy-server", "4OFWswx", "protocolVersion", "SSE", "30 days", "vzZGC", "2.0", "body", "RjRNP", "maIjq", "817660MLaHsq", "_requestHandlers", "1.0.0", "user", "accept-language", "4279712orSPgF", "POST", "capabilities"];
182
+ return T = function() {
164
183
  return e;
165
- }, S();
184
+ }, T();
166
185
  }
167
- const h = m;
168
186
  (function(e, a) {
169
- const x = m, s = e();
187
+ const x = _, t = e();
170
188
  for (; ; )
171
189
  try {
172
- if (parseInt(x(459)) / 1 * (parseInt(x(458)) / 2) + parseInt(x(445)) / 3 + -parseInt(x(431)) / 4 * (parseInt(x(429)) / 5) + parseInt(x(472)) / 6 + -parseInt(x(440)) / 7 * (parseInt(x(434)) / 8) + parseInt(x(442)) / 9 + -parseInt(x(411)) / 10 * (parseInt(x(420)) / 11) === a) break;
173
- s.push(s.shift());
190
+ if (parseInt(x(303)) / 1 + -parseInt(x(302)) / 2 * (parseInt(x(313)) / 3) + -parseInt(x(340)) / 4 * (-parseInt(x(312)) / 5) + parseInt(x(325)) / 6 * (parseInt(x(314)) / 7) + parseInt(x(277)) / 8 + parseInt(x(288)) / 9 * (parseInt(x(349)) / 10) + -parseInt(x(304)) / 11 === a) break;
191
+ t.push(t.shift());
174
192
  } catch {
175
- s.push(s.shift());
193
+ t.push(t.shift());
176
194
  }
177
- })(T, 428917);
178
- function T() {
179
- const e = ["742479MVxrxP", "GET", "query", "Missing bearer token", "set", "sessionId", "initialize", "RCaLJ", "JrMYw", "HS256", "end", "client", "OVFyq", "38rqoYCF", "28631UjGtnn", "zJmYG", "LUYAp", "body", "accept-language", "GET, POST, DELETE", "uGodP", "1.0.0", "StreamableHTTP", "close", "mcp-session-id", "wqTCu", "DELETE", "2229096JGmqCd", "Method not allowed.", "user", "verify", "notifications/initialized", "connect", "Invalid bearer token", "POST", "stringify", "No transport found", "writeHead", "1041010qkMaha", "zylKo", "mcp-proxy-client", "PaIlR", "handleRequest", "capabilities", "method", "ocgfq", "x-forwarded-for", "88BGFsTF", "WlTKY", "SSE", "protocolVersion", "OtdPb", "mcp-proxy-server", "_requestHandlers", "xoTOd", "json", "10HeuyKH", "uMAyY", "791068KxqRiz", "DLIhP", "No client found", "196712oeSOuj", "headers", "VmBCX", "params", "authorization", "Bad Request: No valid session ID provided", "28pbCSNl", "status", "5333553Iaseks", "cemcS", "send"];
180
- return T = function() {
181
- return e;
182
- }, T();
183
- }
184
- function m(e, a) {
195
+ })(T, -2 * 82855 + -683979 + 1 * 1263373);
196
+ function _(e, a) {
185
197
  const x = T();
186
- return m = function(s, r) {
187
- return s = s - (-9661 * 1 + 857 + 9214), x[s];
188
- }, m(e, a);
198
+ return _ = function(t, n) {
199
+ return t = t - (-3569 + -2427 * -4 + -13 * 451), x[t];
200
+ }, _(e, a);
189
201
  }
190
- const N = ({ secret: e }) => (a, x, s) => {
191
- var u;
192
- const r = m, o = { LUYAp: r(478) }, l = (u = a[r(435)][r(438)]) == null ? void 0 : u.split(" ")[1];
193
- if (!l) {
194
- x[r(441)](5745 + -167 * 32).send(r(448));
202
+ const V = ({ secret: e }) => (a, x, t) => {
203
+ var d;
204
+ const n = _, o = { QotXH: "Missing bearer token", FWaXz: function(g) {
205
+ return g();
206
+ }, CdwrN: "Invalid bearer token" }, u = (d = a.headers[n(315)]) == null ? void 0 : d[n(330)](" ")[5849 + -3 * -1457 + -10219];
207
+ if (!u) {
208
+ x[n(283)](-2326 * -1 + -4237 + 2312 * 1)[n(329)](o[n(334)]);
195
209
  return;
196
210
  }
197
211
  try {
198
- a[r(474)] = R[r(475)](l, e), s();
199
- } catch (q) {
200
- x.status(-4735 * -1 + 5095 + 857 * -11)[r(428)]({ error: o[r(461)], details: q.message });
212
+ a[n(352)] = k[n(338)](u, e), o[n(280)](t);
213
+ } catch (g) {
214
+ x[n(283)](-6633 + 1 * -1541 + 8577)[n(308)]({ error: o[n(327)], details: g[n(326)] });
201
215
  }
202
- }, U = (e, a, x = { expiresIn: "30 days", algorithm: h(454) }) => R.sign(e, a, x), Z = (e, a) => R[h(475)](e, a), M = (e) => ({ ip: e.headers[h(419)] || e.ip || "", userAgent: e[h(435)]["user-agent"] || "", acceptLanguage: e[h(435)][h(463)] || "", referer: e[h(435)].referer || "" }), $ = () => {
203
- const e = h, a = { DLIhP: e(468), ocgfq: e(413), OtdPb: e(466), RCaLJ: function(n, c) {
204
- return n(c);
205
- }, uGodP: e(422), VmBCX: e(433), zylKo: e(425), cemcS: function(n, c) {
206
- return n === c;
207
- }, pFHDd: e(479), OVFyq: function(n, c, t) {
208
- return n(c, t);
209
- }, zJmYG: e(471), PaIlR: e(464), WlTKY: "2.0", JrMYw: e(473), wqTCu: "Invalid or missing session ID", kiVuv: "stream-session-id", BLfLq: e(451), xoTOd: function(n, c) {
210
- return n(c);
211
- }, uMAyY: e(467) }, x = {}, s = {}, r = async (n, c, t) => {
212
- const i = e, d = new E(t, c), b = d.sessionId;
213
- x[b] = d, n.on(a.DLIhP, () => {
214
- d[m(468)](), delete x[b], delete s[b];
216
+ }, $ = (e, a, x = { expiresIn: m(343), algorithm: m(299) }) => k[m(297)](e, a, x), x0 = (e, a) => k[m(338)](e, a), E = (e) => ({ ip: e[m(319)]["x-forwarded-for"] || e.ip || "", userAgent: e[m(319)]["user-agent"] || "", acceptLanguage: e[m(319)][m(276)] || "", referer: e.headers[m(321)] || "" }), e0 = () => {
217
+ const e = m, a = { FTBGR: e(307), dSXgW: "1.0.0", maIjq: function(r, c) {
218
+ return r(c);
219
+ }, lUOag: e(342), OjQoD: e(339), mkiiB: function(r, c) {
220
+ return r === c;
221
+ }, JsYDt: function(r, c, s) {
222
+ return r(c, s);
223
+ }, viTgi: function(r, c) {
224
+ return r === c;
225
+ }, ZQlCd: e(301), rWUbT: function(r, c) {
226
+ return r === c;
227
+ }, fjDmA: "DELETE", vzZGC: function(r, c, s) {
228
+ return r(c, s);
229
+ }, qQSXc: e(337), iDFWf: e(345), uVdyU: e(292), EfZyg: e(333), RjRNP: e(294), JDcfR: "StreamableHTTP", KExYb: "Bad Request: No valid session ID provided", ggxLD: e(290) }, x = {}, t = {}, n = async (r, c, s) => {
230
+ const i = e, f = new G(s, c), l = f[i(336)];
231
+ x[l] = f, r.on(a[i(322)], () => {
232
+ f[i(307)](), delete x[l], delete t[l];
215
233
  });
216
- const f = { prompts: {}, resources: {}, tools: {}, logging: {} }, p = new G({ name: a[i(418)], version: a.OtdPb }, { capabilities: f });
217
- s[b] = { client: p, user: n.user, device: a[i(452)](M, n), type: a[i(465)] }, await p[i(477)](d);
218
- }, o = async (n, c, t) => {
219
- var L;
220
- const i = e, d = n.query[i(450)], b = (L = s[d]) == null ? void 0 : L[i(456)];
221
- if (!b) {
222
- c[i(441)](-106 * 43 + 9187 + -4229).send(a.VmBCX);
234
+ const p = { prompts: {}, resources: {}, tools: {}, logging: {} }, b = new j({ name: i(300), version: a[i(284)] }, { capabilities: p });
235
+ t[l] = { client: b, user: r.user, device: a.maIjq(E, r), type: a[i(298)] }, await b[i(295)](f);
236
+ }, o = async (r, c, s) => {
237
+ var X;
238
+ const i = e, f = r[i(296)][i(336)], l = (X = t[f]) == null ? void 0 : X.client;
239
+ if (!l) {
240
+ c[i(283)](8691 + 8291 * -1)[i(329)]("No client found");
223
241
  return;
224
242
  }
225
- const f = new Y(t, c, b), p = f.sessionId;
226
- x[p] = f, n.on(a[i(432)], () => {
227
- f.close(), delete x[p];
243
+ const p = new O(s, c, l), b = p[i(336)];
244
+ x[b] = p, r.on(i(307), () => {
245
+ p[i(307)](), delete x[b];
228
246
  });
229
- const I = { prompts: {}, resources: {}, tools: {}, logging: {} };
230
- await new P({ name: a[i(412)], version: a[i(424)] }, { capabilities: I })[i(477)](f);
231
- }, l = async (n, c) => {
232
- const t = e, i = n.query[t(450)], d = x[i];
233
- d ? await d.handlePostMessage(n, c) : c.status(2771 + 694 * -2 + 1 * -983).send(t(481));
234
- }, u = async (n, c) => {
235
- const t = e;
236
- a[t(443)](n[t(417)], a.pFHDd) ? await a[t(457)](A, n, c) : a[t(443)](n.method, t(446)) || a.cemcS(n[t(417)], a[t(460)]) ? await a[t(457)](z, n, c) : await a[t(452)](q, c);
237
- }, q = async (n) => {
247
+ const h = { prompts: {}, resources: {}, tools: {}, logging: {} };
248
+ await new P({ name: a[i(287)], version: i(351) }, { capabilities: h })[i(295)](p);
249
+ }, u = async (r, c) => {
250
+ const s = e, i = r[s(296)][s(336)], f = x[i];
251
+ f ? await f[s(281)](r, c) : c.status(-1345 + 349 * 5)[s(329)]("No transport found");
252
+ }, d = async (r, c) => {
253
+ const s = e;
254
+ a[s(318)](r[s(286)], s(278)) ? await a[s(289)](N, r, c) : a[s(320)](r.method, a.ZQlCd) || a[s(328)](r[s(286)], a[s(309)]) ? await a[s(344)](I, r, c) : await a[s(348)](g, c);
255
+ }, g = async (r) => {
238
256
  const c = e;
239
- n[c(410)](-80 + -7 * 593 + 4636, { Allow: a[c(414)] })[c(455)](JSON[c(480)]({ jsonrpc: a[c(421)], error: { code: -32e3, message: a[c(453)] }, id: null }));
240
- }, z = async (n, c) => {
241
- const t = e, i = n[t(435)][t(469)], d = x[i];
242
- d ? (await d[t(415)](n, c), n[t(417)] === a.zJmYG && (delete x[i], delete s[i])) : c[t(441)](-25 * -155 + 97 * 49 + 121 * -68)[t(444)](a[t(470)]);
243
- }, A = async (n, c) => {
244
- const t = e, i = n.headers[t(469)], d = n[t(435)][a.kiVuv];
245
- let b = x[i];
246
- if (b) await b[t(415)](n, c, n[t(462)]);
247
- else if (!i && a.RCaLJ(D, n[t(462)])) {
248
- b = new C({ sessionIdGenerator: () => d });
249
- const f = { prompts: {}, resources: {}, tools: {}, logging: {} }, p = new G({ name: a[t(418)], version: a[t(424)] }, { capabilities: f });
250
- p._notificationHandlers.set(t(476), () => {
251
- }), p[t(426)][t(449)](a.BLfLq, (I) => ({ protocolVersion: I[t(437)][t(423)], capabilities: I[t(437)][t(416)], serverInfo: { name: "mcp-server", version: t(466) } })), s[d] = { client: p, user: n[t(474)], device: a[t(427)](M, n), type: a[t(430)] }, x[d] = b, b.sessionId = d, await p[t(477)](b), await b.handleRequest(n, c, n[t(462)]);
252
- } else c.status(1604 * 4 + 8837 + 1 * -14853)[t(428)]({ jsonrpc: a[t(421)], error: { code: -32e3, message: t(439) }, id: null });
257
+ r[c(285)](484 + -21 * -7 + -226, { Allow: a[c(331)] })[c(316)](JSON[c(324)]({ jsonrpc: a[c(291)], error: { code: -32e3, message: a[c(305)] }, id: null }));
258
+ }, I = async (r, c) => {
259
+ const s = e, i = r[s(319)][s(293)], f = x[i];
260
+ f ? (await f.handleRequest(r, c), a[s(320)](r.method, a[s(309)]) && (delete x[i], delete t[i])) : c[s(283)](-10233 + 1 * 10633)[s(329)](a[s(311)]);
261
+ }, N = async (r, c) => {
262
+ const s = e, i = r[s(319)][s(293)], f = r.headers["stream-session-id"];
263
+ let l = x[i];
264
+ if (l) await l[s(282)](r, c, r.body);
265
+ else if (!i && a.maIjq(H, r.body)) {
266
+ l = new W({ sessionIdGenerator: () => f });
267
+ const p = { prompts: {}, resources: {}, tools: {}, logging: {} }, b = new j({ name: "mcp-proxy-client", version: a.dSXgW }, { capabilities: p });
268
+ b._notificationHandlers[s(323)](s(332), () => {
269
+ }), b[s(350)][s(323)](a[s(347)], (h) => ({ protocolVersion: h.params[s(341)], capabilities: h[s(317)][s(279)], serverInfo: { name: s(335), version: s(351) } })), t[f] = { client: b, user: r.user, device: E(r), type: a[s(310)] }, x[f] = l, l[s(336)] = f, await b[s(295)](l), await l[s(282)](r, c, r[s(346)]);
270
+ } else c[s(283)](400)[s(308)]({ jsonrpc: a[s(291)], error: { code: -32e3, message: a.KExYb }, id: null });
253
271
  };
254
- return { handleSseProxy: r, handleSseInspector: o, handleSseMessage: l, handleStreamRequest: u, handleStreamInspector: async (n, c) => {
255
- var I;
256
- const t = e, i = n[t(447)].sessionId, d = (I = s[i]) == null ? void 0 : I[t(456)];
257
- if (!d) {
258
- c[t(441)](-8 * -500 + -4 * -599 + -5996)[t(444)](a[t(436)]);
272
+ return { handleSseProxy: n, handleSseInspector: o, handleSseMessage: u, handleStreamRequest: d, handleStreamInspector: async (r, c) => {
273
+ var h;
274
+ const s = e, i = r.query[s(336)], f = (h = t[i]) == null ? void 0 : h[s(306)];
275
+ if (!f) {
276
+ c[s(283)](5797 + 111 * 41 + -6 * 1658).send(a.ggxLD);
259
277
  return;
260
278
  }
261
- const b = new j({ sessionIdGenerator: void 0 }, d), f = { prompts: {}, resources: {}, tools: {}, logging: {} }, p = new P({ name: "mcp-proxy-server", version: a[t(424)] }, { capabilities: f });
262
- await p[t(477)](b), await b[t(415)](n, c, n[t(462)]), c.on(t(468), () => {
263
- const k = t;
264
- b[k(468)](), p[k(468)]();
279
+ const l = new A({ sessionIdGenerator: void 0 }, f), p = { prompts: {}, resources: {}, tools: {}, logging: {} }, b = new P({ name: a.OjQoD, version: a.dSXgW }, { capabilities: p });
280
+ await b[s(295)](l), await l[s(282)](r, c, r[s(346)]), c.on(a[s(322)], () => {
281
+ l[s(307)](), b.close();
265
282
  });
266
- }, clients: s };
283
+ }, clients: t };
267
284
  };
268
285
  export {
269
- N as auth,
270
- U as signToken,
271
- $ as useProxyHandles,
272
- Z as verifyToken
286
+ V as auth,
287
+ $ as signToken,
288
+ e0 as useProxyHandles,
289
+ x0 as verifyToken
273
290
  };