@opentiny/next 0.1.3 → 0.1.4

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 +341 -329
  2. package/package.json +1 -1
  3. package/server.js +233 -221
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opentiny/next",
3
- "version": "0.1.3",
3
+ "version": "0.1.4",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "author": "Chunhui Mo",
package/server.js CHANGED
@@ -1,296 +1,308 @@
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();
1
+ import H from "jsonwebtoken";
2
+ import { McpServer as j } from "@modelcontextprotocol/sdk/server/mcp.js";
3
+ import { Client as C } from "@modelcontextprotocol/sdk/client/index.js";
4
+ import { SSEServerTransport as O } from "@modelcontextprotocol/sdk/server/sse.js";
5
+ import { StreamableHTTPServerTransport as E } from "@modelcontextprotocol/sdk/server/streamableHttp.js";
6
+ import { isInitializeRequest as J } from "@modelcontextprotocol/sdk/types.js";
7
+ (function(x, t) {
8
+ const e = I, s = x();
9
9
  for (; ; )
10
10
  try {
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());
11
+ if (-parseInt(e(259)) / 1 + -parseInt(e(266)) / 2 * (-parseInt(e(264)) / 3) + -parseInt(e(257)) / 4 + parseInt(e(246)) / 5 + parseInt(e(237)) / 6 + -parseInt(e(254)) / 7 + -parseInt(e(252)) / 8 * (parseInt(e(228)) / 9) === t) break;
12
+ s.push(s.shift());
13
13
  } catch {
14
- t.push(t.shift());
14
+ s.push(s.shift());
15
15
  }
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);
16
+ })(S, 933784 + -67078 * -24 + 29 * -55563);
17
+ const B = async (x, t) => {
18
+ const e = I, s = { WozBV: e(225), Pimwt: e(231), LOJvz: e(265), lNMNy: e(255), cXYIj: e(270), YdiJb: e(244), jjDqR: "2.0", Excqw: function(g, _) {
19
+ return g !== _;
20
+ }, fUKXi: "initialize", gUnDe: function(g, _) {
21
+ return g !== _;
22
+ }, CfAez: e(249), HsHBa: e(263) };
23
+ let r;
24
+ const { id: c, method: l, params: d, result: u } = t;
25
+ if (l) {
26
+ switch (l) {
27
+ case "tools/list":
28
+ r = await x[e(238)][e(260)](d);
29
29
  break;
30
- case e(436):
31
- n = await x[e(428)].callTool(c);
30
+ case s[e(223)]:
31
+ r = await x[e(238)][e(241)](d);
32
32
  break;
33
- case t.moPGf:
34
- n = await x[e(428)].listResources(c);
33
+ case e(240):
34
+ r = await x[e(238)][e(239)](d);
35
35
  break;
36
- case t[e(422)]:
37
- n = await x[e(428)].listResourceTemplates(c);
36
+ case e(235):
37
+ r = await x._client[e(224)](d);
38
38
  break;
39
- case t.KPRsg:
40
- n = await x[e(428)][e(420)](c);
39
+ case e(232):
40
+ r = await x[e(238)][e(234)](d);
41
41
  break;
42
- case e(425):
43
- n = await x._client[e(412)](c);
42
+ case s[e(248)]:
43
+ r = await x[e(238)][e(230)](d);
44
44
  break;
45
- case t[e(424)]:
46
- n = await x[e(428)][e(426)](c);
45
+ case e(226):
46
+ r = await x[e(238)][e(269)](d);
47
47
  break;
48
- case t[e(405)]:
49
- n = await x[e(428)][e(387)](c);
48
+ case s[e(233)]:
49
+ r = await x._client.getPrompt(d);
50
50
  break;
51
- case t[e(410)]:
52
- n = await x[e(428)][e(433)](c);
51
+ case s[e(261)]:
52
+ r = await x._client[e(272)](d);
53
53
  break;
54
- case t[e(396)]:
55
- n = await x[e(428)][e(386)]();
54
+ case s[e(267)]:
55
+ r = await x._client.ping();
56
56
  break;
57
- case t[e(400)]:
58
- n = await x._client[e(432)](c);
57
+ case "completion/complete":
58
+ r = await x[e(238)][e(258)](d);
59
59
  break;
60
- case t[e(409)]:
61
- n = await x._client[e(392)](c);
60
+ case s.YdiJb:
61
+ r = await x._client.setLoggingLevel(d.level);
62
62
  break;
63
63
  }
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
- }
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;
64
+ r ? await x[e(250)]({ result: r, jsonrpc: s.jjDqR, id: c }) : s[e(262)](l, s[e(242)]) && s[e(256)](l, s.CfAez) && (s[e(262)](l, s[e(245)]) || d[e(227)]) && await x[e(238)].notification({ method: l, params: d });
65
+ } else u && !u.protocolVersion && (await x._client._transport[e(250)](t), r = u);
66
+ return r;
67
+ };
68
+ function I(x, t) {
69
+ const e = S();
70
+ return I = function(s, r) {
71
+ return s = s - (-3 * -41 + 1 * 1390 + 15 * -86), e[s];
72
+ }, I(x, t);
73
+ }
74
+ const L = (x) => {
75
+ const t = I, e = { TdUvk: function(r, c, l) {
76
+ return r(c, l);
77
+ }, JIDse: function(r, c) {
78
+ return r === c;
79
+ } }, s = x.onmessage;
80
+ if (!s[t(236)]) {
81
+ async function r(c, l) {
82
+ const d = t;
83
+ if (x[d(238)]) {
84
+ let u;
77
85
  try {
78
- p = await e[c(418)](N, x, o);
86
+ u = await e[d(247)](B, x, c);
79
87
  } catch {
80
88
  }
81
- if (e[c(421)](p, void 0) && t) try {
82
- t[c(416)](x, o, f);
89
+ if (e[d(271)](u, void 0) && s) try {
90
+ s[d(251)](x, c, l);
83
91
  } catch {
84
92
  }
85
93
  }
86
94
  }
87
- n[a(423)] = !0, x[a(406)] = n;
95
+ r[t(236)] = !0, x[t(253)] = r;
88
96
  }
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)] };
97
+ };
98
+ function S() {
99
+ const x = ["_onrequest", "logging/setLevel", "HsHBa", "7281375AeJTii", "TdUvk", "Pimwt", "notifications/initialized", "send", "call", "1864IXDVbC", "onmessage", "3148215lDPNPc", "prompts/list", "gUnDe", "1858652FmJVWc", "complete", "575508JenXEa", "listTools", "lNMNy", "Excqw", "notifications/cancelled", "4398183IXrrPZ", "prompts/get", "2HWWvPo", "cXYIj", "2.0", "unsubscribeResource", "ping", "JIDse", "listPrompts", "WozBV", "listResourceTemplates", "tools/call", "resources/unsubscribe", "forward", "21519EhspQj", "_onnotification", "subscribeResource", "resources/subscribe", "resources/read", "LOJvz", "readResource", "resources/templates/list", "isSet", "342072GXmhqr", "_client", "listResources", "resources/list", "callTool", "fUKXi"];
100
+ return S = function() {
101
+ return x;
102
+ }, S();
103
+ }
104
+ const D = (x, t) => {
105
+ const e = I;
106
+ t[e(243)] = async (r) => {
107
+ const c = e;
108
+ try {
109
+ await x[c(250)](r);
110
+ } catch {
111
+ }
112
+ };
113
+ const s = t[e(229)];
114
+ t[e(229)] = async (r) => {
115
+ const c = e;
93
116
  try {
94
- await x.send(c);
117
+ await x[c(250)]({ ...r, jsonrpc: c(268) });
95
118
  } catch {
96
119
  }
97
- n[f(416)](a, o);
120
+ s[c(251)](t, r);
98
121
  };
99
122
  };
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(); ; )
123
+ var N = v;
124
+ (function(x, t) {
125
+ for (var e = v, s = x(); ; )
115
126
  try {
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());
127
+ var r = -parseInt(e(432)) / 1 + parseInt(e(434)) / 2 + -parseInt(e(440)) / 3 * (-parseInt(e(433)) / 4) + parseInt(e(431)) / 5 * (-parseInt(e(441)) / 6) + parseInt(e(437)) / 7 + -parseInt(e(439)) / 8 + parseInt(e(436)) / 9;
128
+ if (r === t) break;
129
+ s.push(s.shift());
119
130
  } catch {
120
- t.push(t.shift());
131
+ s.push(s.shift());
121
132
  }
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);
133
+ })(P, -3 * 381417 + -989793 + 3094773);
134
+ function v(x, t) {
135
+ var e = P();
136
+ return v = function(s, r) {
137
+ s = s - (7809 + 1054 * -7);
138
+ var c = e[s];
139
+ return c;
140
+ }, v(x, t);
130
141
  }
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);
142
+ class W extends O {
143
+ constructor(t, e, s) {
144
+ var r = v, c = { rupYq: function(l, d, u) {
145
+ return l(d, u);
135
146
  } };
136
- super(a, e), this[n(418)] = t, o[n(409)](D, this, t);
147
+ super(t, e), this._client = s, c[r(438)](D, this, s);
137
148
  }
138
- async [U(415)](a) {
139
- C(this), await super.handleMessage(a);
149
+ async [N(435)](t) {
150
+ var e = N;
151
+ L(this), await super[e(435)](t);
140
152
  }
141
153
  }
142
- function S() {
143
- var x = ["5569145VHAoIi", "_client", "1858412TeEtwX", "rqdbH", "7BPxJge", "743572hMFZpQ", "1062750pVXkrf", "37464200zpVnfx", "1194657zQFklV", "handleMessage", "4297400QxbqFq"];
144
- return S = function() {
154
+ function P() {
155
+ var x = ["3550864IpRzrf", "6YnyZIU", "6bqMxgQ", "4027885zjdcmP", "741092trIgaH", "19216GBpFeu", "3545350dNnWOv", "handleMessage", "9755109lPvHit", "595504msfIOG", "rupYq"];
156
+ return P = function() {
145
157
  return x;
146
- }, S();
158
+ }, P();
147
159
  }
148
- var z = v;
149
- (function(x, a) {
150
- for (var e = v, t = x(); ; )
160
+ (function(x, t) {
161
+ for (var e = y, s = x(); ; )
151
162
  try {
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());
163
+ var r = -parseInt(e(472)) / 1 * (parseInt(e(473)) / 2) + -parseInt(e(468)) / 3 + parseInt(e(469)) / 4 + parseInt(e(464)) / 5 * (parseInt(e(465)) / 6) + -parseInt(e(470)) / 7 + -parseInt(e(471)) / 8 + parseInt(e(466)) / 9;
164
+ if (r === t) break;
165
+ s.push(s.shift());
155
166
  } catch {
156
- t.push(t.shift());
167
+ s.push(s.shift());
157
168
  }
158
- })(k, 536314);
159
- function v(x, a) {
169
+ })(k, 219339 + 30489 * -11 + 6 * 47563);
170
+ function y(x, t) {
160
171
  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);
172
+ return y = function(s, r) {
173
+ s = s - (3283 + -141 * 20);
174
+ var c = e[s];
175
+ return c;
176
+ }, y(x, t);
166
177
  }
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);
178
+ class X extends E {
179
+ constructor(t, e) {
180
+ var s = y;
181
+ super(t), this[s(467)] = e, D(this, e);
173
182
  }
174
- async [z(229)](a, e, t) {
175
- var n = z, o = { zWscN: function(f, c) {
176
- return f(c);
183
+ async handlePostRequest(t, e, s) {
184
+ var r = y, c = { HrlmB: function(l, d) {
185
+ return l(d);
177
186
  } };
178
- o[n(224)](C, this), await super[n(229)](a, e, t);
187
+ c[r(463)](L, this), await super.handlePostRequest(t, e, s);
179
188
  }
180
189
  }
181
190
  function k() {
182
- var x = ["226855XHUddw", "1444112aVlGFe", "66370eeqEfo", "18TJbykv", "zWscN", "10990NPXHzV", "_client", "2764215blBRpe", "21WsEMin", "handlePostRequest", "1242594VAYLDC", "192096ADjYdR", "5951HOcywA", "15XTYlKF", "cIlGY"];
191
+ var x = ["1tgcKvS", "662374SLYIzm", "HrlmB", "725TUbMhd", "8574mNFSpm", "6229620pmfgbS", "_client", "577404HmBOca", "843016JQuJwf", "858641YgZhNG", "2355864JmfylL"];
183
192
  return k = function() {
184
193
  return x;
185
194
  }, k();
186
195
  }
187
- const w = y;
188
- (function(x, a) {
189
- const e = y, t = x();
196
+ const w = q;
197
+ (function(x, t) {
198
+ const e = q, s = x();
190
199
  for (; ; )
191
200
  try {
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());
201
+ if (parseInt(e(446)) / 1 + parseInt(e(424)) / 2 * (-parseInt(e(418)) / 3) + parseInt(e(485)) / 4 + -parseInt(e(437)) / 5 + parseInt(e(483)) / 6 * (parseInt(e(439)) / 7) + -parseInt(e(468)) / 8 + parseInt(e(417)) / 9 === t) break;
202
+ s.push(s.shift());
194
203
  } catch {
195
- t.push(t.shift());
204
+ s.push(s.shift());
196
205
  }
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);
206
+ })(T, 143 * 2835 + 1 * 914343 + 306 * -2273);
207
+ function T() {
208
+ const x = ["VeHhP", "337344wgLSFz", "16489323cjXsfa", "3vpwKRk", "Invalid or missing session ID", "handleRequest", "HS256", "end", "StreamableHTTP", "2083958wqGmHB", "No client found", "mvzvS", "close", "split", "protocolVersion", "headers", "send", "lvfWF", "OkmtL", "NBCua", "Method not allowed.", "writeHead", "3861280YwpDIi", "GET", "4671443aRqpEz", "authorization", "stream-session-id", "Bad Request: No valid session ID provided", "referer", "fWdWV", "Invalid bearer token", "45022RxSqlk", "ptnCX", "rVsbI", "message", "stringify", "SSE", "POST", "GET, POST, DELETE", "_requestHandlers", "mcp-session-id", "pVjrU", "DELETE", "rnLrT", "HGYOy", "qXoAO", "xjKmi", "VEseI", "lLVrl", "_notificationHandlers", "connect", "params", "user", "1523272lQZRDV", "status", "capabilities", "sign", "sessionId", "1.0.0", "30 days", "body", "method", "Missing bearer token", "query", "NmaVW", "set", "ywqqw", "lqKJQ", "6CfSzyU"];
209
+ return T = function() {
210
+ return x;
211
+ }, T();
203
212
  }
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");
213
+ function q(x, t) {
214
+ const e = T();
215
+ return q = function(s, r) {
216
+ return s = s - (-1 * -619 + -1 * 779 + 577 * 1), e[s];
217
+ }, q(x, t);
218
+ }
219
+ const Z = ({ secret: x }) => (t, e, s) => {
220
+ var d;
221
+ const r = q, c = { lLVrl: r(477), zxgKP: function(u) {
222
+ return u();
223
+ }, jvIgK: r(445) }, l = (d = t.headers[r(440)]) == null ? void 0 : d[r(428)](" ")[-2066 + 53 * 39];
224
+ if (!l) {
225
+ e.status(4140 + 3739 * -1).send(c[r(463)]);
211
226
  return;
212
227
  }
213
228
  try {
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)] });
229
+ t[r(467)] = H.verify(l, x), c.zxgKP(s);
230
+ } catch (u) {
231
+ e[r(469)](403).json({ error: c.jvIgK, details: u[r(449)] });
217
232
  }
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
+ }, $ = (x, t, e = { expiresIn: w(474), algorithm: w(421) }) => H[w(471)](x, t, e), e0 = (x, t) => H.verify(x, t), R = (x) => ({ ip: x[w(430)]["x-forwarded-for"] || x.ip || "", userAgent: x[w(430)]["user-agent"] || "", acceptLanguage: x[w(430)]["accept-language"] || "", referer: x[w(430)][w(443)] || "" }), x0 = () => {
234
+ const x = w, t = { fWdWV: x(427), rVsbI: "mcp-proxy-client", ptnCX: function(a, i) {
235
+ return a(i);
236
+ }, mvzvS: x(451), xjKmi: "mcp-proxy-server", qXoAO: x(473), mCxDw: "No transport found", VEseI: function(a, i) {
237
+ return a === i;
238
+ }, HGYOy: x(452), rnLrT: function(a, i, n) {
239
+ return a(i, n);
240
+ }, ywqqw: function(a, i) {
241
+ return a === i;
242
+ }, NBCua: x(438), NmaVW: x(453), VeHhP: "2.0", JzPNy: x(435), lqKJQ: x(455), lvfWF: x(441), VpHOp: function(a, i) {
243
+ return a(i);
244
+ }, OkmtL: "notifications/initialized", BCCwU: function(a, i) {
245
+ return a(i);
246
+ }, pVjrU: x(442), OjaPP: x(425) }, e = {}, s = {}, r = async (a, i, n) => {
247
+ const o = x, f = new O(n, i), b = f[o(472)];
248
+ e[b] = f, a.on(t[o(444)], () => {
249
+ f.close(), delete e[b], delete s[b];
238
250
  });
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)]);
251
+ const m = { prompts: {}, resources: {}, tools: {}, logging: {}, roots: { listChanged: !0 }, sampling: {} }, p = new C({ name: t[o(448)], version: o(473) }, { capabilities: m });
252
+ s[b] = { client: p, user: a[o(467)], device: t[o(447)](R, a), type: t[o(426)] }, await p[o(465)](f);
253
+ }, c = async (a, i, n) => {
254
+ var V;
255
+ const o = x, f = a[o(478)].sessionId, b = (V = s[f]) == null ? void 0 : V.client;
256
+ if (!b) {
257
+ i[o(469)](-6717 + -641 * -13 + 32 * -38)[o(431)]("No client found");
246
258
  return;
247
259
  }
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];
260
+ const m = new W(n, i, b), p = m[o(472)];
261
+ e[p] = m, a.on(t[o(444)], () => {
262
+ m[o(427)](), delete e[p];
251
263
  });
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) => {
264
+ const h = { prompts: { listChanged: !0 }, resources: { subscribe: !0, listChanged: !0 }, tools: { listChanged: !0 }, completions: {}, logging: {} };
265
+ await new j({ name: t[o(461)], version: t.qXoAO }, { capabilities: h })[o(465)](m);
266
+ }, l = async (a, i) => {
267
+ const n = x, o = a[n(478)].sessionId, f = e[o];
268
+ f ? await f.handlePostMessage(a, i) : i.status(-6520 + 19 * -241 + 11499)[n(431)](t.mCxDw);
269
+ }, d = async (a, i) => {
270
+ const n = x;
271
+ t[n(462)](a[n(476)], t[n(459)]) ? await t[n(458)](_, a, i) : t.ywqqw(a[n(476)], t[n(434)]) || t[n(481)](a[n(476)], n(457)) ? await t.rnLrT(g, a, i) : await u(i);
272
+ }, u = async (a) => {
261
273
  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 });
274
+ a[i(436)](14155 + -250 * 55, { Allow: t[i(479)] })[i(422)](JSON[i(450)]({ jsonrpc: t[i(484)], error: { code: -32e3, message: t.JzPNy }, id: null }));
275
+ }, g = async (a, i) => {
276
+ const n = x, o = a.headers[t[n(482)]], f = e[o];
277
+ f ? (await f[n(420)](a, i), a.method === n(457) && (delete e[o], delete s[o])) : i[n(469)](-7 * -938 + 2 * 983 + 76 * -107)[n(431)](n(419));
278
+ }, _ = async (a, i) => {
279
+ const n = x, o = a[n(430)]["mcp-session-id"], f = a[n(430)][t[n(432)]];
280
+ let b = e[o];
281
+ if (b) await b[n(420)](a, i, a.body);
282
+ else if (!o && t.VpHOp(J, a.body)) {
283
+ b = new E({ sessionIdGenerator: () => f });
284
+ const m = { prompts: {}, resources: {}, tools: {}, logging: {}, roots: { listChanged: !0 }, sampling: {} }, p = new C({ name: t[n(448)], version: t[n(460)] }, { capabilities: m });
285
+ p[n(464)][n(480)](t[n(433)], () => {
286
+ }), p[n(454)][n(480)]("initialize", (h) => ({ protocolVersion: h[n(466)][n(429)], capabilities: h[n(466)][n(470)], serverInfo: { name: "mcp-server", version: n(473) } })), s[f] = { client: p, user: a.user, device: t.BCCwU(R, a), type: n(423) }, e[f] = b, b.sessionId = f, await p[n(465)](b), await b.handleRequest(a, i, a.body);
287
+ } else i[n(469)](1 * 623 + -1446 * 2 + 2669).json({ jsonrpc: t[n(484)], error: { code: -32e3, message: t[n(456)] }, id: null });
276
288
  };
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");
289
+ return { handleSseProxy: r, handleSseInspector: c, handleSseMessage: l, handleStreamRequest: d, handleStreamInspector: async (a, i) => {
290
+ var h;
291
+ const n = x, o = a[n(478)][n(472)], f = (h = s[o]) == null ? void 0 : h.client;
292
+ if (!f) {
293
+ i[n(469)](2846 * -3 + -3637 * 2 + 16212)[n(431)](t.OjaPP);
282
294
  return;
283
295
  }
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)]();
296
+ const b = new X({ sessionIdGenerator: void 0 }, f), m = { prompts: { listChanged: !0 }, resources: { subscribe: !0, listChanged: !0 }, tools: { listChanged: !0 }, completions: {}, logging: {} }, p = new j({ name: t[n(461)], version: t[n(460)] }, { capabilities: m });
297
+ await p[n(465)](b), await b[n(420)](a, i, a[n(475)]), i.on(t[n(444)], () => {
298
+ const z = n;
299
+ b[z(427)](), p[z(427)]();
288
300
  });
289
- }, clients: t };
301
+ }, clients: s };
290
302
  };
291
303
  export {
292
- $ as auth,
293
- e0 as signToken,
294
- t0 as useProxyHandles,
295
- x0 as verifyToken
304
+ Z as auth,
305
+ $ as signToken,
306
+ x0 as useProxyHandles,
307
+ e0 as verifyToken
296
308
  };