@opentiny/next 0.1.0 → 0.1.1

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 (5) hide show
  1. package/README.md +14 -13
  2. package/client.js +299 -297
  3. package/package.json +3 -3
  4. package/server.d.ts +2 -6
  5. package/server.js +189 -185
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opentiny/next",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "author": "Chunhui Mo",
@@ -14,9 +14,9 @@
14
14
  "module": "client.js",
15
15
  "description": "OpenTiny NEXT",
16
16
  "dependencies": {
17
- "@modelcontextprotocol/sdk": "^1.10.2",
17
+ "@modelcontextprotocol/sdk": "^1.11.0",
18
18
  "jsonwebtoken": "^9.0.2",
19
- "zod": "^3.24.2"
19
+ "zod": "^3.24.4"
20
20
  },
21
21
  "peerDependencies": {
22
22
  "express": "^4.21.2"
package/server.d.ts CHANGED
@@ -2,10 +2,6 @@ import jwt, { JwtPayload } from 'jsonwebtoken';
2
2
  import { Client } from '@modelcontextprotocol/sdk/client/index.js';
3
3
  import { Request, Response, NextFunction } from 'express';
4
4
 
5
- /**
6
- * 客户端连接的 Transport 类型,比如:StreamableHTTP、SSE
7
- */
8
- type TransportType = 'SSE' | 'StreamableHTTP';
9
5
  /**
10
6
  * 客户端连接的信息,包括客户端实例、用户信息和 Transport 类型
11
7
  */
@@ -42,7 +38,7 @@ interface ClientInfo {
42
38
  /**
43
39
  * 客户端连接的 Transport 类型
44
40
  */
45
- type: TransportType;
41
+ type: 'SSE' | 'StreamableHTTP';
46
42
  }
47
43
  /**
48
44
  * Express 请求对象的扩展,添加了可选的用户信息属性
@@ -92,4 +88,4 @@ declare const useProxyHandles: () => {
92
88
  };
93
89
 
94
90
  export { auth, signToken, useProxyHandles, verifyToken };
95
- export type { ClientInfo, TransportType };
91
+ export type { ClientInfo };
package/server.js CHANGED
@@ -1,269 +1,273 @@
1
- import M from "jsonwebtoken";
2
- import { McpServer as D } from "@modelcontextprotocol/sdk/server/mcp.js";
3
- import { Client as V } from "@modelcontextprotocol/sdk/client/index.js";
4
- import { SSEServerTransport as N } from "@modelcontextprotocol/sdk/server/sse.js";
5
- import { StreamableHTTPServerTransport as P } from "@modelcontextprotocol/sdk/server/streamableHttp.js";
6
- import { isInitializeRequest as L } from "@modelcontextprotocol/sdk/types.js";
7
- function _(e, a) {
8
- const x = g();
9
- return _ = function(s, n) {
10
- return s = s - (9141 + -6 * 63 + 33 * -253), x[s];
11
- }, _(e, a);
12
- }
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";
13
7
  (function(e, a) {
14
8
  const x = _, s = e();
15
9
  for (; ; )
16
10
  try {
17
- if (-parseInt(x(441)) / 1 * (parseInt(x(456)) / 2) + -parseInt(x(416)) / 3 * (-parseInt(x(415)) / 4) + -parseInt(x(425)) / 5 * (-parseInt(x(426)) / 6) + -parseInt(x(438)) / 7 * (parseInt(x(440)) / 8) + parseInt(x(455)) / 9 * (-parseInt(x(448)) / 10) + -parseInt(x(423)) / 11 * (parseInt(x(447)) / 12) + parseInt(x(446)) / 13 * (parseInt(x(429)) / 14) === a) break;
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;
18
12
  s.push(s.shift());
19
13
  } catch {
20
14
  s.push(s.shift());
21
15
  }
22
- })(g, -276384 * -4 + 1354678 + -1774470);
23
- function g() {
24
- const e = ["resources/unsubscribe", "subscribeResource", "tools/call", "readResource", "3661ghODPp", "logging/setLevel", "19064NSEcAs", "127MjtXKH", "getPrompt", "send", "tools/list", "prompts/list", "169rCWZyY", "12ruWgpk", "4471280evukDT", "ApqQw", "sExur", "ping", "complete", "resources/read", "resources/subscribe", "18FYdDVz", "11054ciDAzC", "ivBSM", "onmessage", "OtdbO", "40TggALB", "346350eWjLOm", "resources/list", "callTool", "LVIkQ", "listTools", "2.0", "listResourceTemplates", "1715835DOrzVE", "listPrompts", "1013195MxsBkk", "30CEeAEg", "_client", "listResources", "1633184sotXfk", "unsubscribeResource", "RZrry", "resources/templates/list", "completion/complete"];
25
- return g = function() {
26
- return e;
27
- }, g();
28
- }
29
- const A = async (e, a) => {
30
- const x = _, s = { OtdbO: x(436), OLpMt: x(417), RZrry: x(434), LVIkQ: "prompts/get", sExur: x(445), ApqQw: x(451), xpeDk: x(433), ivBSM: x(439), RRNXj: x(421) };
31
- let n;
32
- const { id: i, method: l, params: b } = a;
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;
33
21
  if (l) {
34
22
  switch (l) {
35
- case x(444):
36
- n = await e[x(427)][x(420)](b);
23
+ case s[x(217)]:
24
+ r = await e._client[x(207)](u);
37
25
  break;
38
- case s[x(414)]:
39
- n = await e[x(427)][x(418)](b);
26
+ case x(175):
27
+ r = await e[x(186)][x(189)](u);
40
28
  break;
41
- case s.OLpMt:
42
- n = await e[x(427)][x(428)](b);
29
+ case "resources/list":
30
+ r = await e._client[x(181)](u);
43
31
  break;
44
- case x(432):
45
- n = await e[x(427)][x(422)](b);
32
+ case s[x(191)]:
33
+ r = await e[x(186)].listResourceTemplates(u);
46
34
  break;
47
- case x(453):
48
- n = await e._client[x(437)](b);
35
+ case s[x(177)]:
36
+ r = await e._client[x(193)](u);
49
37
  break;
50
- case x(454):
51
- n = await e[x(427)][x(435)](b);
38
+ case x(212):
39
+ r = await e._client.subscribeResource(u);
52
40
  break;
53
- case s[x(431)]:
54
- n = await e[x(427)][x(430)](b);
41
+ case s[x(184)]:
42
+ r = await e[x(186)][x(176)](u);
55
43
  break;
56
- case s[x(419)]:
57
- n = await e[x(427)][x(442)](b);
44
+ case s[x(185)]:
45
+ r = await e[x(186)][x(208)](u);
58
46
  break;
59
- case s[x(450)]:
60
- n = await e._client[x(424)](b);
47
+ case x(210):
48
+ r = await e[x(186)][x(199)](u);
61
49
  break;
62
- case s[x(449)]:
63
- n = await e._client[x(451)]();
50
+ case s[x(211)]:
51
+ r = await e._client.ping();
64
52
  break;
65
- case s.xpeDk:
66
- n = await e[x(427)][x(452)](b);
53
+ case s[x(183)]:
54
+ r = await e[x(186)][x(200)](u);
67
55
  break;
68
- case s[x(457)]:
69
- n = await e._client.setLoggingLevel(b);
56
+ case s[x(192)]:
57
+ r = await e[x(186)][x(203)](u);
70
58
  break;
71
59
  }
72
- return n && await e[x(443)]({ result: n, jsonrpc: s.RRNXj, id: i }), n;
60
+ return r && await e[x(188)]({ result: r, jsonrpc: s[x(205)], id: o }), r;
73
61
  }
74
- }, B = (e) => {
75
- const a = _, x = { UVsDk: function(n, i) {
76
- return n === i;
77
- } }, s = e.onmessage;
78
- e[a(458)] = async (n) => {
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;
79
77
  if (e._client) {
80
- const i = await A(e, n);
81
- x.UVsDk(i, void 0) && s && s.call(e, n);
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 {
86
+ }
82
87
  }
83
88
  };
84
89
  };
85
- function v(e, a) {
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();
95
+ }
96
+ function w(e, a) {
86
97
  var x = y();
87
- return v = function(s, n) {
88
- s = s - (8692 + 1 * -112 + -8331);
89
- var i = x[s];
90
- return i;
91
- }, v(e, a);
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);
92
103
  }
93
- var j = v;
94
104
  (function(e, a) {
95
- for (var x = v, s = e(); ; )
105
+ for (var x = w, s = e(); ; )
96
106
  try {
97
- var n = parseInt(x(250)) / 1 + -parseInt(x(258)) / 2 + parseInt(x(259)) / 3 * (-parseInt(x(251)) / 4) + -parseInt(x(249)) / 5 + -parseInt(x(256)) / 6 + -parseInt(x(254)) / 7 * (parseInt(x(253)) / 8) + -parseInt(x(257)) / 9 * (-parseInt(x(255)) / 10);
98
- if (n === a) break;
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;
99
109
  s.push(s.shift());
100
110
  } catch {
101
111
  s.push(s.shift());
102
112
  }
103
- })(y, -1 * -564824 + 25687 * -8 + -1 * -396581);
104
- class G extends N {
105
- constructor(a, x, s) {
106
- super(a, x), this._client = s;
107
- }
108
- async [j(252)](a) {
109
- var x = j;
110
- B(this), await super[x(252)](a);
111
- }
112
- }
113
+ })(y, -300663 * 1 + -46 * 3722 + -4 * -157219);
113
114
  function y() {
114
- var e = ["5783748DPOUZj", "2331sMYHuu", "491280RBsbgA", "456gjwhrP", "4609585wzBuIC", "966778XgDNrC", "2452GYmdvV", "handleMessage", "32gBlYmI", "1016470ePDinz", "100180lbWCCD"];
115
+ var e = ["736940YvXfNU", "_client", "351VaYOnl", "2054339FKDeBh", "10iDnLyM", "1006992tpTscA", "handleMessage", "96147EaQlKd", "3764PZZCEc", "360384sMoAEh", "2820IAqjWz", "5sHGHIA"];
115
116
  return y = function() {
116
117
  return e;
117
118
  }, y();
118
119
  }
119
- function k() {
120
- var e = ["145130mmOiYO", "86OecNVy", "1504503mktzfw", "4607100ojCaUM", "5927450EwZzAq", "141QuWaeP", "72kuFQfD", "1769jYRFYU", "40220uZYWhy", "22806124hJenCS", "_client", "handlePostRequest", "8hfYmWV"];
121
- return k = function() {
122
- return e;
123
- }, k();
120
+ class Y extends E {
121
+ constructor(a, x, s) {
122
+ var r = w;
123
+ super(a, x), this[r(474)] = s;
124
+ }
125
+ async handleMessage(a) {
126
+ var x = w;
127
+ V(this), await super[x(479)](a);
128
+ }
124
129
  }
125
- function h(e, a) {
126
- var x = k();
127
- return h = function(s, n) {
128
- s = s - (-493 * 11 + 1 * 5 + 5633);
129
- var i = x[s];
130
- return i;
131
- }, h(e, a);
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);
132
138
  }
133
- var Q = h;
134
139
  (function(e, a) {
135
- for (var x = h, s = e(); ; )
140
+ for (var x = g, s = e(); ; )
136
141
  try {
137
- var n = -parseInt(x(227)) / 1 * (-parseInt(x(221)) / 2) + -parseInt(x(225)) / 3 * (parseInt(x(215)) / 4) + -parseInt(x(220)) / 5 * (parseInt(x(226)) / 6) + -parseInt(x(222)) / 7 * (-parseInt(x(219)) / 8) + -parseInt(x(223)) / 9 + -parseInt(x(224)) / 10 + parseInt(x(216)) / 11;
138
- if (n === a) break;
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;
139
144
  s.push(s.shift());
140
145
  } catch {
141
146
  s.push(s.shift());
142
147
  }
143
- })(k, 762 * -382 + 10567 * -61 + 1374409);
144
- class Z extends P {
148
+ })(S, 338708 + 8830 * 52 + -113446);
149
+ class j extends C {
145
150
  constructor(a, x) {
146
- var s = h;
147
- super(a), this[s(217)] = x;
151
+ var s = g;
152
+ super(a), this[s(279)] = x;
148
153
  }
149
- async [Q(218)](a, x, s) {
150
- var n = Q, i = { IOEYc: function(l, b) {
151
- return l(b);
154
+ async [H(266)](a, x, s) {
155
+ var r = H, o = { iVowj: function(l, u) {
156
+ return l(u);
152
157
  } };
153
- i.IOEYc(B, this), await super[n(218)](a, x, s);
158
+ o[r(273)](V, this), await super[r(266)](a, x, s);
154
159
  }
155
160
  }
156
- const I = w;
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();
166
+ }
167
+ const h = m;
157
168
  (function(e, a) {
158
- const x = w, s = e();
169
+ const x = m, s = e();
159
170
  for (; ; )
160
171
  try {
161
- if (-parseInt(x(334)) / 1 * (-parseInt(x(322)) / 2) + parseInt(x(384)) / 3 + parseInt(x(326)) / 4 * (parseInt(x(387)) / 5) + -parseInt(x(342)) / 6 + -parseInt(x(381)) / 7 * (parseInt(x(390)) / 8) + -parseInt(x(383)) / 9 + -parseInt(x(367)) / 10 * (-parseInt(x(347)) / 11) === a) break;
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;
162
173
  s.push(s.shift());
163
174
  } catch {
164
175
  s.push(s.shift());
165
176
  }
166
- })(E, 507367);
167
- function E() {
168
- const e = ["275265DeMorS", "handleRequest", "protocolVersion", "664QUBQZi", "NZyuD", "message", "SGkVu", "Bad Request: No valid session ID provided", "2.0", "NKfhY", "sign", "user", "aTTmj", "writeHead", "referer", "mcp-proxy-client", "2YQCpBv", "mcp-session-id", "_requestHandlers", "GET", "8YeSGoI", "mcp-server", "query", "client", "headers", "IRQUp", "close", "end", "579527YvVojK", "cxhYJ", "stream-session-id", "rHMQM", "stringify", "JKnQL", "StreamableHTTP", "method", "5083710dEWIWB", "bmbQY", "ehpra", "Method not allowed.", "MbjmQ", "11VPeucu", "KqVMP", "connect", "send", "POST", "NTflE", "handlePostMessage", "status", "SZoau", "SSE", "EomGT", "user-agent", "json", "set", "initialize", "GET, POST, DELETE", "No transport found", "notifications/initialized", "sessionId", "PBzet", "11187480dNiAUD", "daZeK", "Xarej", "LnLIi", "JGjws", "EoEBV", "BGWyo", "MumfE", "Invalid bearer token", "verify", "1.0.0", "accept-language", "_notificationHandlers", "No client found", "21308EanUnc", "params", "3374991mZhigd", "521766FifKNn", "DlBYP", "body"];
169
- return E = function() {
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() {
170
181
  return e;
171
- }, E();
182
+ }, T();
172
183
  }
173
- function w(e, a) {
174
- const x = E();
175
- return w = function(s, n) {
176
- return s = s - (8016 + 2 * -3903 + 101 * 1), x[s];
177
- }, w(e, a);
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);
178
189
  }
179
- const F = ({ secret: e }) => (a, x, s) => {
180
- var b;
181
- const n = w, i = { SGkVu: "Missing bearer token", DlBYP: n(375) }, l = (b = a[n(330)].authorization) == null ? void 0 : b.split(" ")[29 * 163 + 494 * -2 + -1869 * 2];
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];
182
193
  if (!l) {
183
- x[n(354)](3171 + -2 * 1385).send(i[n(312)]);
194
+ x[r(441)](5745 + -167 * 32).send(r(448));
184
195
  return;
185
196
  }
186
197
  try {
187
- a[n(317)] = M.verify(l, e), s();
188
- } catch (S) {
189
- x[n(354)](1 * 821 + -660 + -1 * -242)[n(359)]({ error: i[n(385)], details: S[n(311)] });
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 });
190
201
  }
191
- }, $ = (e, a, x = { expiresIn: "30 days", algorithm: "HS256" }) => M[I(316)](e, a, x), x0 = (e, a) => M[I(376)](e, a), Y = (e) => ({ ip: e.headers["x-forwarded-for"] || e.ip || "", userAgent: e.headers[I(358)] || "", acceptLanguage: e[I(330)][I(378)] || "", referer: e[I(330)][I(320)] || "" }), e0 = () => {
192
- const e = I, a = { MumfE: "close", MbjmQ: e(321), LnLIi: e(377), aTTmj: function(r, c) {
193
- return r(c);
194
- }, DcJAO: e(356), EoEBV: e(380), daZeK: "mcp-proxy-server", ehpra: e(363), JGjws: function(r, c) {
195
- return r === c;
196
- }, PBzet: e(351), AQrVD: function(r, c, t) {
197
- return r(c, t);
198
- }, cxhYJ: function(r, c) {
199
- return r === c;
200
- }, EomGT: e(325), SZoau: function(r, c) {
201
- return r === c;
202
- }, NTflE: "DELETE", VstVe: function(r, c, t) {
203
- return r(c, t);
204
- }, IRQUp: e(362), rHMQM: e(314), VzFAj: e(345), BGWyo: e(323), mnfxr: "Invalid or missing session ID", Xarej: e(336), NKfhY: function(r, c) {
205
- return r(c);
206
- }, JKnQL: e(364), NZyuD: e(361), ZinNN: function(r, c) {
207
- return r(c);
208
- }, bmbQY: e(340), KqVMP: e(313) }, x = {}, s = {}, n = async (r, c, t) => {
209
- const o = e, d = new N(t, c), f = d[o(365)];
210
- x[f] = d, r.on(a.MumfE, () => {
211
- d[o(332)](), delete x[f], delete s[f];
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];
212
215
  });
213
- const p = { prompts: {}, resources: {}, tools: {}, logging: {} }, u = new V({ name: a[o(346)], version: a[o(370)] }, { capabilities: p });
214
- s[f] = { client: u, user: r[o(317)], device: a[o(318)](Y, r), type: a.DcJAO }, await u[o(349)](d);
215
- }, i = async (r, c, t) => {
216
- var T;
217
- const o = e, d = r[o(328)][o(365)], f = (T = s[d]) == null ? void 0 : T.client;
218
- if (!f) {
219
- c[o(354)](-543 * -17 + 1 * 3587 + -2 * 6209).send(a[o(372)]);
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);
220
223
  return;
221
224
  }
222
- const p = new G(t, c, f), u = p[o(365)];
223
- x[u] = p, r.on(a[o(374)], () => {
224
- p[o(332)](), delete x[u];
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];
225
228
  });
226
- const m = { prompts: {}, resources: {}, tools: {}, logging: {} };
227
- await new D({ name: a[o(368)], version: "1.0.0" }, { capabilities: m })[o(349)](p);
228
- }, l = async (r, c) => {
229
- const t = e, o = r[t(328)][t(365)], d = x[o];
230
- d ? await d[t(353)](r, c) : c[t(354)](1 * -6898 + 1 * 2494 + 4804)[t(350)](a[t(344)]);
231
- }, b = async (r, c) => {
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) => {
232
235
  const t = e;
233
- a[t(371)](r[t(341)], a[t(366)]) ? await a.AQrVD(R, r, c) : a[t(335)](r.method, a[t(357)]) || a[t(355)](r[t(341)], a[t(352)]) ? await a.VstVe(O, r, c) : await S(c);
234
- }, S = async (r) => {
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) => {
235
238
  const c = e;
236
- r[c(319)](906 * -7 + -5628 + 2475 * 5, { Allow: a[c(331)] })[c(333)](JSON[c(338)]({ jsonrpc: a.rHMQM, error: { code: -32e3, message: a.VzFAj }, id: null }));
237
- }, O = async (r, c) => {
238
- const t = e, o = r[t(330)][a[t(373)]], d = x[o];
239
- d ? (await d[t(388)](r, c), r[t(341)] === a.NTflE && (delete x[o], delete s[o])) : c[t(354)](1765 * 3 + -8 * 29 + -4663)[t(350)](a.mnfxr);
240
- }, R = async (r, c) => {
241
- const t = e, o = r[t(330)][a.BGWyo], d = r[t(330)][a[t(369)]];
242
- let f = x[o];
243
- if (f) await f[t(388)](r, c, r[t(386)]);
244
- else if (!o && a[t(315)](L, r.body)) {
245
- f = new P({ sessionIdGenerator: () => d });
246
- const p = { prompts: {}, resources: {}, tools: {}, logging: {} }, u = new V({ name: a.MbjmQ, version: a[t(370)] }, { capabilities: p });
247
- u[t(379)][t(360)](a[t(339)], () => {
248
- }), u[t(324)][t(360)](a[t(391)], (m) => ({ protocolVersion: m[t(382)][t(389)], capabilities: m[t(382)].capabilities, serverInfo: { name: t(327), version: t(377) } })), s[d] = { client: u, user: r[t(317)], device: a.ZinNN(Y, r), type: a[t(343)] }, x[d] = f, f[t(365)] = d, await u.connect(f), await f[t(388)](r, c, r[t(386)]);
249
- } else c[t(354)](10343 + 1 * -9943)[t(359)]({ jsonrpc: a[t(337)], error: { code: -32e3, message: a[t(348)] }, id: null });
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 });
250
253
  };
251
- return { handleSseProxy: n, handleSseInspector: i, handleSseMessage: l, handleStreamRequest: b, handleStreamInspector: async (r, c) => {
252
- var m;
253
- const t = e, o = r[t(328)][t(365)], d = (m = s[o]) == null ? void 0 : m[t(329)];
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)];
254
257
  if (!d) {
255
- c[t(354)](3059 + -137 * 39 + -22 * -122).send(a[t(372)]);
258
+ c[t(441)](-8 * -500 + -4 * -599 + -5996)[t(444)](a[t(436)]);
256
259
  return;
257
260
  }
258
- const f = new Z({ sessionIdGenerator: void 0 }, d), p = { prompts: {}, resources: {}, tools: {}, logging: {} }, u = new D({ name: a[t(368)], version: a[t(370)] }, { capabilities: p });
259
- await u.connect(f), await f[t(388)](r, c, r.body), c.on(a[t(374)], () => {
260
- f.close(), u.close();
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)]();
261
265
  });
262
266
  }, clients: s };
263
267
  };
264
268
  export {
265
- F as auth,
266
- $ as signToken,
267
- e0 as useProxyHandles,
268
- x0 as verifyToken
269
+ N as auth,
270
+ U as signToken,
271
+ $ as useProxyHandles,
272
+ Z as verifyToken
269
273
  };