@opentiny/next 0.1.2 → 0.1.3

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 +279 -270
  2. package/package.json +2 -2
  3. package/server.js +219 -213
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opentiny/next",
3
- "version": "0.1.2",
3
+ "version": "0.1.3",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "author": "Chunhui Mo",
@@ -15,7 +15,7 @@
15
15
  "types": "client.d.ts",
16
16
  "description": "OpenTiny NEXT",
17
17
  "dependencies": {
18
- "@modelcontextprotocol/sdk": "^1.12.0",
18
+ "@modelcontextprotocol/sdk": "^1.12.1",
19
19
  "jsonwebtoken": "^9.0.2",
20
20
  "zod": "^3.25.30"
21
21
  },
package/server.js CHANGED
@@ -1,290 +1,296 @@
1
- import k from "jsonwebtoken";
2
- import { McpServer as P } from "@modelcontextprotocol/sdk/server/mcp.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
- (function(e, a) {
8
- const x = w, t = e();
1
+ import P from "jsonwebtoken";
2
+ import { McpServer as X } from "@modelcontextprotocol/sdk/server/mcp.js";
3
+ import { Client as q } from "@modelcontextprotocol/sdk/client/index.js";
4
+ import { SSEServerTransport as Y } from "@modelcontextprotocol/sdk/server/sse.js";
5
+ import { StreamableHTTPServerTransport as L } from "@modelcontextprotocol/sdk/server/streamableHttp.js";
6
+ import { isInitializeRequest as M } from "@modelcontextprotocol/sdk/types.js";
7
+ (function(x, a) {
8
+ const e = I, t = x();
9
9
  for (; ; )
10
10
  try {
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;
11
+ if (parseInt(e(388)) / 1 * (-parseInt(e(385)) / 2) + parseInt(e(404)) / 3 * (-parseInt(e(430)) / 4) + parseInt(e(408)) / 5 * (parseInt(e(407)) / 6) + parseInt(e(431)) / 7 + -parseInt(e(399)) / 8 + parseInt(e(413)) / 9 * (parseInt(e(382)) / 10) + parseInt(e(383)) / 11 === a) break;
12
12
  t.push(t.shift());
13
13
  } catch {
14
14
  t.push(t.shift());
15
15
  }
16
- })(y, -881597 * -1 + 119772 + 1 * -550231);
17
- const J = async (e, a) => {
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" };
16
+ })(T, -726410 + -1 * 25043 + 425 * 3682);
17
+ const N = async (x, a) => {
18
+ const e = I, t = { TnhIw: e(394), moPGf: e(390), XbmUh: e(393), KPRsg: e(414), GJxmW: "resources/unsubscribe", wfyad: e(434), rfETa: e(402), UywLp: "ping", uUGDe: e(389), nIxym: e(438), waFld: function(p, _) {
19
+ return p !== _;
20
+ }, soPbC: e(427), RlRUS: e(391), uZqWS: function(p, _) {
21
+ return p !== _;
22
+ }, jbGYj: e(415) };
23
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);
24
+ const { id: o, method: f, params: c } = a;
25
+ if (f) {
26
+ switch (f) {
27
+ case t[e(403)]:
28
+ n = await x[e(428)][e(411)](c);
29
29
  break;
30
- case t[x(217)]:
31
- n = await e[x(184)][x(210)](d);
30
+ case e(436):
31
+ n = await x[e(428)].callTool(c);
32
32
  break;
33
- case t.WtABw:
34
- n = await e[x(184)][x(197)](d);
33
+ case t.moPGf:
34
+ n = await x[e(428)].listResources(c);
35
35
  break;
36
- case t.whlca:
37
- n = await e[x(184)][x(205)](d);
36
+ case t[e(422)]:
37
+ n = await x[e(428)].listResourceTemplates(c);
38
38
  break;
39
- case t[x(215)]:
40
- n = await e[x(184)][x(206)](d);
39
+ case t.KPRsg:
40
+ n = await x[e(428)][e(420)](c);
41
41
  break;
42
- case t[x(213)]:
43
- n = await e._client[x(194)](d);
42
+ case e(425):
43
+ n = await x._client[e(412)](c);
44
44
  break;
45
- case t[x(187)]:
46
- n = await e[x(184)][x(191)](d);
45
+ case t[e(424)]:
46
+ n = await x[e(428)][e(426)](c);
47
47
  break;
48
- case t[x(211)]:
49
- n = await e._client[x(201)](d);
48
+ case t[e(405)]:
49
+ n = await x[e(428)][e(387)](c);
50
50
  break;
51
- case x(192):
52
- n = await e._client[x(185)](d);
51
+ case t[e(410)]:
52
+ n = await x[e(428)][e(433)](c);
53
53
  break;
54
- case t[x(202)]:
55
- n = await e[x(184)].ping();
54
+ case t[e(396)]:
55
+ n = await x[e(428)][e(386)]();
56
56
  break;
57
- case x(195):
58
- n = await e._client[x(182)](d);
57
+ case t[e(400)]:
58
+ n = await x._client[e(432)](c);
59
59
  break;
60
- case t.sYWLX:
61
- n = await e[x(184)][x(198)](d);
60
+ case t[e(409)]:
61
+ n = await x._client[e(392)](c);
62
62
  break;
63
63
  }
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;
64
+ return n ? await x[e(395)]({ result: n, jsonrpc: e(419), id: o }) : t[e(401)](f, t[e(397)]) && f !== t[e(384)] && (t[e(417)](f, t[e(429)]) || c[e(435)]) && await x[e(428)].notification({ method: f, params: c }), n;
65
65
  }
66
- }, Q = (e) => {
67
- const a = w, x = e[a(180)];
68
- e.onmessage = async (t) => {
69
- if (e._client) {
70
- let n;
71
- try {
72
- n = await J(e, t);
73
- } catch {
74
- }
75
- if (n === void 0 && x) try {
76
- x.call(e, t);
77
- } catch {
66
+ }, C = (x) => {
67
+ const a = I, e = { JMiUK: function(n, o, f) {
68
+ return n(o, f);
69
+ }, STdeX: function(n, o) {
70
+ return n === o;
71
+ } }, t = x[a(406)];
72
+ if (!t[a(423)]) {
73
+ async function n(o, f) {
74
+ const c = a;
75
+ if (x[c(428)]) {
76
+ let p;
77
+ try {
78
+ p = await e[c(418)](N, x, o);
79
+ } catch {
80
+ }
81
+ if (e[c(421)](p, void 0) && t) try {
82
+ t[c(416)](x, o, f);
83
+ } catch {
84
+ }
78
85
  }
79
86
  }
80
- };
81
- };
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() {
85
- return e;
86
- }, y();
87
- }
88
- function w(e, a) {
89
- const x = y();
90
- return w = function(t, n) {
91
- return t = t - 173, x[t];
92
- }, w(e, a);
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" };
87
+ n[a(423)] = !0, x[a(406)] = n;
88
+ }
89
+ }, D = (x, a) => {
90
+ const e = I, t = { Zlzvk: e(419) }, n = a[e(437)];
91
+ a._onnotification = async (o) => {
92
+ const f = e, c = { ...o, jsonrpc: t[f(398)] };
98
93
  try {
99
- await e[o(181)](u);
94
+ await x.send(c);
100
95
  } catch {
101
96
  }
102
- t[o(203)](a, n);
97
+ n[f(416)](a, o);
103
98
  };
104
99
  };
105
- var D = S;
106
- (function(e, a) {
107
- for (var x = S, t = e(); ; )
100
+ function I(x, a) {
101
+ const e = T();
102
+ return I = function(t, n) {
103
+ return t = t - (-1 * 3767 + -4455 + 8604), e[t];
104
+ }, I(x, a);
105
+ }
106
+ function T() {
107
+ const x = ["41182WYeFLf", "ping", "getPrompt", "59sigiWG", "completion/complete", "resources/list", "notifications/initialized", "setLoggingLevel", "resources/templates/list", "tools/list", "send", "UywLp", "soPbC", "Zlzvk", "1059600HVHeXp", "uUGDe", "waFld", "prompts/list", "TnhIw", "991989cLrPht", "wfyad", "onmessage", "6Ryujhr", "4886195apmvJG", "nIxym", "rfETa", "listTools", "subscribeResource", "194634wdcrKB", "resources/read", "notifications/cancelled", "call", "uZqWS", "JMiUK", "2.0", "readResource", "STdeX", "XbmUh", "isSet", "GJxmW", "resources/subscribe", "unsubscribeResource", "initialize", "_client", "jbGYj", "12gruGVr", "6704775hDHsrs", "complete", "listPrompts", "prompts/get", "forward", "tools/call", "_onnotification", "logging/setLevel", "10CQbwjM", "13156165HLnHxw", "RlRUS"];
108
+ return T = function() {
109
+ return x;
110
+ }, T();
111
+ }
112
+ var U = g;
113
+ (function(x, a) {
114
+ for (var e = g, t = x(); ; )
108
115
  try {
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);
116
+ var n = -parseInt(e(411)) / 1 + -parseInt(e(408)) / 2 + -parseInt(e(414)) / 3 + -parseInt(e(416)) / 4 + -parseInt(e(417)) / 5 + -parseInt(e(412)) / 6 * (-parseInt(e(410)) / 7) + parseInt(e(413)) / 8;
110
117
  if (n === a) break;
111
118
  t.push(t.shift());
112
119
  } catch {
113
120
  t.push(t.shift());
114
121
  }
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() {
119
- return e;
120
- }, v();
121
- }
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];
122
+ })(S, -25039 + 1 * -1065719 + 1691732);
123
+ function g(x, a) {
124
+ var e = S();
125
+ return g = function(t, n) {
126
+ t = t - (-227 * -19 + -5222 * 1 + -1 * -1317);
127
+ var o = e[t];
127
128
  return o;
128
- }, S(e, a);
129
+ }, g(x, a);
129
130
  }
130
- class O extends G {
131
- constructor(a, x, t) {
132
- var n = { DvouG: function(o, u, d) {
133
- return o(u, d);
131
+ class W extends Y {
132
+ constructor(a, e, t) {
133
+ var n = g, o = { rqdbH: function(f, c, p) {
134
+ return f(c, p);
134
135
  } };
135
- super(a, x), this._client = t, n.DvouG(C, this, t);
136
+ super(a, e), this[n(418)] = t, o[n(409)](D, this, t);
136
137
  }
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);
138
+ async [U(415)](a) {
139
+ C(this), await super.handleMessage(a);
142
140
  }
143
141
  }
144
- (function(e, a) {
145
- for (var x = q, t = e(); ; )
142
+ function S() {
143
+ var x = ["5569145VHAoIi", "_client", "1858412TeEtwX", "rqdbH", "7BPxJge", "743572hMFZpQ", "1062750pVXkrf", "37464200zpVnfx", "1194657zQFklV", "handleMessage", "4297400QxbqFq"];
144
+ return S = function() {
145
+ return x;
146
+ }, S();
147
+ }
148
+ var z = v;
149
+ (function(x, a) {
150
+ for (var e = v, t = x(); ; )
146
151
  try {
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;
152
+ var n = -parseInt(e(233)) / 1 * (parseInt(e(222)) / 2) + parseInt(e(227)) / 3 + parseInt(e(221)) / 4 + -parseInt(e(220)) / 5 * (-parseInt(e(223)) / 6) + -parseInt(e(228)) / 7 * (-parseInt(e(231)) / 8) + parseInt(e(230)) / 9 + parseInt(e(225)) / 10 * (-parseInt(e(232)) / 11);
148
153
  if (n === a) break;
149
154
  t.push(t.shift());
150
155
  } catch {
151
156
  t.push(t.shift());
152
157
  }
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];
158
+ })(k, 536314);
159
+ function v(x, a) {
160
+ var e = k();
161
+ return v = function(t, n) {
162
+ t = t - (-3 * 2827 + -3409 + -1 * -12109);
163
+ var o = e[t];
159
164
  return o;
160
- }, q(e, a);
165
+ }, v(x, a);
161
166
  }
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 {
169
- constructor(a, x) {
170
- var t = q, n = { MJZHU: function(o, u, d) {
171
- return o(u, d);
167
+ class A extends L {
168
+ constructor(a, e) {
169
+ var t = v, n = { cIlGY: function(o, f, c) {
170
+ return o(f, c);
172
171
  } };
173
- super(a), this[t(384)] = x, n[t(380)](C, this, x);
172
+ super(a), this[t(226)] = e, n[t(219)](D, this, e);
174
173
  }
175
- async handlePostRequest(a, x, t) {
176
- Q(this), await super.handlePostRequest(a, x, t);
174
+ async [z(229)](a, e, t) {
175
+ var n = z, o = { zWscN: function(f, c) {
176
+ return f(c);
177
+ } };
178
+ o[n(224)](C, this), await super[n(229)](a, e, t);
177
179
  }
178
180
  }
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() {
183
- return e;
184
- }, T();
181
+ function k() {
182
+ var x = ["226855XHUddw", "1444112aVlGFe", "66370eeqEfo", "18TJbykv", "zWscN", "10990NPXHzV", "_client", "2764215blBRpe", "21WsEMin", "handlePostRequest", "1242594VAYLDC", "192096ADjYdR", "5951HOcywA", "15XTYlKF", "cIlGY"];
183
+ return k = function() {
184
+ return x;
185
+ }, k();
185
186
  }
186
- (function(e, a) {
187
- const x = _, t = e();
187
+ const w = y;
188
+ (function(x, a) {
189
+ const e = y, t = x();
188
190
  for (; ; )
189
191
  try {
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;
192
+ if (parseInt(e(249)) / 1 * (parseInt(e(265)) / 2) + -parseInt(e(273)) / 3 + parseInt(e(272)) / 4 + parseInt(e(271)) / 5 + parseInt(e(215)) / 6 + -parseInt(e(275)) / 7 + parseInt(e(243)) / 8 === a) break;
191
193
  t.push(t.shift());
192
194
  } catch {
193
195
  t.push(t.shift());
194
196
  }
195
- })(T, -2 * 82855 + -683979 + 1 * 1263373);
196
- function _(e, a) {
197
- const x = T();
198
- return _ = function(t, n) {
199
- return t = t - (-3569 + -2427 * -4 + -13 * 451), x[t];
200
- }, _(e, a);
197
+ })(R, -100884 + -9886 * 107 + 2030136);
198
+ function y(x, a) {
199
+ const e = R();
200
+ return y = function(t, n) {
201
+ return t = t - (2752 + 5 * -509), e[t];
202
+ }, y(x, a);
201
203
  }
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)]);
204
+ const $ = ({ secret: x }) => (a, e, t) => {
205
+ var c;
206
+ const n = y, o = { xPlAh: function(p) {
207
+ return p();
208
+ }, TvKzq: "Invalid bearer token" }, f = (c = a[n(222)][n(248)]) == null ? void 0 : c[n(262)](" ")[2825 + 1 * 1153 + -3977];
209
+ if (!f) {
210
+ e[n(221)](-1 * 9752 + 9 * -1107 + 20116)[n(241)]("Missing bearer token");
209
211
  return;
210
212
  }
211
213
  try {
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)] });
214
+ a[n(226)] = P[n(267)](f, x), o.xPlAh(t);
215
+ } catch (p) {
216
+ e[n(221)](161 * 1 + 6747 + -6505)[n(274)]({ error: o[n(245)], details: p[n(264)] });
215
217
  }
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];
218
+ }, e0 = (x, a, e = { expiresIn: w(219), algorithm: w(279) }) => P.sign(x, a, e);
219
+ function R() {
220
+ const x = ["query", "POST", "user", "KIEat", "DzVhR", "tQsWb", "qHpth", "handlePostMessage", "2.0", "body", "DReNP", "capabilities", "TBnyX", "ctfTY", "mcp-proxy-client", "handleRequest", "1.0.0", "send", "ilKCv", "919912XABRIk", "protocolVersion", "TvKzq", "mcp-server", "client", "authorization", "1zvLXvL", "Bad Request: No valid session ID provided", "connect", "GET, POST, DELETE", "params", "sessionId", "Invalid or missing session ID", "stringify", "stream-session-id", "x-forwarded-for", "pYbxB", "EHAFz", "ElXUu", "split", "method", "message", "971462IilYfF", "initialize", "verify", "_notificationHandlers", "kXhyh", "notifications/initialized", "296080cjeiSN", "36352LAXIFT", "386772mTXCwU", "json", "9524480zGcZVm", "set", "Method not allowed.", "mcp-proxy-server", "HS256", "SSE", "mcp-session-id", "XHyZX", "close", "No transport found", "wquxN", "GET", "WfiHS", "KeFvo", "10151940hXEsSk", "accept-language", "YPyEm", "No client found", "30 days", "_requestHandlers", "status", "headers", "end"];
221
+ return R = function() {
222
+ return x;
223
+ }, R();
224
+ }
225
+ const x0 = (x, a) => P[w(267)](x, a), G = (x) => ({ ip: x[w(222)][w(258)] || x.ip || "", userAgent: x.headers["user-agent"] || "", acceptLanguage: x.headers[w(216)] || "", referer: x[w(222)].referer || "" }), t0 = () => {
226
+ const x = w, a = { qHpth: x(209), wquxN: x(238), ctfTY: x(240), tQsWb: function(r, i) {
227
+ return r(i);
228
+ }, lMbnr: x(280), WfiHS: x(218), OeRPY: x(225), ElXUu: function(r, i, s) {
229
+ return r(i, s);
230
+ }, KeFvo: function(r, i) {
231
+ return r === i;
232
+ }, DzVhR: x(212), EHAFz: function(r, i) {
233
+ return r === i;
234
+ }, kXhyh: "DELETE", XHyZX: x(252), TBnyX: x(232), DReNP: x(277), YPyEm: x(207), pYbxB: x(257), uLAfu: x(270), YDnRQ: x(266), KwQqk: "StreamableHTTP", ilKCv: x(250), KIEat: x(278) }, e = {}, t = {}, n = async (r, i, s) => {
235
+ const d = x, l = new Y(s, i), u = l.sessionId;
236
+ e[u] = l, r.on(a.qHpth, () => {
237
+ l.close(), delete e[u], delete t[u];
233
238
  });
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");
239
+ const h = { prompts: {}, resources: {}, tools: {}, logging: {}, roots: { listChanged: !0 }, sampling: {} }, b = new q({ name: a[d(211)], version: a.ctfTY }, { capabilities: h });
240
+ t[u] = { client: b, user: r[d(226)], device: a[d(229)](G, r), type: a.lMbnr }, await b[d(251)](l);
241
+ }, o = async (r, i, s) => {
242
+ var E;
243
+ const d = x, l = r[d(224)][d(254)], u = (E = t[l]) == null ? void 0 : E[d(247)];
244
+ if (!u) {
245
+ i[d(221)](400).send(a[d(213)]);
241
246
  return;
242
247
  }
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];
248
+ const h = new W(s, i, u), b = h[d(254)];
249
+ e[b] = h, r.on(d(209), () => {
250
+ h[d(209)](), delete e[b];
246
251
  });
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) => {
256
- const c = e;
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 });
252
+ const m = { prompts: { listChanged: !0 }, resources: { subscribe: !0, listChanged: !0 }, tools: { listChanged: !0 }, completions: {}, logging: {} };
253
+ await new X({ name: "mcp-proxy-server", version: a[d(237)] }, { capabilities: m })[d(251)](h);
254
+ }, f = async (r, i) => {
255
+ const s = x, d = r[s(224)][s(254)], l = e[d];
256
+ l ? await l[s(231)](r, i) : i.status(47 * 193 + 5909 * -1 + -2762)[s(241)](s(210));
257
+ }, c = async (r, i) => {
258
+ const s = x;
259
+ r[s(263)] === a.OeRPY ? await a.ElXUu(K, r, i) : a[s(214)](r[s(263)], a[s(228)]) || a[s(260)](r[s(263)], a[s(269)]) ? await a[s(261)](_, r, i) : await a.tQsWb(p, i);
260
+ }, p = async (r) => {
261
+ const i = x;
262
+ r.writeHead(2225 * 2 + -9143 + 1 * 5098, { Allow: a[i(208)] })[i(223)](JSON[i(256)]({ jsonrpc: a[i(236)], error: { code: -32e3, message: a[i(234)] }, id: null }));
263
+ }, _ = async (r, i) => {
264
+ const s = x, d = r.headers[s(207)], l = e[d];
265
+ l ? (await l.handleRequest(r, i), a[s(214)](r[s(263)], a[s(269)]) && (delete e[d], delete t[d])) : i[s(221)](400)[s(241)](s(255));
266
+ }, K = async (r, i) => {
267
+ const s = x, d = r[s(222)][a[s(217)]], l = r[s(222)][a[s(259)]];
268
+ let u = e[d];
269
+ if (u) await u[s(239)](r, i, r[s(233)]);
270
+ else if (!d && M(r[s(233)])) {
271
+ u = new L({ sessionIdGenerator: () => l });
272
+ const h = { prompts: {}, resources: {}, tools: {}, logging: {}, roots: { listChanged: !0 }, sampling: {} }, b = new q({ name: a.wquxN, version: a[s(237)] }, { capabilities: h });
273
+ b[s(268)][s(276)](a.uLAfu, () => {
274
+ }), b[s(220)][s(276)](a.YDnRQ, (m) => ({ protocolVersion: m[s(253)][s(244)], capabilities: m.params[s(235)], serverInfo: { name: s(246), version: s(240) } })), t[l] = { client: b, user: r[s(226)], device: a.tQsWb(G, r), type: a.KwQqk }, e[l] = u, u.sessionId = l, await b[s(251)](u), await u[s(239)](r, i, r[s(233)]);
275
+ } else i[s(221)](-8643 + 9043 * 1)[s(274)]({ jsonrpc: s(232), error: { code: -32e3, message: a[s(242)] }, id: null });
271
276
  };
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);
277
+ return { handleSseProxy: n, handleSseInspector: o, handleSseMessage: f, handleStreamRequest: c, handleStreamInspector: async (r, i) => {
278
+ var m;
279
+ const s = x, d = r[s(224)][s(254)], l = (m = t[d]) == null ? void 0 : m[s(247)];
280
+ if (!l) {
281
+ i[s(221)](400).send("No client found");
277
282
  return;
278
283
  }
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();
284
+ const u = new A({ sessionIdGenerator: void 0 }, l), h = { prompts: { listChanged: !0 }, resources: { subscribe: !0, listChanged: !0 }, tools: { listChanged: !0 }, completions: {}, logging: {} }, b = new X({ name: a[s(227)], version: s(240) }, { capabilities: h });
285
+ await b.connect(u), await u[s(239)](r, i, r[s(233)]), i.on(a[s(230)], () => {
286
+ const H = s;
287
+ u[H(209)](), b[H(209)]();
282
288
  });
283
289
  }, clients: t };
284
290
  };
285
291
  export {
286
- V as auth,
287
- $ as signToken,
288
- e0 as useProxyHandles,
292
+ $ as auth,
293
+ e0 as signToken,
294
+ t0 as useProxyHandles,
289
295
  x0 as verifyToken
290
296
  };