@opentiny/next 0.1.1 → 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 +301 -268
  2. package/package.json +4 -3
  3. package/server.js +236 -213
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opentiny/next",
3
- "version": "0.1.1",
3
+ "version": "0.1.3",
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.1",
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,296 @@
1
- import R from "jsonwebtoken";
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";
7
- (function(e, a) {
8
- const x = _, s = 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(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(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
+ 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);
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);
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
+ let n;
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);
25
29
  break;
26
- case x(175):
27
- r = await e[x(186)][x(189)](u);
30
+ case e(436):
31
+ n = await x[e(428)].callTool(c);
28
32
  break;
29
- case "resources/list":
30
- r = await e._client[x(181)](u);
33
+ case t.moPGf:
34
+ n = await x[e(428)].listResources(c);
31
35
  break;
32
- case s[x(191)]:
33
- r = await e[x(186)].listResourceTemplates(u);
36
+ case t[e(422)]:
37
+ n = await x[e(428)].listResourceTemplates(c);
34
38
  break;
35
- case s[x(177)]:
36
- r = await e._client[x(193)](u);
39
+ case t.KPRsg:
40
+ n = await x[e(428)][e(420)](c);
37
41
  break;
38
- case x(212):
39
- r = await e._client.subscribeResource(u);
42
+ case e(425):
43
+ n = await x._client[e(412)](c);
40
44
  break;
41
- case s[x(184)]:
42
- r = await e[x(186)][x(176)](u);
45
+ case t[e(424)]:
46
+ n = await x[e(428)][e(426)](c);
43
47
  break;
44
- case s[x(185)]:
45
- r = await e[x(186)][x(208)](u);
48
+ case t[e(405)]:
49
+ n = await x[e(428)][e(387)](c);
46
50
  break;
47
- case x(210):
48
- r = await e[x(186)][x(199)](u);
51
+ case t[e(410)]:
52
+ n = await x[e(428)][e(433)](c);
49
53
  break;
50
- case s[x(211)]:
51
- r = await e._client.ping();
54
+ case t[e(396)]:
55
+ n = await x[e(428)][e(386)]();
52
56
  break;
53
- case s[x(183)]:
54
- r = await e[x(186)][x(200)](u);
57
+ case t[e(400)]:
58
+ n = await x._client[e(432)](c);
55
59
  break;
56
- case s[x(192)]:
57
- r = await e[x(186)][x(203)](u);
60
+ case t[e(409)]:
61
+ n = await x._client[e(392)](c);
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 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;
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;
77
- if (e._client) {
78
- let l;
79
- try {
80
- l = await x[o(204)](J, e, r);
81
- } catch {
82
- }
83
- if (x[o(213)](l, void 0) && s) try {
84
- s[o(194)](e, r);
85
- } 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
+ }
86
85
  }
87
86
  }
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)] };
93
+ try {
94
+ await x.send(c);
95
+ } catch {
96
+ }
97
+ n[f(416)](a, o);
88
98
  };
89
99
  };
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() {
93
- return e;
94
- }, v();
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);
95
105
  }
96
- 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;
102
- }, w(e, a);
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();
103
111
  }
104
- (function(e, a) {
105
- for (var x = w, s = e(); ; )
112
+ var U = g;
113
+ (function(x, a) {
114
+ for (var e = g, t = x(); ; )
106
115
  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());
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;
117
+ if (n === a) break;
118
+ t.push(t.shift());
110
119
  } catch {
111
- s.push(s.shift());
120
+ t.push(t.shift());
112
121
  }
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() {
117
- return e;
118
- }, y();
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];
128
+ return o;
129
+ }, g(x, a);
119
130
  }
120
- class Y extends E {
121
- constructor(a, x, s) {
122
- var r = w;
123
- super(a, x), this[r(474)] = s;
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);
135
+ } };
136
+ super(a, e), this[n(418)] = t, o[n(409)](D, this, t);
124
137
  }
125
- async handleMessage(a) {
126
- var x = w;
127
- V(this), await super[x(479)](a);
138
+ async [U(415)](a) {
139
+ C(this), await super.handleMessage(a);
128
140
  }
129
141
  }
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);
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();
138
147
  }
139
- (function(e, a) {
140
- for (var x = g, s = e(); ; )
148
+ var z = v;
149
+ (function(x, a) {
150
+ for (var e = v, t = x(); ; )
141
151
  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());
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);
153
+ if (n === a) break;
154
+ t.push(t.shift());
145
155
  } catch {
146
- s.push(s.shift());
156
+ t.push(t.shift());
147
157
  }
148
- })(S, 338708 + 8830 * 52 + -113446);
149
- class j extends C {
150
- constructor(a, x) {
151
- var s = g;
152
- super(a), this[s(279)] = x;
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];
164
+ return o;
165
+ }, v(x, a);
166
+ }
167
+ class A extends L {
168
+ constructor(a, e) {
169
+ var t = v, n = { cIlGY: function(o, f, c) {
170
+ return o(f, c);
171
+ } };
172
+ super(a), this[t(226)] = e, n[t(219)](D, this, e);
153
173
  }
154
- async [H(266)](a, x, s) {
155
- var r = H, o = { iVowj: function(l, u) {
156
- return l(u);
174
+ async [z(229)](a, e, t) {
175
+ var n = z, o = { zWscN: function(f, c) {
176
+ return f(c);
157
177
  } };
158
- o[r(273)](V, this), await super[r(266)](a, x, s);
178
+ o[n(224)](C, this), await super[n(229)](a, e, t);
159
179
  }
160
180
  }
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() {
164
- return e;
165
- }, S();
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();
166
186
  }
167
- const h = m;
168
- (function(e, a) {
169
- const x = m, s = e();
187
+ const w = y;
188
+ (function(x, a) {
189
+ const e = y, t = x();
170
190
  for (; ; )
171
191
  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());
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;
193
+ t.push(t.shift());
174
194
  } catch {
175
- s.push(s.shift());
195
+ t.push(t.shift());
176
196
  }
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) {
185
- const x = T();
186
- return m = function(s, r) {
187
- return s = s - (-9661 * 1 + 857 + 9214), x[s];
188
- }, m(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);
189
203
  }
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));
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");
195
211
  return;
196
212
  }
197
213
  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 });
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)] });
201
217
  }
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];
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];
215
238
  });
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);
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)]);
223
246
  return;
224
247
  }
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];
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];
228
251
  });
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) => {
238
- 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 });
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 });
253
276
  };
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)]);
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");
259
282
  return;
260
283
  }
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)]();
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)]();
265
288
  });
266
- }, clients: s };
289
+ }, clients: t };
267
290
  };
268
291
  export {
269
- N as auth,
270
- U as signToken,
271
- $ as useProxyHandles,
272
- Z as verifyToken
292
+ $ as auth,
293
+ e0 as signToken,
294
+ t0 as useProxyHandles,
295
+ x0 as verifyToken
273
296
  };