@wso2/am-core-ui 0.0.19 → 0.0.20

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 (51) hide show
  1. package/dist/CatalogKindListing-DvUuZEpc.js +137 -0
  2. package/dist/{CodeBlock-mB_Loq7I.js → CodeBlock-B2Ecl916.js} +1 -1
  3. package/dist/EnvironmentCard-CIXhDhlZ.js +319 -0
  4. package/dist/{EnvironmentSelector-B7Bl93s2.js → EnvironmentSelector-D8S6nO9u.js} +1 -1
  5. package/dist/IsolationTierIndicator-cf90kgjL.js +81 -0
  6. package/dist/LabelChips-7rA7_yre.js +139 -0
  7. package/dist/PolicyListSection-D6aVSKwP.js +1143 -0
  8. package/dist/{ResourceListShell-Cx6mdeqv.js → ResourceListShell-DFisKftq.js} +1 -1
  9. package/dist/{SwaggerSpecViewer-BvkhoKsi.js → SwaggerSpecViewer-DzjR6U6W.js} +1 -1
  10. package/dist/{debounce-BV83M53b.js → debounce-D17ObVdG.js} +1 -1
  11. package/dist/{format-BEZZRyE2.js → format-wlHhWjGo.js} +1 -1
  12. package/dist/{formatDistanceToNow-TErllcH8.js → formatDistanceToNow-DyjnT7l9.js} +11 -11
  13. package/dist/{gatewayScripts-D8O45W8u.js → gatewayScripts-D4ZDEDPS.js} +1 -1
  14. package/dist/{index-sr-mWz4T.js → index-3K-zqdp-.js} +32 -32
  15. package/dist/{index-KRsV2L4V.js → index-6liAPSDn.js} +160 -160
  16. package/dist/{index-B52h3RHg.js → index-B3ASENUJ.js} +109 -109
  17. package/dist/index-B7Pf4oPq.js +3069 -0
  18. package/dist/index-BNO3FhZK.js +2304 -0
  19. package/dist/index-BUZSfCl5.js +335 -0
  20. package/dist/index-BXiG1r_o.js +1409 -0
  21. package/dist/{index-_0Pj_ZtW.js → index-BYy7Iaam.js} +40 -40
  22. package/dist/{index-BfjzUWDa.js → index-BbB_yx4V.js} +103 -103
  23. package/dist/index-BjWJ95lH.js +2728 -0
  24. package/dist/{index-B_Z0MwXk.js → index-ByEInFlf.js} +10916 -9520
  25. package/dist/index-C8WIhzyz.js +123 -0
  26. package/dist/index-CnzvaT6b.js +2368 -0
  27. package/dist/index-CrnCf-hJ.js +763 -0
  28. package/dist/{index-CgCWbWzN.js → index-Cvsho9xg.js} +381 -377
  29. package/dist/{index-UqDmyMSA.js → index-CxnAo1_c.js} +21 -21
  30. package/dist/{index-BnV-PkwM.js → index-Cz7-AZwE.js} +2 -2
  31. package/dist/{index-BP5drcF2.js → index-DBdRFjxm.js} +232 -233
  32. package/dist/{index-BZ4vxviI.js → index-DFsSvmMZ.js} +5 -5
  33. package/dist/index-DslzOSGN.js +2549 -0
  34. package/dist/{index-DD4qF7gq.js → index-DvpYvchM.js} +101 -100
  35. package/dist/index.d.ts +784 -163
  36. package/dist/index.js +532 -454
  37. package/dist/js-yaml-CvhD-clg.js +1335 -0
  38. package/dist/{llmProviderPayload-CzihkdNa.js → llmProviderPayload-BPzWDy7n.js} +2 -2
  39. package/package.json +1 -1
  40. package/dist/CatalogKindListing-DtFI2YMG.js +0 -118
  41. package/dist/EnvironmentCard-09h1XRxx.js +0 -310
  42. package/dist/PolicyListSection-o4k9e8XO.js +0 -2475
  43. package/dist/index-CGDYgUCH.js +0 -711
  44. package/dist/index-COt7nJIf.js +0 -2286
  45. package/dist/index-CWZjOy1h.js +0 -2247
  46. package/dist/index-CezvogTQ.js +0 -116
  47. package/dist/index-CjCkcuuI.js +0 -322
  48. package/dist/index-CjXvuf9m.js +0 -1354
  49. package/dist/index-DeQ-9KTC.js +0 -737
  50. package/dist/index-Df6OBy4E.js +0 -3041
  51. package/dist/index-PUuASE1F.js +0 -2507
@@ -1,2507 +0,0 @@
1
- import { jsx as n, jsxs as l, Fragment as at } from "react/jsx-runtime";
2
- import { c as Ve } from "react/compiler-runtime";
3
- import { useNavigate as Mt, useParams as ut, generatePath as ct, Link as mn, Routes as pn, Route as mt, Navigate as fn } from "react-router-dom";
4
- import { bo as gn, ar as Bt, bp as yn, z as Ot, g as dt, P as Dt, $ as vn, bq as bn, G as xn, br as _t, bs as Ft, ak as Cn } from "./index-B_Z0MwXk.js";
5
- import { useState as T, useCallback as j, useEffect as nt, useRef as ht, useMemo as Q } from "react";
6
- import "@tanstack/react-query";
7
- import { Stack as I, Typography as z, Chip as Te, AccordionSummary as yt, Accordion as vt, AccordionDetails as bt, Dialog as Ht, DialogTitle as Ut, DialogContent as $t, Form as Fe, FormControl as oe, FormLabel as le, TextField as $, Tooltip as He, InputAdornment as jt, IconButton as lt, Autocomplete as Pn, Collapse as et, Divider as zt, DialogActions as qt, Button as Z, Box as ie, CircularProgress as Nt, ListingTable as be, Avatar as Yt, Alert as ot, useTheme as In, Grid as X, Skeleton as Ce, Card as Ne, Switch as Sn, Select as At, MenuItem as ft, Tabs as kn, Tab as En, PageContent as xt } from "@wso2/oxygen-ui";
8
- import { ChevronDown as tt, HelpCircle as Gt, EyeOff as Jt, Eye as Xt, Lock as An, Edit as Zt, Trash2 as wn, Plus as Tt, Trash as Rt, ChevronUp as gt, AlertTriangle as Mn, Clock as _n, Settings as zn } from "@wso2/oxygen-ui-icons-react";
9
- import { M as Qt } from "./MCPLogo-D9IJzzl7.js";
10
- import { g as en, f as tn, n as Nn } from "./format-BEZZRyE2.js";
11
- import { R as Tn, A as Rn } from "./ResourceListShell-Cx6mdeqv.js";
12
- import { P as Ln } from "./PolicyListSection-o4k9e8XO.js";
13
- function nn(t, e = {}) {
14
- const {
15
- requiredMessage: r = "URL is required",
16
- invalidMessage: s = "Please enter a valid URL",
17
- protocolMessage: d = "URL must use http or https"
18
- } = e, a = t.trim();
19
- if (!a) return r;
20
- try {
21
- const o = new URL(a);
22
- if (!["http:", "https:"].includes(o.protocol))
23
- return d;
24
- } catch {
25
- return s;
26
- }
27
- return null;
28
- }
29
- function rn(t) {
30
- const e = Ve(19), {
31
- tools: r,
32
- resources: s,
33
- prompts: d,
34
- sectionTitleVariant: a
35
- } = t;
36
- let o;
37
- e[0] !== r ? (o = r === void 0 ? [] : r, e[0] = r, e[1] = o) : o = e[1];
38
- const i = o;
39
- let c;
40
- e[2] !== s ? (c = s === void 0 ? [] : s, e[2] = s, e[3] = c) : c = e[3];
41
- const g = c;
42
- let p;
43
- e[4] !== d ? (p = d === void 0 ? [] : d, e[4] = d, e[5] = p) : p = e[5];
44
- const y = p, u = a === void 0 ? "subtitle1" : a;
45
- let m;
46
- e[6] !== u || e[7] !== i ? (m = /* @__PURE__ */ n(Ct, { title: "Tools", items: i, titleVariant: u }), e[6] = u, e[7] = i, e[8] = m) : m = e[8];
47
- let f;
48
- e[9] !== g || e[10] !== u ? (f = /* @__PURE__ */ n(Ct, { title: "Resources", items: g, titleVariant: u }), e[9] = g, e[10] = u, e[11] = f) : f = e[11];
49
- let v;
50
- e[12] !== y || e[13] !== u ? (v = /* @__PURE__ */ n(Ct, { title: "Prompts", items: y, titleVariant: u }), e[12] = y, e[13] = u, e[14] = v) : v = e[14];
51
- let P;
52
- return e[15] !== v || e[16] !== m || e[17] !== f ? (P = /* @__PURE__ */ l(I, { spacing: 2, children: [
53
- m,
54
- f,
55
- v
56
- ] }), e[15] = v, e[16] = m, e[17] = f, e[18] = P) : P = e[18], P;
57
- }
58
- function Ct(t) {
59
- const e = Ve(27), {
60
- title: r,
61
- items: s,
62
- titleVariant: d
63
- } = t, [a, o] = T(!1), [i, c] = T("");
64
- let g;
65
- e[0] === Symbol.for("react.memo_cache_sentinel") ? (g = (A, x) => o(x), e[0] = g) : g = e[0];
66
- let p;
67
- e[1] === Symbol.for("react.memo_cache_sentinel") ? (p = /* @__PURE__ */ n(tt, { size: 18 }), e[1] = p) : p = e[1];
68
- let y;
69
- e[2] !== r || e[3] !== d ? (y = /* @__PURE__ */ n(z, { variant: d, fontWeight: 600, children: r }), e[2] = r, e[3] = d, e[4] = y) : y = e[4];
70
- const u = `Total: ${s.length}`;
71
- let m;
72
- e[5] !== u ? (m = /* @__PURE__ */ n(Te, { label: u, size: "small", variant: "outlined" }), e[5] = u, e[6] = m) : m = e[6];
73
- let f;
74
- e[7] !== y || e[8] !== m ? (f = /* @__PURE__ */ n(yt, { expandIcon: p, children: /* @__PURE__ */ l(I, { direction: "row", spacing: 1, alignItems: "center", children: [
75
- y,
76
- m
77
- ] }) }), e[7] = y, e[8] = m, e[9] = f) : f = e[9];
78
- let v;
79
- e[10] !== s.length || e[11] !== r ? (v = s.length === 0 ? /* @__PURE__ */ l(z, { variant: "body2", color: "text.secondary", children: [
80
- "No ",
81
- r.toLowerCase(),
82
- " found."
83
- ] }) : null, e[10] = s.length, e[11] = r, e[12] = v) : v = e[12];
84
- let P;
85
- if (e[13] !== i || e[14] !== s || e[15] !== r) {
86
- let A;
87
- e[17] !== i || e[18] !== r ? (A = (x, k) => {
88
- const _ = Vn(x) ?? `${r.slice(0, -1)} ${k + 1}`, w = `${_}-${k}`;
89
- return /* @__PURE__ */ l(vt, { expanded: i === w, onChange: (h, b) => c(b ? w : ""), disableGutters: !0, variant: "outlined", children: [
90
- /* @__PURE__ */ n(yt, { expandIcon: /* @__PURE__ */ n(tt, { size: 16 }), children: /* @__PURE__ */ n(z, { variant: "subtitle2", fontWeight: 600, children: _ }) }),
91
- /* @__PURE__ */ n(bt, { children: /* @__PURE__ */ n(Wn, { item: x }) })
92
- ] }, w);
93
- }, e[17] = i, e[18] = r, e[19] = A) : A = e[19], P = s.map(A), e[13] = i, e[14] = s, e[15] = r, e[16] = P;
94
- } else
95
- P = e[16];
96
- let N;
97
- e[20] !== v || e[21] !== P ? (N = /* @__PURE__ */ n(bt, { children: /* @__PURE__ */ l(I, { spacing: 1, children: [
98
- v,
99
- P
100
- ] }) }), e[20] = v, e[21] = P, e[22] = N) : N = e[22];
101
- let M;
102
- return e[23] !== a || e[24] !== f || e[25] !== N ? (M = /* @__PURE__ */ l(vt, { expanded: a, onChange: g, disableGutters: !0, children: [
103
- f,
104
- N
105
- ] }), e[23] = a, e[24] = f, e[25] = N, e[26] = M) : M = e[26], M;
106
- }
107
- function Wn(t) {
108
- const e = Ve(5), {
109
- item: r
110
- } = t;
111
- let s;
112
- e[0] !== r ? (s = Kn(r) ?? Bn(r), e[0] = r, e[1] = s) : s = e[1];
113
- const d = s;
114
- if (d) {
115
- let o;
116
- return e[2] !== d ? (o = /* @__PURE__ */ n(z, { variant: "body2", color: "text.secondary", children: d }), e[2] = d, e[3] = o) : o = e[3], o;
117
- }
118
- let a;
119
- return e[4] === Symbol.for("react.memo_cache_sentinel") ? (a = /* @__PURE__ */ n(z, { variant: "body2", color: "text.secondary", children: "-" }), e[4] = a) : a = e[4], a;
120
- }
121
- function Vn(t) {
122
- if (!t) return;
123
- const e = t.name ?? t.title ?? t.uri ?? t.id;
124
- if (typeof e != "string") return;
125
- const r = e.trim();
126
- return r || void 0;
127
- }
128
- function Kn(t) {
129
- if (!t) return;
130
- const e = t.description;
131
- return typeof e == "string" && e.trim() ? e : void 0;
132
- }
133
- function Bn(t) {
134
- if (!t) return;
135
- const e = t.uri;
136
- return typeof e == "string" && e.trim() ? e : void 0;
137
- }
138
- const On = "••••••••••••";
139
- function on({
140
- open: t,
141
- orgId: e,
142
- availableEnvironments: r,
143
- onClose: s,
144
- onAdd: d,
145
- initialDraft: a
146
- }) {
147
- const o = gn(), {
148
- pushSnackBar: i
149
- } = Bt(), c = !!a, [g, p] = T(""), [y, u] = T(""), [m, f] = T(""), [v, P] = T(!1), [N, M] = T(!1), [A, x] = T(!1), [k, _] = T([]), [w, h] = T(null), [b, R] = T(null), [L, C] = T(null), V = j(() => {
150
- if (a) {
151
- const B = !!a.authHeader;
152
- p(a.url), u(a.authHeader), f(B ? On : ""), P(B), x(B), _(a.environments), h(a.fetchedInfo);
153
- } else
154
- p(""), u(""), f(""), P(!1), x(!1), _([]), h(null);
155
- M(!1), R(null), C(null);
156
- }, [a]);
157
- nt(() => {
158
- t && V();
159
- }, [t, V]);
160
- const F = g.trim(), S = !!w, E = o.isPending, K = S && k.length > 0, W = !a || F !== a.url || y.trim() !== a.authHeader || !v && m.trim().length > 0 || !Dn(k, a.environments) || Fn(w, a.fetchedInfo), H = K && W, D = j(() => {
161
- h(null);
162
- }, []), G = j(async () => {
163
- const B = nn(F, {
164
- requiredMessage: "Enter a valid MCP Proxy endpoint URL.",
165
- invalidMessage: "Enter a valid MCP Proxy endpoint URL.",
166
- protocolMessage: "Enter a valid MCP Proxy endpoint URL."
167
- });
168
- if (B) {
169
- R(B);
170
- return;
171
- }
172
- R(null);
173
- const Y = y.trim();
174
- if (Y && v) {
175
- P(!1), f(""), x(!0), C("Re-enter the authentication value to re-fetch server info.");
176
- return;
177
- }
178
- const J = m.trim();
179
- if (!!Y != !!J) {
180
- x(!0), C("Enter both an authentication header and value.");
181
- return;
182
- }
183
- C(null);
184
- const xe = Y && J ? {
185
- url: F,
186
- auth: {
187
- type: "api-key",
188
- header: Y,
189
- value: J
190
- }
191
- } : {
192
- url: F
193
- };
194
- try {
195
- const re = await o.mutateAsync({
196
- params: {
197
- orgName: e
198
- },
199
- body: xe
200
- });
201
- h(re);
202
- } catch (re) {
203
- if (h(null), typeof re == "object" && re !== null && re.code === "UNAUTHORIZED")
204
- x(!0), C("This server requires authentication. Enter the credentials above.");
205
- else {
206
- const Pe = re instanceof Error ? re.message : "Failed to fetch MCP server info. Please check the URL and try again.";
207
- i({
208
- message: Pe,
209
- type: "error"
210
- });
211
- }
212
- }
213
- }, [y, m, o, e, i, F]), te = j(() => {
214
- if (!w || k.length === 0) return;
215
- const B = v ? "" : m.trim();
216
- d({
217
- url: F,
218
- authHeader: y.trim(),
219
- authValue: B,
220
- environments: k,
221
- fetchedInfo: w,
222
- serverName: pt(w.serverInfo, "name") ?? a?.serverName,
223
- serverVersion: pt(w.serverInfo, "version") ?? a?.serverVersion
224
- }), V();
225
- }, [y, m, w, a, v, d, V, k, F]), ne = j(() => {
226
- E || (V(), s());
227
- }, [E, s, V]), ce = w ? pt(w.serverInfo, "name") : void 0, q = w ? pt(w.serverInfo, "version") : void 0;
228
- return /* @__PURE__ */ l(Ht, { open: t, onClose: ne, maxWidth: "md", fullWidth: !0, children: [
229
- /* @__PURE__ */ n(Ut, { children: c ? "Edit Endpoint" : "Add Endpoint" }),
230
- /* @__PURE__ */ n($t, { children: /* @__PURE__ */ l(Fe.Stack, { spacing: 2.5, sx: {
231
- mt: 1
232
- }, children: [
233
- /* @__PURE__ */ n(z, { variant: "body2", color: "text.secondary", children: "Point to your MCP server, fetch its capabilities, and choose the environments this endpoint serves." }),
234
- /* @__PURE__ */ l(oe, { fullWidth: !0, error: !!b, children: [
235
- /* @__PURE__ */ n(le, { required: !0, children: "MCP Proxy Endpoint URL" }),
236
- /* @__PURE__ */ n($, { fullWidth: !0, value: g, onChange: (B) => {
237
- p(B.target.value), D(), R(null);
238
- }, placeholder: "Enter URL of your MCP Proxy", error: !!b, helperText: b })
239
- ] }),
240
- /* @__PURE__ */ l(vt, { expanded: A, onChange: (B, Y) => x(Y), disableGutters: !0, variant: "outlined", children: [
241
- /* @__PURE__ */ n(yt, { expandIcon: /* @__PURE__ */ n(tt, { size: 18 }), children: /* @__PURE__ */ l(I, { direction: "row", alignItems: "center", spacing: 1, children: [
242
- /* @__PURE__ */ n(z, { variant: "subtitle2", fontWeight: 600, children: "Advanced Configurations" }),
243
- /* @__PURE__ */ n(He, { title: "Configure an optional authentication header sent to the MCP server.", children: /* @__PURE__ */ n(Gt, { size: 16 }) })
244
- ] }) }),
245
- /* @__PURE__ */ n(bt, { children: /* @__PURE__ */ l(Fe.Stack, { spacing: 2, children: [
246
- /* @__PURE__ */ n(z, { variant: "subtitle2", fontWeight: 600, children: "Configure Authentication Header" }),
247
- /* @__PURE__ */ l(Fe.Stack, { direction: {
248
- xs: "column",
249
- md: "row"
250
- }, spacing: 2, useFlexGap: !0, children: [
251
- /* @__PURE__ */ l(oe, { sx: {
252
- flex: 1
253
- }, error: !!L, children: [
254
- /* @__PURE__ */ n(le, { children: "Header" }),
255
- /* @__PURE__ */ n($, { fullWidth: !0, value: y, onChange: (B) => {
256
- u(B.target.value), D(), C(null);
257
- }, placeholder: "Header", error: !!L })
258
- ] }),
259
- /* @__PURE__ */ l(oe, { sx: {
260
- flex: 1
261
- }, error: !!L, children: [
262
- /* @__PURE__ */ n(le, { children: "Value" }),
263
- /* @__PURE__ */ n($, { fullWidth: !0, value: m, onFocus: () => {
264
- v && (f(""), P(!1), D());
265
- }, onChange: (B) => {
266
- f(B.target.value), P(!1), D(), C(null);
267
- }, placeholder: "Value", error: !!L, helperText: L ?? (v ? "Leave unchanged to keep the stored value." : void 0), type: N ? "text" : "password", slotProps: {
268
- input: {
269
- endAdornment: /* @__PURE__ */ n(jt, { position: "end", children: /* @__PURE__ */ n(lt, { "aria-label": N ? "Hide header value" : "Show header value", onClick: () => M((B) => !B), edge: "end", children: N ? /* @__PURE__ */ n(Jt, { size: 18 }) : /* @__PURE__ */ n(Xt, { size: 18 }) }) })
270
- }
271
- } })
272
- ] })
273
- ] })
274
- ] }) })
275
- ] }),
276
- /* @__PURE__ */ l(oe, { fullWidth: !0, children: [
277
- /* @__PURE__ */ n(le, { required: !0, children: "Environments" }),
278
- /* @__PURE__ */ n(Pn, { multiple: !0, options: r, size: "small", value: r.filter((B) => B.id != null && k.includes(B.id)), onChange: (B, Y) => _(Y.map((J) => J.id).filter((J) => !!J)), getOptionLabel: (B) => B.displayName || B.name, isOptionEqualToValue: (B, Y) => B.id === Y.id, renderInput: (B) => /* @__PURE__ */ n($, { ...B, placeholder: r.length === 0 ? "All environments are already assigned" : "Select environment(s)" }), disabled: r.length === 0, sx: {
279
- mt: 0.5
280
- } }),
281
- /* @__PURE__ */ n(z, { variant: "caption", color: "text.secondary", sx: {
282
- mt: 0.5
283
- }, children: "An environment can be assigned to only one endpoint." })
284
- ] }),
285
- /* @__PURE__ */ n(et, { in: S, timeout: "auto", unmountOnExit: !0, children: w ? /* @__PURE__ */ l(I, { spacing: 2, children: [
286
- /* @__PURE__ */ n(zt, {}),
287
- /* @__PURE__ */ l(I, { direction: "row", spacing: 1, alignItems: "center", children: [
288
- /* @__PURE__ */ n(z, { variant: "h6", fontWeight: 600, children: ce || "MCP Server" }),
289
- q ? /* @__PURE__ */ n(Te, { label: q.startsWith("v") ? q : `v${q}`, size: "small", variant: "outlined" }) : null
290
- ] }),
291
- /* @__PURE__ */ n(rn, { tools: w.tools, resources: w.resources, prompts: w.prompts })
292
- ] }) : null })
293
- ] }) }),
294
- /* @__PURE__ */ l(qt, { children: [
295
- /* @__PURE__ */ n(Z, { variant: "outlined", onClick: ne, disabled: E, children: "Cancel" }),
296
- /* @__PURE__ */ n(Z, { variant: "outlined", onClick: G, disabled: !F || E, startIcon: E ? /* @__PURE__ */ n(ie, { component: "span", sx: {
297
- display: "inline-flex"
298
- }, children: /* @__PURE__ */ n(Nt, { size: 16, color: "inherit" }) }) : void 0, children: E ? "Fetching" : S ? "Re-fetch Server Info" : "Fetch Server Info" }),
299
- /* @__PURE__ */ n(Z, { variant: "contained", onClick: te, disabled: !H || E, children: c ? "Save" : "Add" })
300
- ] })
301
- ] });
302
- }
303
- function pt(t, e) {
304
- const r = t?.[e];
305
- return typeof r == "string" ? r : void 0;
306
- }
307
- function Dn(t, e) {
308
- if (t.length !== e.length) return !1;
309
- const r = new Set(e);
310
- return t.every((s) => r.has(s));
311
- }
312
- function Fn(t, e) {
313
- return t ? JSON.stringify(t.tools ?? []) !== JSON.stringify(e.tools ?? []) || JSON.stringify(t.resources ?? []) !== JSON.stringify(e.resources ?? []) || JSON.stringify(t.prompts ?? []) !== JSON.stringify(e.prompts ?? []) : !1;
314
- }
315
- function sn(t) {
316
- const e = Ve(42), {
317
- endpoint: r,
318
- environmentLabels: s,
319
- onRemove: d,
320
- onEdit: a
321
- } = t, o = r.fetchedInfo.tools?.length ?? 0, i = r.fetchedInfo.resources?.length ?? 0, c = r.fetchedInfo.prompts?.length ?? 0, g = !!r.authHeader;
322
- let p;
323
- e[0] === Symbol.for("react.memo_cache_sentinel") ? (p = {
324
- border: "1px solid",
325
- borderColor: "divider",
326
- borderRadius: 1,
327
- p: 2
328
- }, e[0] = p) : p = e[0];
329
- let y;
330
- e[1] === Symbol.for("react.memo_cache_sentinel") ? (y = {
331
- minWidth: 0,
332
- flex: 1
333
- }, e[1] = y) : y = e[1];
334
- let u;
335
- if (e[2] !== r.environments || e[3] !== s) {
336
- let L;
337
- e[5] !== s ? (L = (C) => /* @__PURE__ */ n(Te, { label: s.get(C) || C, size: "small", color: "primary", variant: "outlined" }, C), e[5] = s, e[6] = L) : L = e[6], u = r.environments.map(L), e[2] = r.environments, e[3] = s, e[4] = u;
338
- } else
339
- u = e[4];
340
- let m;
341
- e[7] !== r.authHeader || e[8] !== g ? (m = g ? /* @__PURE__ */ n(He, { title: `Authenticated via ${r.authHeader}`, children: /* @__PURE__ */ n(Te, { icon: /* @__PURE__ */ n(An, { size: 12 }), label: "Auth", size: "small", variant: "outlined" }) }) : null, e[7] = r.authHeader, e[8] = g, e[9] = m) : m = e[9];
342
- let f;
343
- e[10] !== u || e[11] !== m ? (f = /* @__PURE__ */ l(I, { direction: "row", spacing: 1, alignItems: "center", flexWrap: "wrap", children: [
344
- u,
345
- m
346
- ] }), e[10] = u, e[11] = m, e[12] = f) : f = e[12];
347
- let v;
348
- e[13] === Symbol.for("react.memo_cache_sentinel") ? (v = {
349
- wordBreak: "break-all",
350
- fontFamily: "monospace"
351
- }, e[13] = v) : v = e[13];
352
- let P;
353
- e[14] !== r.url ? (P = /* @__PURE__ */ n(z, { variant: "body2", sx: v, children: r.url }), e[14] = r.url, e[15] = P) : P = e[15];
354
- let N;
355
- e[16] === Symbol.for("react.memo_cache_sentinel") ? (N = /* @__PURE__ */ n(zt, { flexItem: !0 }), e[16] = N) : N = e[16];
356
- let M;
357
- e[17] !== r.serverName || e[18] !== r.serverVersion ? (M = r.serverName ? /* @__PURE__ */ l(z, { variant: "caption", color: "text.secondary", children: [
358
- r.serverName,
359
- r.serverVersion ? ` · ${r.serverVersion}` : ""
360
- ] }) : null, e[17] = r.serverName, e[18] = r.serverVersion, e[19] = M) : M = e[19];
361
- let A;
362
- e[20] !== c || e[21] !== i || e[22] !== o ? (A = /* @__PURE__ */ l(z, { variant: "caption", color: "text.secondary", children: [
363
- o,
364
- " tools · ",
365
- i,
366
- " resources · ",
367
- c,
368
- " ",
369
- "prompts"
370
- ] }), e[20] = c, e[21] = i, e[22] = o, e[23] = A) : A = e[23];
371
- let x;
372
- e[24] !== A || e[25] !== M ? (x = /* @__PURE__ */ l(I, { direction: "row", spacing: 2, alignItems: "center", children: [
373
- M,
374
- A
375
- ] }), e[24] = A, e[25] = M, e[26] = x) : x = e[26];
376
- let k;
377
- e[27] !== x || e[28] !== f || e[29] !== P ? (k = /* @__PURE__ */ l(I, { spacing: 1, sx: y, children: [
378
- f,
379
- P,
380
- N,
381
- x
382
- ] }), e[27] = x, e[28] = f, e[29] = P, e[30] = k) : k = e[30];
383
- let _;
384
- e[31] !== a ? (_ = a ? /* @__PURE__ */ n(He, { title: "Edit endpoint", children: /* @__PURE__ */ n(lt, { size: "small", onClick: a, "aria-label": "Edit endpoint", children: /* @__PURE__ */ n(Zt, { size: 16 }) }) }) : null, e[31] = a, e[32] = _) : _ = e[32];
385
- let w;
386
- e[33] === Symbol.for("react.memo_cache_sentinel") ? (w = /* @__PURE__ */ n(wn, { size: 16 }), e[33] = w) : w = e[33];
387
- let h;
388
- e[34] !== d ? (h = /* @__PURE__ */ n(He, { title: "Remove endpoint", children: /* @__PURE__ */ n(lt, { size: "small", onClick: d, "aria-label": "Remove endpoint", children: w }) }), e[34] = d, e[35] = h) : h = e[35];
389
- let b;
390
- e[36] !== _ || e[37] !== h ? (b = /* @__PURE__ */ l(I, { direction: "row", spacing: 0.5, children: [
391
- _,
392
- h
393
- ] }), e[36] = _, e[37] = h, e[38] = b) : b = e[38];
394
- let R;
395
- return e[39] !== k || e[40] !== b ? (R = /* @__PURE__ */ n(ie, { sx: p, children: /* @__PURE__ */ l(I, { direction: "row", spacing: 2, alignItems: "flex-start", justifyContent: "space-between", children: [
396
- k,
397
- b
398
- ] }) }), e[39] = k, e[40] = b, e[41] = R) : R = e[41], R;
399
- }
400
- const Qe = "mcp-acl-list", Hn = "mcp-auth", Un = "mcp-authz", Ze = "mcp-rewrite", $n = [Qe, Hn, Un, Ze], jn = "2025-06-18", an = {
401
- enabled: !0,
402
- apiKey: {
403
- enabled: !0,
404
- key: "X-API-Key",
405
- in: "header"
406
- }
407
- };
408
- function ln(t, e) {
409
- if (!e) return null;
410
- const r = t === "resource" ? e.uri ?? e.name : e.name ?? e.uri;
411
- if (typeof r != "string") return null;
412
- const s = r.trim();
413
- return s.length ? s : null;
414
- }
415
- function Pt(t, e) {
416
- const r = /* @__PURE__ */ new Set();
417
- return (e ?? []).forEach((s) => {
418
- const d = ln(t, s);
419
- d && r.add(d);
420
- }), r;
421
- }
422
- function qn(t, e) {
423
- const r = typeof e.target == "string" && e.target.trim() ? e.target.trim() : null;
424
- return r || ln(t, e);
425
- }
426
- function Yn(t) {
427
- return {
428
- tools: t?.tools ?? [],
429
- resources: t?.resources ?? [],
430
- prompts: t?.prompts ?? []
431
- };
432
- }
433
- function Gn(t) {
434
- const e = /* @__PURE__ */ new Map();
435
- let r = 1;
436
- for (const [s, d] of Object.entries(t ?? {})) {
437
- const a = d.upstream?.url ?? "", o = d.upstream?.auth?.header ?? "", i = `${a}\0${o}`, c = e.get(i);
438
- if (c) {
439
- c.environments.push(s);
440
- continue;
441
- }
442
- e.set(i, {
443
- id: String(r++),
444
- url: a,
445
- authHeader: o,
446
- authValue: "",
447
- environments: [s],
448
- fetchedInfo: Yn(d.capabilities)
449
- });
450
- }
451
- return Array.from(e.values());
452
- }
453
- function Jn(t) {
454
- const e = t.authHeader.trim();
455
- if (!e) return;
456
- const r = t.authValue.trim();
457
- return r ? {
458
- type: "api-key",
459
- header: e,
460
- value: r
461
- } : {
462
- type: "api-key",
463
- header: e
464
- };
465
- }
466
- function Xn(t, e) {
467
- if (!t || t.length === 0) return t;
468
- const r = {
469
- tool: Pt("tool", e?.tools),
470
- resource: Pt("resource", e?.resources),
471
- prompt: Pt("prompt", e?.prompts)
472
- }, s = {
473
- tool: "tools",
474
- resource: "resources",
475
- prompt: "prompts"
476
- }, d = ["tool", "resource", "prompt"], a = [];
477
- for (const o of t)
478
- if (o.name === Ze) {
479
- const i = Zn(o, r, s, d);
480
- i && a.push(i);
481
- } else if (o.name === Qe) {
482
- const i = Qn(o, r, s, d);
483
- i && a.push(i);
484
- } else
485
- a.push(o);
486
- return a.length > 0 ? a : void 0;
487
- }
488
- function Zn(t, e, r, s) {
489
- const d = t.params ?? {}, a = {
490
- ...d
491
- };
492
- let o = !1;
493
- for (const i of s) {
494
- const c = d[r[i]];
495
- if (!Array.isArray(c)) continue;
496
- const g = c.filter((p) => {
497
- const y = qn(i, p);
498
- return y != null && e[i].has(y);
499
- });
500
- g.length > 0 ? (a[r[i]] = g, o = !0) : delete a[r[i]];
501
- }
502
- return o ? {
503
- ...t,
504
- params: a
505
- } : null;
506
- }
507
- function Qn(t, e, r, s) {
508
- const d = t.params ?? {}, a = {
509
- ...d
510
- };
511
- let o = !1;
512
- for (const i of s) {
513
- const c = d[r[i]];
514
- if (!c) continue;
515
- if (e[i].size === 0) {
516
- delete a[r[i]];
517
- continue;
518
- }
519
- const g = Array.isArray(c.exceptions) ? c.exceptions.filter((p) => typeof p == "string" && e[i].has(p.trim())) : [];
520
- a[r[i]] = {
521
- ...c,
522
- exceptions: g
523
- }, o = !0;
524
- }
525
- return o ? {
526
- ...t,
527
- params: a
528
- } : null;
529
- }
530
- function ei(t, e) {
531
- const r = {};
532
- for (const s of t) {
533
- const d = Jn(s), a = {
534
- tools: s.fetchedInfo.tools,
535
- resources: s.fetchedInfo.resources,
536
- prompts: s.fetchedInfo.prompts
537
- };
538
- for (const o of s.environments) {
539
- const i = e[o];
540
- i ? r[o] = {
541
- ...i,
542
- upstream: {
543
- ...i.upstream,
544
- url: s.url,
545
- auth: d
546
- },
547
- capabilities: a,
548
- policies: Xn(i.policies, a)
549
- } : r[o] = {
550
- upstream: {
551
- url: s.url,
552
- auth: d
553
- },
554
- capabilities: a,
555
- security: an
556
- };
557
- }
558
- }
559
- return r;
560
- }
561
- function ti({
562
- onCancel: t
563
- }) {
564
- const e = Mt(), {
565
- orgId: r
566
- } = ut(), s = yn(), {
567
- data: d = []
568
- } = Ot({
569
- orgName: r ?? ""
570
- }), [a, o] = T(""), [i, c] = T(""), [g, p] = T(""), [y, u] = T(""), [m, f] = T([]), [v, P] = T(!1), N = ht(1), M = Q(() => {
571
- const C = /* @__PURE__ */ new Map();
572
- return d.forEach((V) => {
573
- V.id && C.set(V.id, V.displayName || V.name);
574
- }), C;
575
- }, [d]), A = Q(() => {
576
- const C = /* @__PURE__ */ new Set();
577
- return m.forEach((V) => {
578
- V.environments.forEach((F) => C.add(F));
579
- }), C;
580
- }, [m]), x = Q(() => d.filter((C) => !!C.id && !A.has(C.id)), [d, A]), k = s.isPending, _ = j((C) => {
581
- const V = a ? `/default/${a}` : "";
582
- o(C), (!y || y === V) && u(C ? `/default/${C}` : "");
583
- }, [y, a]), w = j((C) => {
584
- const V = String(N.current);
585
- N.current += 1, f((F) => [...F, {
586
- ...C,
587
- id: V
588
- }]), !a && C.serverName && (o(C.serverName), y || u(`/default/${C.serverName}`)), !i && C.serverVersion && c(C.serverVersion), P(!1);
589
- }, [y, a, i]), h = j((C) => {
590
- f((V) => V.filter((F) => F.id !== C));
591
- }, []), b = j(async () => {
592
- if (!r || m.length === 0) return;
593
- const C = a.trim(), V = Object.fromEntries(m.flatMap((S) => S.environments.map((E) => [E, {
594
- upstream: {
595
- url: S.url,
596
- auth: S.authHeader && S.authValue ? {
597
- type: "api-key",
598
- header: S.authHeader,
599
- value: S.authValue
600
- } : void 0
601
- },
602
- capabilities: {
603
- tools: S.fetchedInfo.tools,
604
- resources: S.fetchedInfo.resources,
605
- prompts: S.fetchedInfo.prompts
606
- },
607
- security: an
608
- }]))), F = {
609
- id: ni(C),
610
- name: C,
611
- version: i.trim(),
612
- description: g.trim() || void 0,
613
- context: y.trim() || void 0,
614
- mcpSpecVersion: jn,
615
- environments: V
616
- };
617
- await s.mutateAsync({
618
- params: {
619
- orgName: r
620
- },
621
- body: F
622
- }), e(ct(dt.children.org.children.mcpProxies.path, {
623
- orgId: r
624
- }));
625
- }, [s, m, e, r, y, g, a, i]), R = !!a.trim() && !!i.trim() && m.length > 0 && !k, L = d.length > 0 && x.length === 0;
626
- return /* @__PURE__ */ l(at, { children: [
627
- /* @__PURE__ */ l(I, { spacing: 3, sx: {
628
- maxWidth: 920
629
- }, children: [
630
- /* @__PURE__ */ n(Fe.Section, { children: /* @__PURE__ */ l(Fe.Stack, { spacing: 2, children: [
631
- /* @__PURE__ */ l(Fe.Stack, { direction: {
632
- xs: "column",
633
- md: "row"
634
- }, spacing: 2, useFlexGap: !0, children: [
635
- /* @__PURE__ */ l(oe, { sx: {
636
- flex: 1
637
- }, children: [
638
- /* @__PURE__ */ n(le, { required: !0, children: "Name" }),
639
- /* @__PURE__ */ n($, { fullWidth: !0, value: a, onChange: (C) => _(C.target.value) })
640
- ] }),
641
- /* @__PURE__ */ l(oe, { sx: {
642
- width: {
643
- xs: "100%",
644
- md: 300
645
- }
646
- }, children: [
647
- /* @__PURE__ */ n(le, { required: !0, children: "Version" }),
648
- /* @__PURE__ */ n($, { fullWidth: !0, value: i, onChange: (C) => c(C.target.value) })
649
- ] })
650
- ] }),
651
- /* @__PURE__ */ l(oe, { fullWidth: !0, children: [
652
- /* @__PURE__ */ n(le, { children: "Description" }),
653
- /* @__PURE__ */ n($, { fullWidth: !0, multiline: !0, minRows: 3, value: g, onChange: (C) => p(C.target.value), placeholder: "Primary MCP Proxy" })
654
- ] }),
655
- /* @__PURE__ */ l(oe, { fullWidth: !0, children: [
656
- /* @__PURE__ */ n(le, { children: "Context" }),
657
- /* @__PURE__ */ n($, { fullWidth: !0, value: y, onChange: (C) => u(C.target.value) })
658
- ] })
659
- ] }) }),
660
- /* @__PURE__ */ l(Fe.Section, { children: [
661
- /* @__PURE__ */ n(Fe.Header, { children: "Endpoints" }),
662
- /* @__PURE__ */ l(Fe.Stack, { spacing: 2, children: [
663
- /* @__PURE__ */ n(z, { variant: "body2", color: "text.secondary", children: "Add a backend endpoint and assign it to one or more environments. Environments without an endpoint are simply left unconfigured." }),
664
- m.length > 0 ? /* @__PURE__ */ n(I, { spacing: 1.5, children: m.map((C) => /* @__PURE__ */ n(sn, { endpoint: C, environmentLabels: M, onRemove: () => h(C.id) }, C.id)) }) : /* @__PURE__ */ n(ie, { sx: {
665
- border: "1px dashed",
666
- borderColor: "divider",
667
- borderRadius: 1,
668
- px: 2,
669
- py: 3,
670
- textAlign: "center"
671
- }, children: /* @__PURE__ */ n(z, { variant: "body2", color: "text.secondary", children: "No endpoints added yet." }) }),
672
- /* @__PURE__ */ n(ie, { children: /* @__PURE__ */ n(He, { title: L ? "All environments already have an endpoint." : "", disableHoverListener: !L, children: /* @__PURE__ */ n("span", { children: /* @__PURE__ */ n(Z, { variant: "outlined", startIcon: /* @__PURE__ */ n(Tt, { size: 16 }), onClick: () => P(!0), disabled: L || d.length === 0, children: "Add Endpoint" }) }) }) }),
673
- d.length > 0 ? /* @__PURE__ */ l(z, { variant: "caption", color: "text.secondary", children: [
674
- A.size,
675
- " of ",
676
- d.length,
677
- " environments have an endpoint."
678
- ] }) : null
679
- ] })
680
- ] }),
681
- /* @__PURE__ */ l(I, { direction: "row", spacing: 1, children: [
682
- /* @__PURE__ */ n(Z, { variant: "outlined", onClick: t, children: "Cancel" }),
683
- /* @__PURE__ */ n(Z, { variant: "contained", disabled: !R, onClick: b, startIcon: k ? /* @__PURE__ */ n(Nt, { size: 16, color: "inherit" }) : void 0, children: k ? "Creating" : "Create" })
684
- ] })
685
- ] }),
686
- /* @__PURE__ */ n(on, { open: v, orgId: r ?? "", availableEnvironments: x, onClose: () => P(!1), onAdd: w })
687
- ] });
688
- }
689
- function ni(t) {
690
- return t.trim().toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "") || "mcp-proxy";
691
- }
692
- const cn = () => {
693
- const t = Ve(8), {
694
- orgId: e
695
- } = ut(), r = Mt(), s = e ?? "";
696
- let d;
697
- t[0] !== s ? (d = ct(dt.children.org.children.mcpProxies.path, {
698
- orgId: s
699
- }), t[0] = s, t[1] = d) : d = t[1];
700
- const a = d;
701
- let o;
702
- t[2] !== a || t[3] !== r ? (o = /* @__PURE__ */ n(ti, { onCancel: () => r(a) }), t[2] = a, t[3] = r, t[4] = o) : o = t[4];
703
- let i;
704
- return t[5] !== a || t[6] !== o ? (i = /* @__PURE__ */ n(Dt, { title: "Create MCP Proxy from Endpoint", backHref: a, backLabel: "Back to MCP Proxy list", disableIcon: !0, children: o }), t[5] = a, t[6] = o, t[7] = i) : i = t[7], i;
705
- };
706
- function ii() {
707
- const {
708
- orgId: t
709
- } = ut(), e = Mt(), [r, s] = T(""), d = {
710
- orgId: t ?? ""
711
- }, {
712
- data: a,
713
- isLoading: o,
714
- error: i
715
- } = vn({
716
- orgName: t
717
- }), {
718
- mutate: c
719
- } = bn(), {
720
- addConfirmation: g
721
- } = xn(), p = Q(() => a?.list ?? [], [a]), y = Q(() => {
722
- const u = r.trim().toLowerCase();
723
- return u ? p.filter((m) => [m.name, m.id, m.version, m.context, m.description].filter(Boolean).join(" ").toLowerCase().includes(u)) : p;
724
- }, [p, r]);
725
- return /* @__PURE__ */ n(Tn, { searchValue: r, onSearchChange: s, searchPlaceholder: "Search MCP proxies...", addButton: {
726
- label: "Add MCP Proxy",
727
- component: mn,
728
- to: ct(dt.children.org.children.mcpProxies.children.add.path, d)
729
- }, error: i, isLoading: o, isEmpty: !p.length, isSearchEmpty: !y.length, emptyState: {
730
- illustration: /* @__PURE__ */ n(Qt, { size: 64 }),
731
- title: "No MCP Proxies Yet",
732
- description: "Add an MCP Proxy to provide tools for agents."
733
- }, searchEmptyState: {
734
- illustration: /* @__PURE__ */ n(Tt, { size: 64 }),
735
- title: "No MCP proxies match your search",
736
- description: "Try a different keyword or clear the search filter."
737
- }, children: /* @__PURE__ */ l(be, { variant: "card", children: [
738
- /* @__PURE__ */ n(be.Head, { children: /* @__PURE__ */ l(be.Row, { children: [
739
- /* @__PURE__ */ n(be.Cell, { children: "Name" }),
740
- /* @__PURE__ */ n(be.Cell, { width: "160px", children: "Version" }),
741
- /* @__PURE__ */ n(be.Cell, { width: "140px", align: "right", children: "Last Updated" }),
742
- /* @__PURE__ */ n(be.Cell, { width: "96px", align: "right", children: "Actions" })
743
- ] }) }),
744
- /* @__PURE__ */ n(be.Body, { children: y.map((u) => {
745
- const m = u.name ?? u.id ?? "MCP Proxy", f = u.id;
746
- return /* @__PURE__ */ l(be.Row, { variant: "card", hover: !0, clickable: !!f, onClick: () => {
747
- f && e(ct(dt.children.org.children.mcpProxies.children.view.path, {
748
- orgId: t,
749
- proxyId: f
750
- }));
751
- }, children: [
752
- /* @__PURE__ */ n(be.Cell, { children: /* @__PURE__ */ l(I, { direction: "row", alignItems: "center", spacing: 2, children: [
753
- /* @__PURE__ */ n(Yt, { sx: {
754
- bgcolor: "primary.main",
755
- color: "primary.contrastText",
756
- fontSize: 16,
757
- height: 36,
758
- width: 36,
759
- flexShrink: 0
760
- }, children: en(m, {
761
- fallback: "MP"
762
- }) }),
763
- /* @__PURE__ */ n(z, { variant: "body2", fontWeight: 500, noWrap: !0, children: m })
764
- ] }) }),
765
- /* @__PURE__ */ n(be.Cell, { children: /* @__PURE__ */ n(z, { variant: "body2", children: u.version ?? "-" }) }),
766
- /* @__PURE__ */ n(be.Cell, { align: "right", children: /* @__PURE__ */ n(z, { variant: "caption", color: "text.secondary", children: tn(u.updatedAt) }) }),
767
- /* @__PURE__ */ n(be.Cell, { align: "right", onClick: (v) => v.stopPropagation(), children: f ? /* @__PURE__ */ n(He, { title: "Delete MCP Proxy", children: /* @__PURE__ */ n(lt, { color: "error", size: "small", onClick: () => g({
768
- title: "Delete MCP Proxy",
769
- description: `Are you sure you want to delete ${m}? This action cannot be undone.`,
770
- confirmButtonText: "Delete",
771
- confirmButtonColor: "error",
772
- confirmButtonIcon: /* @__PURE__ */ n(Rt, { size: 16 }),
773
- onConfirm: () => c({
774
- orgName: t,
775
- proxyId: f
776
- })
777
- }), children: /* @__PURE__ */ n(Rt, { size: 16 }) }) }) : null })
778
- ] }, f ?? m);
779
- }) })
780
- ] }) });
781
- }
782
- const ri = {
783
- tool: "Tool",
784
- resource: "Resource",
785
- prompt: "Prompt"
786
- };
787
- function oi(t, e) {
788
- if (!e) return null;
789
- const r = t === "resource" ? e.uri ?? e.name : e.name ?? e.uri;
790
- if (typeof r != "string") return null;
791
- const s = r.trim();
792
- return s.length ? s : null;
793
- }
794
- function si(t) {
795
- if (!t) return;
796
- const e = t.description ?? t.title;
797
- return typeof e == "string" && e.trim() ? e : void 0;
798
- }
799
- function dn(t, e) {
800
- return `${t}::${e}`;
801
- }
802
- function ai(t) {
803
- if (!t?.params)
804
- return {
805
- mode: "allow",
806
- exceptionKeys: []
807
- };
808
- const e = t.params, r = ["tool", "resource", "prompt"], s = {
809
- tool: "tools",
810
- resource: "resources",
811
- prompt: "prompts"
812
- };
813
- let d = null;
814
- const a = [];
815
- for (const o of r) {
816
- const i = e[s[o]];
817
- if (!i) continue;
818
- const c = String(i.mode ?? "").toLowerCase();
819
- d === null && (c === "allow" || c === "deny") && (d = c);
820
- const g = i.exceptions;
821
- if (Array.isArray(g))
822
- for (const p of g)
823
- typeof p == "string" && p.trim() && a.push(dn(o, p.trim()));
824
- }
825
- return {
826
- mode: d ?? "allow",
827
- exceptionKeys: a
828
- };
829
- }
830
- function li(t, e, r) {
831
- const s = {
832
- tool: "tools",
833
- resource: "resources",
834
- prompt: "prompts"
835
- }, d = {
836
- tool: [],
837
- resource: [],
838
- prompt: []
839
- };
840
- for (const o of e) {
841
- const i = o.indexOf("::");
842
- if (i < 0) continue;
843
- const c = o.slice(0, i), g = o.slice(i + 2);
844
- g && c in d && d[c].push(g);
845
- }
846
- const a = {};
847
- return ["tool", "resource", "prompt"].forEach((o) => {
848
- r[o] && (a[s[o]] = {
849
- mode: t,
850
- exceptions: d[o]
851
- });
852
- }), a;
853
- }
854
- function ci({
855
- config: t,
856
- selectedEnvironmentId: e,
857
- orgName: r,
858
- isLoading: s = !1,
859
- onUpdate: d,
860
- isUpdating: a
861
- }) {
862
- const o = ht(null), [i, c] = T("allow"), [g, p] = T([]), [y, u] = T(null), {
863
- data: m,
864
- isLoading: f
865
- } = _t(r), v = Q(() => m?.data?.find((_) => _.name === Qe), [m]), P = Q(() => {
866
- const _ = t?.capabilities;
867
- if (!_) return [];
868
- const w = [], h = [{
869
- kind: "tool",
870
- entries: _.tools
871
- }, {
872
- kind: "resource",
873
- entries: _.resources
874
- }, {
875
- kind: "prompt",
876
- entries: _.prompts
877
- }];
878
- for (const {
879
- kind: b,
880
- entries: R
881
- } of h)
882
- (R ?? []).forEach((L) => {
883
- const C = oi(b, L);
884
- C && w.push({
885
- key: dn(b, C),
886
- method: ri[b],
887
- path: C,
888
- summary: si(L)
889
- });
890
- });
891
- return w;
892
- }, [t?.capabilities]), N = Q(() => ({
893
- tool: !!t?.capabilities?.tools?.length,
894
- resource: !!t?.capabilities?.resources?.length,
895
- prompt: !!t?.capabilities?.prompts?.length
896
- }), [t?.capabilities?.tools, t?.capabilities?.resources, t?.capabilities?.prompts]), M = N.tool || N.resource || N.prompt;
897
- nt(() => {
898
- if (!e) return;
899
- const _ = t?.policies?.find((h) => h.name === Qe), w = ai(_);
900
- c(w.mode), p(w.exceptionKeys), o.current = w;
901
- }, [t, e]);
902
- const A = Q(() => {
903
- const _ = o.current;
904
- if (!_) return !1;
905
- const w = [...g].sort().join(" "), h = [..._.exceptionKeys].sort().join(" ");
906
- return i !== _.mode || w !== h;
907
- }, [i, g]), x = j(async () => {
908
- if (!t) return;
909
- if (!v) {
910
- u({
911
- message: "Access control policy is not available on the active gateway.",
912
- severity: "error"
913
- });
914
- return;
915
- }
916
- if (!M) {
917
- u({
918
- message: "This proxy has no tools, resources, or prompts to apply access control to.",
919
- severity: "error"
920
- });
921
- return;
922
- }
923
- const _ = li(i, g, N), w = {
924
- name: Qe,
925
- version: v.version,
926
- displayName: v.displayName,
927
- params: _
928
- }, h = t.policies ?? [], b = h.findIndex((L) => L.name === Qe), R = b >= 0 ? h.map((L, C) => C === b ? w : L) : [...h, w];
929
- try {
930
- await d({
931
- policies: R
932
- }), o.current = {
933
- mode: i,
934
- exceptionKeys: [...g]
935
- }, u({
936
- message: "Access control updated successfully.",
937
- severity: "success"
938
- });
939
- } catch {
940
- u({
941
- message: "Failed to update access control.",
942
- severity: "error"
943
- });
944
- }
945
- }, [t, v, M, i, g, N, d]), k = j(() => {
946
- const _ = o.current;
947
- _ && (c(_.mode), p([..._.exceptionKeys])), u(null);
948
- }, []);
949
- return !s && t && !M ? /* @__PURE__ */ l(I, { alignItems: "center", justifyContent: "center", spacing: 1, sx: {
950
- minHeight: 200,
951
- textAlign: "center"
952
- }, children: [
953
- /* @__PURE__ */ n(z, { variant: "subtitle1", fontWeight: 600, children: "No Capabilities Available" }),
954
- /* @__PURE__ */ n(z, { variant: "body2", color: "text.secondary", children: "This MCP proxy has no tools, resources, or prompts. Access control rules require at least one capability." })
955
- ] }) : /* @__PURE__ */ l(I, { spacing: 2, children: [
956
- !f && !v && /* @__PURE__ */ l(ot, { severity: "warning", children: [
957
- "The access control policy (",
958
- Qe,
959
- ") is not reported as available by the active gateway. Saving is disabled."
960
- ] }),
961
- /* @__PURE__ */ n(Rn, { items: P, mode: i, onModeChange: c, exceptionKeys: g, onExceptionKeysChange: p, isLoading: s || f, isSaving: a, isDirty: A && !!v, onSave: () => void x(), onDiscard: k, status: y, onClearStatus: () => u(null), availableEmptyTitle: "No available capabilities", availableEmptyDescription: "Tools, resources, and prompts will appear here once the proxy reports them." })
962
- ] });
963
- }
964
- const It = "••••••••••••";
965
- function di(t) {
966
- const e = Ve(93), {
967
- config: r,
968
- selectedEnvironmentId: s,
969
- isLoading: d,
970
- onUpdate: a,
971
- isUpdating: o
972
- } = t, i = d === void 0 ? !1 : d, c = In(), g = ht(null), [p, y] = T(""), [u, m] = T(""), [f, v] = T(""), [P, N] = T(!1), [M, A] = T(!1), [x, k] = T(null), [_, w] = T(null);
973
- r?.upstream?.auth?.header;
974
- const h = !!r?.upstream?.auth?.header;
975
- let b;
976
- e[0] !== r?.upstream?.auth?.header || e[1] !== r?.upstream?.url ? (b = () => {
977
- y(r?.upstream?.url ?? ""), m(r?.upstream?.auth?.header ?? "");
978
- const U = !!r?.upstream?.auth?.header;
979
- v(U ? It : ""), N(U), A(!1), k(null);
980
- }, e[0] = r?.upstream?.auth?.header, e[1] = r?.upstream?.url, e[2] = b) : b = e[2];
981
- const R = b;
982
- let L, C;
983
- e[3] !== R || e[4] !== s ? (L = () => {
984
- s && g.current !== s && (g.current = s, R());
985
- }, C = [s, R], e[3] = R, e[4] = s, e[5] = L, e[6] = C) : (L = e[5], C = e[6]), nt(L, C);
986
- let V;
987
- e[7] === Symbol.for("react.memo_cache_sentinel") ? (V = (U) => {
988
- const se = nn(U, {
989
- requiredMessage: "MCP Proxy Endpoint URL is required"
990
- });
991
- return k(se), se;
992
- }, e[7] = V) : V = e[7];
993
- const F = V, S = !P && f.trim() !== It;
994
- let E;
995
- e: {
996
- if (!r) {
997
- E = !1;
998
- break e;
999
- }
1000
- const U = (r.upstream?.url ?? "").trim(), se = (r.upstream?.auth?.header ?? "").trim();
1001
- if (p.trim() !== U) {
1002
- E = !0;
1003
- break e;
1004
- }
1005
- if (u.trim() !== se) {
1006
- E = !0;
1007
- break e;
1008
- }
1009
- if (S) {
1010
- E = !0;
1011
- break e;
1012
- }
1013
- E = !1;
1014
- }
1015
- const K = E;
1016
- let W;
1017
- e[8] !== R ? (W = () => {
1018
- R(), w(null);
1019
- }, e[8] = R, e[9] = W) : W = e[9];
1020
- const H = W;
1021
- let D;
1022
- e[10] !== u || e[11] !== r || e[12] !== S || e[13] !== f || e[14] !== p || e[15] !== a ? (D = async () => {
1023
- if (!r)
1024
- return;
1025
- const U = F(p);
1026
- if (U) {
1027
- w({
1028
- message: U,
1029
- severity: "error"
1030
- });
1031
- return;
1032
- }
1033
- const se = u.trim(), Xe = r.upstream?.auth, st = se ? {
1034
- type: "api-key",
1035
- ...Xe,
1036
- header: se,
1037
- ...S ? {
1038
- value: f.trim()
1039
- } : {}
1040
- } : void 0;
1041
- try {
1042
- await a({
1043
- upstream: {
1044
- ...r.upstream,
1045
- url: p.trim(),
1046
- auth: st
1047
- }
1048
- }), w({
1049
- message: "Connection updated successfully.",
1050
- severity: "success"
1051
- }), S && (v(It), N(!0));
1052
- } catch {
1053
- w({
1054
- message: "Failed to update connection.",
1055
- severity: "error"
1056
- });
1057
- }
1058
- }, e[10] = u, e[11] = r, e[12] = S, e[13] = f, e[14] = p, e[15] = a, e[16] = D) : D = e[16];
1059
- const G = D;
1060
- if (i) {
1061
- let U;
1062
- return e[17] === Symbol.for("react.memo_cache_sentinel") ? (U = /* @__PURE__ */ n(I, { spacing: 2, children: [1, 2, 3].map(hi) }), e[17] = U) : U = e[17], U;
1063
- }
1064
- if (!r)
1065
- return null;
1066
- let te;
1067
- e[18] === Symbol.for("react.memo_cache_sentinel") ? (te = {
1068
- xs: 12
1069
- }, e[18] = te) : te = e[18];
1070
- let ne;
1071
- e[19] === Symbol.for("react.memo_cache_sentinel") ? (ne = /* @__PURE__ */ n(le, { required: !0, children: "MCP Proxy Endpoint URL" }), e[19] = ne) : ne = e[19];
1072
- let ce;
1073
- e[20] !== x ? (ce = (U) => {
1074
- y(U.target.value), x && F(U.target.value);
1075
- }, e[20] = x, e[21] = ce) : ce = e[21];
1076
- let q;
1077
- e[22] !== p ? (q = () => F(p), e[22] = p, e[23] = q) : q = e[23];
1078
- const B = !!x, Y = c.typography.body2?.fontSize;
1079
- let J;
1080
- e[24] !== Y ? (J = {
1081
- "& .MuiInputBase-input": {
1082
- fontFamily: "monospace",
1083
- fontSize: Y
1084
- }
1085
- }, e[24] = Y, e[25] = J) : J = e[25];
1086
- let xe;
1087
- e[26] !== p || e[27] !== x || e[28] !== ce || e[29] !== q || e[30] !== B || e[31] !== J ? (xe = /* @__PURE__ */ n(X, { size: te, children: /* @__PURE__ */ l(oe, { fullWidth: !0, children: [
1088
- ne,
1089
- /* @__PURE__ */ n($, { size: "small", value: p, onChange: ce, onBlur: q, error: B, helperText: x, placeholder: "Enter URL of your MCP Proxy", sx: J })
1090
- ] }) }), e[26] = p, e[27] = x, e[28] = ce, e[29] = q, e[30] = B, e[31] = J, e[32] = xe) : xe = e[32];
1091
- let re;
1092
- e[33] === Symbol.for("react.memo_cache_sentinel") ? (re = {
1093
- xs: 12
1094
- }, e[33] = re) : re = e[33];
1095
- let Pe;
1096
- e[34] === Symbol.for("react.memo_cache_sentinel") ? (Pe = /* @__PURE__ */ n(tt, { size: 18 }), e[34] = Pe) : Pe = e[34];
1097
- let Ue;
1098
- e[35] === Symbol.for("react.memo_cache_sentinel") ? (Ue = /* @__PURE__ */ n(z, { variant: "subtitle2", fontWeight: 600, children: "Advanced Configurations" }), e[35] = Ue) : Ue = e[35];
1099
- let $e;
1100
- e[36] === Symbol.for("react.memo_cache_sentinel") ? ($e = /* @__PURE__ */ n(yt, { expandIcon: Pe, children: /* @__PURE__ */ l(I, { direction: "row", alignItems: "center", spacing: 1, children: [
1101
- Ue,
1102
- /* @__PURE__ */ n(He, { title: "Configure an optional authentication header sent to the MCP proxy endpoint.", children: /* @__PURE__ */ n(Gt, { size: 16 }) })
1103
- ] }) }), e[36] = $e) : $e = e[36];
1104
- let je;
1105
- e[37] === Symbol.for("react.memo_cache_sentinel") ? (je = /* @__PURE__ */ n(z, { variant: "subtitle2", fontWeight: 600, children: "Configure Authentication Header" }), e[37] = je) : je = e[37];
1106
- let qe;
1107
- e[38] === Symbol.for("react.memo_cache_sentinel") ? (qe = {
1108
- xs: 12,
1109
- md: 6
1110
- }, e[38] = qe) : qe = e[38];
1111
- let Ye;
1112
- e[39] === Symbol.for("react.memo_cache_sentinel") ? (Ye = /* @__PURE__ */ n(le, { children: "Header" }), e[39] = Ye) : Ye = e[39];
1113
- let Ke;
1114
- e[40] === Symbol.for("react.memo_cache_sentinel") ? (Ke = (U) => m(U.target.value), e[40] = Ke) : Ke = e[40];
1115
- let Ie;
1116
- e[41] !== u ? (Ie = /* @__PURE__ */ n(X, { size: qe, children: /* @__PURE__ */ l(oe, { fullWidth: !0, children: [
1117
- Ye,
1118
- /* @__PURE__ */ n($, { size: "small", value: u, onChange: Ke, placeholder: "Header" })
1119
- ] }) }), e[41] = u, e[42] = Ie) : Ie = e[42];
1120
- let Ge;
1121
- e[43] === Symbol.for("react.memo_cache_sentinel") ? (Ge = {
1122
- xs: 12,
1123
- md: 6
1124
- }, e[43] = Ge) : Ge = e[43];
1125
- let Be;
1126
- e[44] === Symbol.for("react.memo_cache_sentinel") ? (Be = /* @__PURE__ */ n(le, { children: "Value" }), e[44] = Be) : Be = e[44];
1127
- const it = M ? "text" : "password";
1128
- let de;
1129
- e[45] !== P ? (de = () => {
1130
- P && (v(""), N(!1));
1131
- }, e[45] = P, e[46] = de) : de = e[46];
1132
- let Oe;
1133
- e[47] === Symbol.for("react.memo_cache_sentinel") ? (Oe = (U) => v(U.target.value), e[47] = Oe) : Oe = e[47];
1134
- let De;
1135
- e[48] === Symbol.for("react.memo_cache_sentinel") ? (De = () => A(ui), e[48] = De) : De = e[48];
1136
- const Je = M ? "Hide header value" : "Show header value";
1137
- let ue;
1138
- e[49] !== M ? (ue = M ? /* @__PURE__ */ n(Jt, { size: 18 }) : /* @__PURE__ */ n(Xt, { size: 18 }), e[49] = M, e[50] = ue) : ue = e[50];
1139
- let he;
1140
- e[51] !== Je || e[52] !== ue ? (he = {
1141
- input: {
1142
- endAdornment: /* @__PURE__ */ n(jt, { position: "end", children: /* @__PURE__ */ n(lt, { size: "small", onClick: De, "aria-label": Je, edge: "end", children: ue }) })
1143
- }
1144
- }, e[51] = Je, e[52] = ue, e[53] = he) : he = e[53];
1145
- let Se;
1146
- e[54] === Symbol.for("react.memo_cache_sentinel") ? (Se = {
1147
- "& .MuiInputBase-input": {
1148
- fontFamily: "monospace"
1149
- }
1150
- }, e[54] = Se) : Se = e[54];
1151
- let me;
1152
- e[55] !== f || e[56] !== it || e[57] !== de || e[58] !== he ? (me = /* @__PURE__ */ n(X, { size: Ge, children: /* @__PURE__ */ l(oe, { fullWidth: !0, children: [
1153
- Be,
1154
- /* @__PURE__ */ n($, { size: "small", type: it, value: f, placeholder: "Value", onFocus: de, onChange: Oe, slotProps: he, sx: Se })
1155
- ] }) }), e[55] = f, e[56] = it, e[57] = de, e[58] = he, e[59] = me) : me = e[59];
1156
- let ke;
1157
- e[60] !== Ie || e[61] !== me ? (ke = /* @__PURE__ */ l(X, { container: !0, spacing: 2, children: [
1158
- Ie,
1159
- me
1160
- ] }), e[60] = Ie, e[61] = me, e[62] = ke) : ke = e[62];
1161
- let Ee;
1162
- e[63] !== h ? (Ee = h && /* @__PURE__ */ n(z, { variant: "caption", color: "text.secondary", children: "The stored value is hidden. Leave it unchanged to keep the current credential, or enter a new value to replace it." }), e[63] = h, e[64] = Ee) : Ee = e[64];
1163
- let pe;
1164
- e[65] !== ke || e[66] !== Ee ? (pe = /* @__PURE__ */ n(X, { size: re, children: /* @__PURE__ */ l(vt, { defaultExpanded: !0, disableGutters: !0, variant: "outlined", children: [
1165
- $e,
1166
- /* @__PURE__ */ n(bt, { children: /* @__PURE__ */ l(I, { spacing: 2, children: [
1167
- je,
1168
- ke,
1169
- Ee
1170
- ] }) })
1171
- ] }) }), e[65] = ke, e[66] = Ee, e[67] = pe) : pe = e[67];
1172
- let Ae;
1173
- e[68] === Symbol.for("react.memo_cache_sentinel") ? (Ae = {
1174
- xs: 12
1175
- }, e[68] = Ae) : Ae = e[68];
1176
- const Re = !!_;
1177
- let we;
1178
- e[69] !== _ ? (we = _ && /* @__PURE__ */ n(ot, { severity: _.severity, onClose: () => w(null), sx: {
1179
- width: "100%"
1180
- }, children: _.message }), e[69] = _, e[70] = we) : we = e[70];
1181
- let Me;
1182
- e[71] !== Re || e[72] !== we ? (Me = /* @__PURE__ */ n(et, { in: Re, timeout: 300, children: we }), e[71] = Re, e[72] = we, e[73] = Me) : Me = e[73];
1183
- const rt = !K || o;
1184
- let fe;
1185
- e[74] !== H || e[75] !== rt ? (fe = /* @__PURE__ */ n(Z, { variant: "outlined", onClick: H, disabled: rt, children: "Discard" }), e[74] = H, e[75] = rt, e[76] = fe) : fe = e[76];
1186
- let ge;
1187
- e[77] !== G ? (ge = () => void G(), e[77] = G, e[78] = ge) : ge = e[78];
1188
- const Le = o || !K || !!x, We = o ? "Saving..." : "Save";
1189
- let ye;
1190
- e[79] !== ge || e[80] !== Le || e[81] !== We ? (ye = /* @__PURE__ */ n(Z, { variant: "contained", onClick: ge, disabled: Le, children: We }), e[79] = ge, e[80] = Le, e[81] = We, e[82] = ye) : ye = e[82];
1191
- let _e;
1192
- e[83] !== fe || e[84] !== ye ? (_e = /* @__PURE__ */ l(I, { direction: "row", spacing: 1.5, justifyContent: "flex-end", children: [
1193
- fe,
1194
- ye
1195
- ] }), e[83] = fe, e[84] = ye, e[85] = _e) : _e = e[85];
1196
- let ve;
1197
- e[86] !== Me || e[87] !== _e ? (ve = /* @__PURE__ */ n(X, { size: Ae, children: /* @__PURE__ */ l(I, { spacing: 1.5, width: "100%", children: [
1198
- Me,
1199
- _e
1200
- ] }) }), e[86] = Me, e[87] = _e, e[88] = ve) : ve = e[88];
1201
- let ze;
1202
- return e[89] !== xe || e[90] !== pe || e[91] !== ve ? (ze = /* @__PURE__ */ n(I, { spacing: 2, children: /* @__PURE__ */ l(X, { container: !0, spacing: 3, children: [
1203
- xe,
1204
- pe,
1205
- ve
1206
- ] }) }), e[89] = xe, e[90] = pe, e[91] = ve, e[92] = ze) : ze = e[92], ze;
1207
- }
1208
- function ui(t) {
1209
- return !t;
1210
- }
1211
- function hi(t) {
1212
- return /* @__PURE__ */ l(I, { spacing: 0.5, children: [
1213
- /* @__PURE__ */ n(Ce, { variant: "text", width: 160, height: 16 }),
1214
- /* @__PURE__ */ n(Ce, { variant: "rounded", height: 40 })
1215
- ] }, t);
1216
- }
1217
- function mi(t) {
1218
- const e = Ve(38), {
1219
- proxy: r,
1220
- config: s,
1221
- isLoading: d
1222
- } = t;
1223
- if (d === void 0 ? !1 : d) {
1224
- let te;
1225
- return e[0] === Symbol.for("react.memo_cache_sentinel") ? (te = /* @__PURE__ */ n(I, { spacing: 2, children: /* @__PURE__ */ n(X, { container: !0, spacing: 2, children: [1, 2, 3, 4, 5].map(fi) }) }), e[0] = te) : te = e[0], te;
1226
- }
1227
- if (!r)
1228
- return null;
1229
- const o = s?.policies?.some(pi), i = s?.deploymentStatus === "Deployed", c = s?.security?.enabled !== !1 && !!s?.security?.apiKey && s.security.apiKey.enabled !== !1;
1230
- let g;
1231
- e[1] !== r.context ? (g = r.context && /* @__PURE__ */ n(X, { size: {
1232
- xs: 12,
1233
- sm: 6,
1234
- md: 4
1235
- }, children: /* @__PURE__ */ n(Ne, { variant: "outlined", sx: {
1236
- p: 2,
1237
- height: "100%"
1238
- }, children: /* @__PURE__ */ l(I, { spacing: 0.5, children: [
1239
- /* @__PURE__ */ n(z, { variant: "caption", color: "text.secondary", sx: {
1240
- fontWeight: 500
1241
- }, children: "Context" }),
1242
- /* @__PURE__ */ n(z, { variant: "body2", sx: {
1243
- fontFamily: "monospace"
1244
- }, children: r.context })
1245
- ] }) }) }), e[1] = r.context, e[2] = g) : g = e[2];
1246
- let p;
1247
- e[3] !== s ? (p = s?.upstream?.url && /* @__PURE__ */ n(X, { size: {
1248
- xs: 12,
1249
- sm: 6,
1250
- md: 4
1251
- }, children: /* @__PURE__ */ n(Ne, { variant: "outlined", sx: {
1252
- p: 2,
1253
- height: "100%"
1254
- }, children: /* @__PURE__ */ l(I, { spacing: 0.5, children: [
1255
- /* @__PURE__ */ n(z, { variant: "caption", color: "text.secondary", sx: {
1256
- fontWeight: 500
1257
- }, children: "Upstream URL" }),
1258
- /* @__PURE__ */ n(z, { variant: "body2", sx: {
1259
- fontFamily: "monospace",
1260
- wordBreak: "break-all"
1261
- }, children: s.upstream.url })
1262
- ] }) }) }), e[3] = s, e[4] = p) : p = e[4];
1263
- let y;
1264
- e[5] === Symbol.for("react.memo_cache_sentinel") ? (y = {
1265
- xs: 12,
1266
- sm: 6,
1267
- md: 4
1268
- }, e[5] = y) : y = e[5];
1269
- let u;
1270
- e[6] === Symbol.for("react.memo_cache_sentinel") ? (u = {
1271
- p: 2,
1272
- height: "100%"
1273
- }, e[6] = u) : u = e[6];
1274
- let m;
1275
- e[7] === Symbol.for("react.memo_cache_sentinel") ? (m = /* @__PURE__ */ n(z, { variant: "caption", color: "text.secondary", sx: {
1276
- fontWeight: 500
1277
- }, children: "Auth Type" }), e[7] = m) : m = e[7];
1278
- const f = c ? "API Key" : "None";
1279
- let v;
1280
- e[8] !== f ? (v = /* @__PURE__ */ n(X, { size: y, children: /* @__PURE__ */ n(Ne, { variant: "outlined", sx: u, children: /* @__PURE__ */ l(I, { spacing: 0.5, children: [
1281
- m,
1282
- /* @__PURE__ */ n(z, { variant: "body2", children: f })
1283
- ] }) }) }), e[8] = f, e[9] = v) : v = e[9];
1284
- let P;
1285
- e[10] === Symbol.for("react.memo_cache_sentinel") ? (P = {
1286
- xs: 12,
1287
- sm: 6,
1288
- md: 4
1289
- }, e[10] = P) : P = e[10];
1290
- let N;
1291
- e[11] === Symbol.for("react.memo_cache_sentinel") ? (N = {
1292
- p: 2,
1293
- height: "100%"
1294
- }, e[11] = N) : N = e[11];
1295
- let M;
1296
- e[12] === Symbol.for("react.memo_cache_sentinel") ? (M = /* @__PURE__ */ n(z, { variant: "caption", color: "text.secondary", sx: {
1297
- fontWeight: 500
1298
- }, children: "Access Control" }), e[12] = M) : M = e[12];
1299
- const A = o ? "Configured" : "Allow all", x = o ? "success" : "default";
1300
- let k;
1301
- e[13] === Symbol.for("react.memo_cache_sentinel") ? (k = {
1302
- width: "fit-content"
1303
- }, e[13] = k) : k = e[13];
1304
- let _;
1305
- e[14] !== A || e[15] !== x ? (_ = /* @__PURE__ */ n(X, { size: P, children: /* @__PURE__ */ n(Ne, { variant: "outlined", sx: N, children: /* @__PURE__ */ l(I, { spacing: 0.5, children: [
1306
- M,
1307
- /* @__PURE__ */ n(Te, { label: A, size: "small", variant: "outlined", color: x, sx: k })
1308
- ] }) }) }), e[14] = A, e[15] = x, e[16] = _) : _ = e[16];
1309
- let w;
1310
- e[17] === Symbol.for("react.memo_cache_sentinel") ? (w = {
1311
- xs: 12,
1312
- sm: 6,
1313
- md: 4
1314
- }, e[17] = w) : w = e[17];
1315
- let h;
1316
- e[18] === Symbol.for("react.memo_cache_sentinel") ? (h = {
1317
- p: 2,
1318
- height: "100%"
1319
- }, e[18] = h) : h = e[18];
1320
- let b;
1321
- e[19] === Symbol.for("react.memo_cache_sentinel") ? (b = /* @__PURE__ */ n(z, { variant: "caption", color: "text.secondary", sx: {
1322
- fontWeight: 500
1323
- }, children: "Deployment" }), e[19] = b) : b = e[19];
1324
- const R = i ? "Deployed" : "Undeployed", L = i ? "success" : "default";
1325
- let C;
1326
- e[20] === Symbol.for("react.memo_cache_sentinel") ? (C = {
1327
- width: "fit-content"
1328
- }, e[20] = C) : C = e[20];
1329
- let V;
1330
- e[21] !== R || e[22] !== L ? (V = /* @__PURE__ */ n(X, { size: w, children: /* @__PURE__ */ n(Ne, { variant: "outlined", sx: h, children: /* @__PURE__ */ l(I, { spacing: 0.5, children: [
1331
- b,
1332
- /* @__PURE__ */ n(Te, { label: R, size: "small", variant: "outlined", color: L, sx: C })
1333
- ] }) }) }), e[21] = R, e[22] = L, e[23] = V) : V = e[23];
1334
- let F;
1335
- e[24] === Symbol.for("react.memo_cache_sentinel") ? (F = {
1336
- xs: 12,
1337
- sm: 6,
1338
- md: 4
1339
- }, e[24] = F) : F = e[24];
1340
- let S;
1341
- e[25] === Symbol.for("react.memo_cache_sentinel") ? (S = {
1342
- p: 2,
1343
- height: "100%"
1344
- }, e[25] = S) : S = e[25];
1345
- let E;
1346
- e[26] === Symbol.for("react.memo_cache_sentinel") ? (E = /* @__PURE__ */ n(z, { variant: "caption", color: "text.secondary", sx: {
1347
- fontWeight: 500
1348
- }, children: "In Catalog" }), e[26] = E) : E = e[26];
1349
- const K = r.inCatalog ? "Yes" : "No", W = r.inCatalog ? "success" : "default";
1350
- let H;
1351
- e[27] === Symbol.for("react.memo_cache_sentinel") ? (H = {
1352
- width: "fit-content"
1353
- }, e[27] = H) : H = e[27];
1354
- let D;
1355
- e[28] !== K || e[29] !== W ? (D = /* @__PURE__ */ n(X, { size: F, children: /* @__PURE__ */ n(Ne, { variant: "outlined", sx: S, children: /* @__PURE__ */ l(I, { spacing: 0.5, children: [
1356
- E,
1357
- /* @__PURE__ */ n(Te, { label: K, size: "small", color: W, variant: "outlined", sx: H })
1358
- ] }) }) }), e[28] = K, e[29] = W, e[30] = D) : D = e[30];
1359
- let G;
1360
- return e[31] !== _ || e[32] !== g || e[33] !== V || e[34] !== D || e[35] !== p || e[36] !== v ? (G = /* @__PURE__ */ n(I, { spacing: 3, children: /* @__PURE__ */ l(X, { container: !0, spacing: 2, children: [
1361
- g,
1362
- p,
1363
- v,
1364
- _,
1365
- V,
1366
- D
1367
- ] }) }), e[31] = _, e[32] = g, e[33] = V, e[34] = D, e[35] = p, e[36] = v, e[37] = G) : G = e[37], G;
1368
- }
1369
- function pi(t) {
1370
- return t.name === Qe;
1371
- }
1372
- function fi(t) {
1373
- return /* @__PURE__ */ n(X, { size: {
1374
- xs: 12,
1375
- sm: 6,
1376
- md: 4
1377
- }, children: /* @__PURE__ */ n(Ne, { variant: "outlined", sx: {
1378
- p: 2,
1379
- height: "100%"
1380
- }, children: /* @__PURE__ */ l(I, { spacing: 1, children: [
1381
- /* @__PURE__ */ n(Ce, { variant: "text", width: "40%", height: 16 }),
1382
- /* @__PURE__ */ n(Ce, { variant: "text", width: "80%", height: 20 })
1383
- ] }) }) }, t);
1384
- }
1385
- function St(t) {
1386
- return $n.includes(t);
1387
- }
1388
- function gi(t) {
1389
- return t.map((e) => ({
1390
- name: e.name,
1391
- version: e.version,
1392
- displayName: e.displayName,
1393
- settings: e.params
1394
- }));
1395
- }
1396
- function Lt(t) {
1397
- return t.map((e) => ({
1398
- name: e.name,
1399
- version: e.version,
1400
- displayName: e.displayName,
1401
- params: e.settings
1402
- }));
1403
- }
1404
- function yi({
1405
- config: t,
1406
- orgName: e,
1407
- onUpdate: r
1408
- }) {
1409
- const {
1410
- data: s,
1411
- isLoading: d,
1412
- error: a
1413
- } = _t(e), o = Q(() => t?.policies ?? [], [t?.policies]), i = j((u) => {
1414
- r({
1415
- policies: u
1416
- });
1417
- }, [r]), c = Q(() => gi(o.filter((u) => !St(u.name))), [o]), g = j((u) => {
1418
- const m = [...o], f = m.findIndex((P) => P.name === u.name && P.version === u.version), v = Lt([u])[0];
1419
- f >= 0 ? (m[f] = v, i(m)) : i([...o, v]);
1420
- }, [i, o]), p = j((u, m) => {
1421
- i(o.filter((f) => f.name !== u || f.version !== m));
1422
- }, [i, o]), y = j((u) => {
1423
- const m = Lt(u);
1424
- let f = 0;
1425
- const v = o.map((P) => St(P.name) ? P : m[f++] ?? P);
1426
- i(v);
1427
- }, [i, o]);
1428
- return /* @__PURE__ */ n(Ln, { policies: c, onAdd: g, onEdit: g, onRemove: p, onReorder: y, catalogData: s, isLoadingCatalog: d, catalogError: a, filterPolicies: (u) => u.filter((m) => !St(m.name)), getPolicyDefinitionVersion: (u) => u.policyHubVersion ?? u.version, title: "Policies", description: "Add policies to this server and drag to change their execution order.", addButtonLabel: "Add Policy", drawerAddTitle: "Add Policy", drawerEditTitle: "Edit Policy", drawerAddSubtitle: "Choose a policy to configure advanced options.", drawerEditSubtitle: "Update the policy configuration.", policyNoun: "policy", loadingLabel: "Loading policies...", searchPlaceholder: "Search policies...", catalogErrorLabel: "Failed to load policies.", emptySearchTitle: "No policies match your search", emptyCatalogTitle: "No policies available", emptyCatalogDescription: "No MCP policies reported by the active gateway are available in the policy hub." });
1429
- }
1430
- const wt = {
1431
- tool: "Tool",
1432
- resource: "Resource",
1433
- prompt: "Prompt"
1434
- }, un = {
1435
- tool: "info",
1436
- resource: "success",
1437
- prompt: "error"
1438
- };
1439
- function Wt(t) {
1440
- if (t == null) return "";
1441
- if (typeof t == "string") return t;
1442
- try {
1443
- return JSON.stringify(t, null, 2);
1444
- } catch {
1445
- return "";
1446
- }
1447
- }
1448
- function kt(t, e) {
1449
- const r = t === "resource" ? e.uri ?? e.name : e.name ?? e.uri;
1450
- if (typeof r != "string") return null;
1451
- const s = r.trim();
1452
- return s.length ? s : null;
1453
- }
1454
- function vi(t) {
1455
- const e = {
1456
- tool: {},
1457
- resource: {},
1458
- prompt: {}
1459
- }, r = [], s = t?.capabilities?.tools ?? [], d = t?.capabilities?.resources ?? [], a = t?.capabilities?.prompts ?? [];
1460
- return s.forEach((o) => {
1461
- const i = kt("tool", o);
1462
- i && (e.tool[i] = {
1463
- name: typeof o.name == "string" ? o.name : i,
1464
- description: typeof o.description == "string" ? o.description : "",
1465
- inputSchema: Wt(o.inputSchema),
1466
- outputSchema: Wt(o.outputSchema),
1467
- target: i
1468
- }, r.push({
1469
- kind: "tool",
1470
- backendId: i,
1471
- label: i
1472
- }));
1473
- }), d.forEach((o) => {
1474
- const i = kt("resource", o);
1475
- i && (e.resource[i] = {
1476
- uri: typeof o.uri == "string" ? o.uri : i,
1477
- description: typeof o.description == "string" ? o.description : "",
1478
- target: i
1479
- }, r.push({
1480
- kind: "resource",
1481
- backendId: i,
1482
- label: i
1483
- }));
1484
- }), a.forEach((o) => {
1485
- const i = kt("prompt", o);
1486
- i && (e.prompt[i] = {
1487
- name: typeof o.name == "string" ? o.name : i,
1488
- description: typeof o.description == "string" ? o.description : "",
1489
- target: i
1490
- }, r.push({
1491
- kind: "prompt",
1492
- backendId: i,
1493
- label: i
1494
- }));
1495
- }), {
1496
- state: e,
1497
- meta: r
1498
- };
1499
- }
1500
- function bi(t, e) {
1501
- if (!e?.params) return t;
1502
- const r = e.params, s = {
1503
- tool: {
1504
- ...t.tool
1505
- },
1506
- resource: {
1507
- ...t.resource
1508
- },
1509
- prompt: {
1510
- ...t.prompt
1511
- }
1512
- };
1513
- return (Array.isArray(r.tools) ? r.tools : []).forEach((i) => {
1514
- const c = typeof i.target == "string" && i.target.trim() ? i.target.trim() : typeof i.name == "string" ? i.name.trim() : "";
1515
- !c || !(c in s.tool) || (s.tool[c] = {
1516
- name: typeof i.name == "string" ? i.name : s.tool[c].name,
1517
- description: typeof i.description == "string" ? i.description : s.tool[c].description,
1518
- inputSchema: typeof i.inputSchema == "string" ? i.inputSchema : s.tool[c].inputSchema,
1519
- outputSchema: typeof i.outputSchema == "string" ? i.outputSchema : s.tool[c].outputSchema,
1520
- target: typeof i.target == "string" && i.target.trim() ? i.target : s.tool[c].target
1521
- });
1522
- }), (Array.isArray(r.resources) ? r.resources : []).forEach((i) => {
1523
- const c = typeof i.target == "string" && i.target.trim() ? i.target.trim() : typeof i.uri == "string" ? i.uri.trim() : "";
1524
- !c || !(c in s.resource) || (s.resource[c] = {
1525
- uri: typeof i.uri == "string" ? i.uri : s.resource[c].uri,
1526
- description: typeof i.description == "string" ? i.description : s.resource[c].description,
1527
- target: typeof i.target == "string" && i.target.trim() ? i.target : s.resource[c].target
1528
- });
1529
- }), (Array.isArray(r.prompts) ? r.prompts : []).forEach((i) => {
1530
- const c = typeof i.target == "string" && i.target.trim() ? i.target.trim() : typeof i.name == "string" ? i.name.trim() : "";
1531
- !c || !(c in s.prompt) || (s.prompt[c] = {
1532
- name: typeof i.name == "string" ? i.name : s.prompt[c].name,
1533
- description: typeof i.description == "string" ? i.description : s.prompt[c].description,
1534
- target: typeof i.target == "string" && i.target.trim() ? i.target : s.prompt[c].target
1535
- });
1536
- }), s;
1537
- }
1538
- function xi(t, e) {
1539
- const r = e.some((o) => o.kind === "tool"), s = e.some((o) => o.kind === "resource"), d = e.some((o) => o.kind === "prompt"), a = {};
1540
- return r && (a.tools = e.filter((o) => o.kind === "tool").map((o) => {
1541
- const i = t.tool[o.backendId], c = {
1542
- name: i.name,
1543
- // description and inputSchema are required for tools; fall back to
1544
- // the backend id so the gateway's minLength: 1 validation passes
1545
- // when the upstream MCP server reports an empty value.
1546
- description: i.description.trim() || o.backendId,
1547
- inputSchema: i.inputSchema.trim() || '{"type":"object"}',
1548
- target: i.target.trim() ? i.target : o.backendId
1549
- };
1550
- return i.outputSchema.trim() && (c.outputSchema = i.outputSchema), c;
1551
- })), s && (a.resources = e.filter((o) => o.kind === "resource").map((o) => {
1552
- const i = t.resource[o.backendId], c = {
1553
- name: i.uri,
1554
- uri: i.uri,
1555
- target: i.target.trim() ? i.target : o.backendId
1556
- };
1557
- return i.description.trim() && (c.description = i.description), c;
1558
- })), d && (a.prompts = e.filter((o) => o.kind === "prompt").map((o) => {
1559
- const i = t.prompt[o.backendId], c = {
1560
- name: i.name,
1561
- target: i.target.trim() ? i.target : o.backendId
1562
- };
1563
- return i.description.trim() && (c.description = i.description), c;
1564
- })), a;
1565
- }
1566
- function Ci({
1567
- config: t,
1568
- selectedEnvironmentId: e,
1569
- orgName: r,
1570
- isLoading: s = !1,
1571
- onUpdate: d,
1572
- isUpdating: a
1573
- }) {
1574
- const o = ht(null), [i, c] = T(!1), [g, p] = T({
1575
- tool: {},
1576
- resource: {},
1577
- prompt: {}
1578
- }), [y, u] = T([]), [m, f] = T(null), [v, P] = T({
1579
- tool: !0,
1580
- resource: !0,
1581
- prompt: !0
1582
- }), [N, M] = T(null), {
1583
- data: A,
1584
- isLoading: x
1585
- } = _t(r), k = Q(() => A?.data?.find((S) => S.name === Ze), [A]);
1586
- nt(() => {
1587
- if (!t || !e) return;
1588
- const {
1589
- state: S,
1590
- meta: E
1591
- } = vi(t), K = t.policies?.find((D) => D.name === Ze), W = bi(S, K), H = !!K;
1592
- c(H), p(W), u(E), o.current = {
1593
- enabled: H,
1594
- state: W
1595
- }, f((D) => {
1596
- if (D && E.some((ne) => `${ne.kind}::${ne.backendId}` === D))
1597
- return D;
1598
- const G = E[0];
1599
- return G ? `${G.kind}::${G.backendId}` : null;
1600
- });
1601
- }, [t, e]);
1602
- const _ = Q(() => {
1603
- if (!m) return null;
1604
- const S = m.indexOf("::");
1605
- if (S < 0) return null;
1606
- const E = m.slice(0, S), K = m.slice(S + 2), W = y.find((H) => H.kind === E && H.backendId === K);
1607
- return W || null;
1608
- }, [m, y]), w = y.length > 0, h = Q(() => {
1609
- const S = o.current;
1610
- return S ? S.enabled !== i ? !0 : i ? JSON.stringify(S.state) !== JSON.stringify(g) : !1 : !1;
1611
- }, [i, g]), b = j((S, E) => {
1612
- p((K) => ({
1613
- ...K,
1614
- tool: {
1615
- ...K.tool,
1616
- [S]: {
1617
- ...K.tool[S],
1618
- ...E
1619
- }
1620
- }
1621
- }));
1622
- }, []), R = j((S, E) => {
1623
- p((K) => ({
1624
- ...K,
1625
- resource: {
1626
- ...K.resource,
1627
- [S]: {
1628
- ...K.resource[S],
1629
- ...E
1630
- }
1631
- }
1632
- }));
1633
- }, []), L = j((S, E) => {
1634
- p((K) => ({
1635
- ...K,
1636
- prompt: {
1637
- ...K.prompt,
1638
- [S]: {
1639
- ...K.prompt[S],
1640
- ...E
1641
- }
1642
- }
1643
- }));
1644
- }, []), C = j(async () => {
1645
- if (!t) return;
1646
- const S = t.policies ?? [];
1647
- let E;
1648
- if (i) {
1649
- if (!k) {
1650
- M({
1651
- message: "Rewrite policy is not available on the active gateway.",
1652
- severity: "error"
1653
- });
1654
- return;
1655
- }
1656
- const K = xi(g, y), W = {
1657
- name: Ze,
1658
- version: k.version,
1659
- displayName: k.displayName,
1660
- params: K
1661
- }, H = S.findIndex((D) => D.name === Ze);
1662
- E = H >= 0 ? S.map((D, G) => G === H ? W : D) : [...S, W];
1663
- } else
1664
- E = S.filter((K) => K.name !== Ze);
1665
- try {
1666
- await d({
1667
- policies: E
1668
- }), o.current = {
1669
- enabled: i,
1670
- state: g
1671
- }, M({
1672
- message: i ? "Rewrite policy updated successfully." : "Rewrite policy disabled.",
1673
- severity: "success"
1674
- });
1675
- } catch {
1676
- M({
1677
- message: "Failed to update rewrite policy.",
1678
- severity: "error"
1679
- });
1680
- }
1681
- }, [t, i, k, g, y, d]), V = j(() => {
1682
- const S = o.current;
1683
- S && (c(S.enabled), p(S.state)), M(null);
1684
- }, []);
1685
- if (s || x)
1686
- return /* @__PURE__ */ l(I, { spacing: 2, children: [
1687
- /* @__PURE__ */ n(Ce, { variant: "rounded", height: 48 }),
1688
- /* @__PURE__ */ l(ie, { sx: {
1689
- display: "grid",
1690
- gridTemplateColumns: "320px 1fr",
1691
- gap: 3
1692
- }, children: [
1693
- /* @__PURE__ */ n(Ce, { variant: "rounded", height: 400 }),
1694
- /* @__PURE__ */ n(Ce, { variant: "rounded", height: 400 })
1695
- ] })
1696
- ] });
1697
- if (!w)
1698
- return /* @__PURE__ */ l(I, { alignItems: "center", justifyContent: "center", spacing: 1, sx: {
1699
- minHeight: 200,
1700
- textAlign: "center"
1701
- }, children: [
1702
- /* @__PURE__ */ n(z, { variant: "subtitle1", fontWeight: 600, children: "No Capabilities Available" }),
1703
- /* @__PURE__ */ n(z, { variant: "body2", color: "text.secondary", children: "This MCP proxy has no tools, resources, or prompts to rewrite." })
1704
- ] });
1705
- const F = !!N && (N.severity === "error" || !h);
1706
- return /* @__PURE__ */ l(I, { spacing: 2, children: [
1707
- /* @__PURE__ */ l(I, { direction: "row", alignItems: "center", justifyContent: "space-between", spacing: 2, children: [
1708
- /* @__PURE__ */ l(I, { spacing: 0.5, sx: {
1709
- flex: 1,
1710
- minWidth: 0
1711
- }, children: [
1712
- /* @__PURE__ */ n(z, { variant: "subtitle1", fontWeight: 600, children: "Rewrite" }),
1713
- /* @__PURE__ */ n(z, { variant: "body2", color: "text.secondary", children: "Rewrite the user-facing names of tools, resources, and prompts exposed by this MCP proxy." })
1714
- ] }),
1715
- /* @__PURE__ */ l(I, { direction: "row", alignItems: "center", spacing: 1, children: [
1716
- /* @__PURE__ */ n(z, { variant: "body2", color: "text.secondary", children: i ? "Enabled" : "Disabled" }),
1717
- /* @__PURE__ */ n(Sn, { checked: i, onChange: (S, E) => c(E), disabled: a })
1718
- ] })
1719
- ] }),
1720
- i && !k && /* @__PURE__ */ l(ot, { severity: "warning", children: [
1721
- "The rewrite policy (",
1722
- Ze,
1723
- ") is not reported as available by the active gateway. Saving is disabled."
1724
- ] }),
1725
- i && /* @__PURE__ */ l(ie, { sx: {
1726
- display: "grid",
1727
- gridTemplateColumns: {
1728
- xs: "1fr",
1729
- md: "320px 1fr"
1730
- },
1731
- gap: 3,
1732
- alignItems: "flex-start"
1733
- }, children: [
1734
- /* @__PURE__ */ n(ie, { sx: {
1735
- border: "1px solid",
1736
- borderColor: "divider",
1737
- borderRadius: 2,
1738
- p: 1.5,
1739
- maxHeight: "calc(100vh - 520px)",
1740
- overflowY: "auto"
1741
- }, children: ["tool", "resource", "prompt"].map((S) => {
1742
- const E = y.filter((W) => W.kind === S);
1743
- if (!E.length) return null;
1744
- const K = v[S];
1745
- return /* @__PURE__ */ l(ie, { sx: {
1746
- mb: 1
1747
- }, children: [
1748
- /* @__PURE__ */ l(ie, { onClick: () => P((W) => ({
1749
- ...W,
1750
- [S]: !K
1751
- })), sx: {
1752
- display: "flex",
1753
- alignItems: "center",
1754
- gap: 1,
1755
- px: 1,
1756
- py: 0.75,
1757
- cursor: "pointer",
1758
- "&:hover": {
1759
- bgcolor: "action.hover"
1760
- },
1761
- borderRadius: 1
1762
- }, children: [
1763
- K ? /* @__PURE__ */ n(gt, { size: 16 }) : /* @__PURE__ */ n(tt, { size: 16 }),
1764
- /* @__PURE__ */ l(z, { variant: "subtitle2", fontWeight: 600, children: [
1765
- wt[S],
1766
- "s"
1767
- ] }),
1768
- /* @__PURE__ */ n(Te, { label: E.length, size: "small", variant: "outlined", sx: {
1769
- ml: "auto"
1770
- } })
1771
- ] }),
1772
- /* @__PURE__ */ n(et, { in: K, children: /* @__PURE__ */ n(I, { spacing: 0.5, sx: {
1773
- pl: 1,
1774
- pt: 0.5
1775
- }, children: E.map((W) => {
1776
- const H = `${W.kind}::${W.backendId}`, D = m === H;
1777
- return /* @__PURE__ */ l(ie, { onClick: () => f(H), sx: {
1778
- display: "flex",
1779
- alignItems: "center",
1780
- gap: 1,
1781
- px: 1,
1782
- py: 0.75,
1783
- borderRadius: 1,
1784
- cursor: "pointer",
1785
- border: "1px solid",
1786
- borderColor: D ? "primary.main" : "transparent",
1787
- bgcolor: D ? "action.selected" : "transparent",
1788
- "&:hover": {
1789
- bgcolor: "action.hover"
1790
- }
1791
- }, children: [
1792
- /* @__PURE__ */ n(Te, { label: wt[W.kind], size: "small", color: un[W.kind], variant: "outlined", sx: {
1793
- minWidth: 72,
1794
- justifyContent: "center"
1795
- } }),
1796
- /* @__PURE__ */ n(He, { title: W.label, arrow: !0, placement: "right", children: /* @__PURE__ */ n(z, { variant: "body2", sx: {
1797
- flex: 1,
1798
- minWidth: 0,
1799
- fontFamily: "monospace",
1800
- overflow: "hidden",
1801
- textOverflow: "ellipsis",
1802
- whiteSpace: "nowrap"
1803
- }, children: W.label }) })
1804
- ] }, H);
1805
- }) }) })
1806
- ] }, S);
1807
- }) }),
1808
- /* @__PURE__ */ n(ie, { sx: {
1809
- border: "1px solid",
1810
- borderColor: "divider",
1811
- borderRadius: 2,
1812
- p: 2,
1813
- minHeight: 240
1814
- }, children: _ ? /* @__PURE__ */ n(Pi, { meta: _, state: g, onChangeTool: b, onChangeResource: R, onChangePrompt: L }) : /* @__PURE__ */ l(I, { alignItems: "center", justifyContent: "center", spacing: 1, sx: {
1815
- py: 6,
1816
- textAlign: "center"
1817
- }, children: [
1818
- /* @__PURE__ */ n(z, { variant: "subtitle2", fontWeight: 600, children: "Select a capability" }),
1819
- /* @__PURE__ */ n(z, { variant: "body2", color: "text.secondary", children: "Pick a tool, resource, or prompt from the list to configure its rewrite." })
1820
- ] }) })
1821
- ] }),
1822
- /* @__PURE__ */ l(I, { spacing: 1.5, children: [
1823
- /* @__PURE__ */ n(et, { in: F, timeout: 300, children: N && /* @__PURE__ */ n(ot, { severity: N.severity, onClose: () => M(null), sx: {
1824
- width: "100%"
1825
- }, children: N.message }) }),
1826
- /* @__PURE__ */ l(I, { direction: "row", spacing: 1.5, justifyContent: "flex-end", children: [
1827
- /* @__PURE__ */ n(Z, { variant: "outlined", onClick: V, disabled: !h || a, children: "Discard" }),
1828
- /* @__PURE__ */ n(Z, { variant: "contained", onClick: () => void C(), disabled: !h || a || i && !k, children: a ? "Saving..." : "Save" })
1829
- ] })
1830
- ] })
1831
- ] });
1832
- }
1833
- function Pi(t) {
1834
- const e = Ve(33), {
1835
- meta: r,
1836
- state: s,
1837
- onChangeTool: d,
1838
- onChangeResource: a,
1839
- onChangePrompt: o
1840
- } = t, [i, c] = T(!1), g = wt[r.kind], p = un[r.kind];
1841
- let y;
1842
- e[0] !== g || e[1] !== p ? (y = /* @__PURE__ */ n(Te, { label: g, size: "small", color: p, variant: "outlined" }), e[0] = g, e[1] = p, e[2] = y) : y = e[2];
1843
- let u;
1844
- e[3] === Symbol.for("react.memo_cache_sentinel") ? (u = {
1845
- fontFamily: "monospace"
1846
- }, e[3] = u) : u = e[3];
1847
- let m;
1848
- e[4] !== r.label ? (m = /* @__PURE__ */ n(z, { variant: "subtitle1", fontWeight: 600, sx: u, children: r.label }), e[4] = r.label, e[5] = m) : m = e[5];
1849
- let f;
1850
- e[6] !== y || e[7] !== m ? (f = /* @__PURE__ */ l(I, { direction: "row", alignItems: "center", spacing: 1, children: [
1851
- y,
1852
- m
1853
- ] }), e[6] = y, e[7] = m, e[8] = f) : f = e[8];
1854
- let v;
1855
- e[9] === Symbol.for("react.memo_cache_sentinel") ? (v = /* @__PURE__ */ n(z, { variant: "caption", color: "text.secondary", children: "Backend identifier — sent to the upstream MCP server. Rewrite the values below to control what clients see." }), e[9] = v) : v = e[9];
1856
- let P;
1857
- e[10] !== i || e[11] !== r.backendId || e[12] !== r.kind || e[13] !== d || e[14] !== s ? (P = r.kind === "tool" && /* @__PURE__ */ l(at, { children: [
1858
- /* @__PURE__ */ n($, { label: "Name", size: "small", fullWidth: !0, value: s.tool[r.backendId]?.name ?? "", onChange: (x) => d(r.backendId, {
1859
- name: x.target.value
1860
- }) }),
1861
- /* @__PURE__ */ n($, { label: "Description", size: "small", fullWidth: !0, multiline: !0, minRows: 2, value: s.tool[r.backendId]?.description ?? "", onChange: (x) => d(r.backendId, {
1862
- description: x.target.value
1863
- }) }),
1864
- /* @__PURE__ */ n($, { label: "Input Schema", size: "small", fullWidth: !0, multiline: !0, minRows: 6, value: s.tool[r.backendId]?.inputSchema ?? "", onChange: (x) => d(r.backendId, {
1865
- inputSchema: x.target.value
1866
- }), sx: {
1867
- "& .MuiInputBase-input": {
1868
- fontFamily: "monospace"
1869
- }
1870
- } }),
1871
- /* @__PURE__ */ l(ie, { children: [
1872
- /* @__PURE__ */ n(Z, { size: "small", variant: "text", onClick: () => c(ki), startIcon: i ? /* @__PURE__ */ n(gt, { size: 16 }) : /* @__PURE__ */ n(tt, { size: 16 }), children: "Advanced" }),
1873
- /* @__PURE__ */ n(et, { in: i, children: /* @__PURE__ */ l(I, { spacing: 2, sx: {
1874
- mt: 2
1875
- }, children: [
1876
- /* @__PURE__ */ n($, { label: "Output Schema", size: "small", fullWidth: !0, multiline: !0, minRows: 4, value: s.tool[r.backendId]?.outputSchema ?? "", onChange: (x) => d(r.backendId, {
1877
- outputSchema: x.target.value
1878
- }), sx: {
1879
- "& .MuiInputBase-input": {
1880
- fontFamily: "monospace"
1881
- }
1882
- } }),
1883
- /* @__PURE__ */ n($, { label: "Target", size: "small", fullWidth: !0, helperText: "Backend tool name to forward calls to.", value: s.tool[r.backendId]?.target ?? "", onChange: (x) => d(r.backendId, {
1884
- target: x.target.value
1885
- }), sx: {
1886
- "& .MuiInputBase-input": {
1887
- fontFamily: "monospace"
1888
- }
1889
- } })
1890
- ] }) })
1891
- ] })
1892
- ] }), e[10] = i, e[11] = r.backendId, e[12] = r.kind, e[13] = d, e[14] = s, e[15] = P) : P = e[15];
1893
- let N;
1894
- e[16] !== i || e[17] !== r.backendId || e[18] !== r.kind || e[19] !== a || e[20] !== s ? (N = r.kind === "resource" && /* @__PURE__ */ l(at, { children: [
1895
- /* @__PURE__ */ n($, { label: "URI", size: "small", fullWidth: !0, value: s.resource[r.backendId]?.uri ?? "", onChange: (x) => a(r.backendId, {
1896
- uri: x.target.value
1897
- }), sx: {
1898
- "& .MuiInputBase-input": {
1899
- fontFamily: "monospace"
1900
- }
1901
- } }),
1902
- /* @__PURE__ */ n($, { label: "Description", size: "small", fullWidth: !0, multiline: !0, minRows: 2, value: s.resource[r.backendId]?.description ?? "", onChange: (x) => a(r.backendId, {
1903
- description: x.target.value
1904
- }) }),
1905
- /* @__PURE__ */ l(ie, { children: [
1906
- /* @__PURE__ */ n(Z, { size: "small", variant: "text", onClick: () => c(Si), startIcon: i ? /* @__PURE__ */ n(gt, { size: 16 }) : /* @__PURE__ */ n(tt, { size: 16 }), children: "Advanced" }),
1907
- /* @__PURE__ */ n(et, { in: i, children: /* @__PURE__ */ n(I, { spacing: 2, sx: {
1908
- mt: 2
1909
- }, children: /* @__PURE__ */ n($, { label: "Target", size: "small", fullWidth: !0, helperText: "Backend resource URI to forward reads to.", value: s.resource[r.backendId]?.target ?? "", onChange: (x) => a(r.backendId, {
1910
- target: x.target.value
1911
- }), sx: {
1912
- "& .MuiInputBase-input": {
1913
- fontFamily: "monospace"
1914
- }
1915
- } }) }) })
1916
- ] })
1917
- ] }), e[16] = i, e[17] = r.backendId, e[18] = r.kind, e[19] = a, e[20] = s, e[21] = N) : N = e[21];
1918
- let M;
1919
- e[22] !== i || e[23] !== r.backendId || e[24] !== r.kind || e[25] !== o || e[26] !== s ? (M = r.kind === "prompt" && /* @__PURE__ */ l(at, { children: [
1920
- /* @__PURE__ */ n($, { label: "Name", size: "small", fullWidth: !0, value: s.prompt[r.backendId]?.name ?? "", onChange: (x) => o(r.backendId, {
1921
- name: x.target.value
1922
- }) }),
1923
- /* @__PURE__ */ n($, { label: "Description", size: "small", fullWidth: !0, multiline: !0, minRows: 2, value: s.prompt[r.backendId]?.description ?? "", onChange: (x) => o(r.backendId, {
1924
- description: x.target.value
1925
- }) }),
1926
- /* @__PURE__ */ l(ie, { children: [
1927
- /* @__PURE__ */ n(Z, { size: "small", variant: "text", onClick: () => c(Ii), startIcon: i ? /* @__PURE__ */ n(gt, { size: 16 }) : /* @__PURE__ */ n(tt, { size: 16 }), children: "Advanced" }),
1928
- /* @__PURE__ */ n(et, { in: i, children: /* @__PURE__ */ n(I, { spacing: 2, sx: {
1929
- mt: 2
1930
- }, children: /* @__PURE__ */ n($, { label: "Target", size: "small", fullWidth: !0, helperText: "Backend prompt name to forward requests to.", value: s.prompt[r.backendId]?.target ?? "", onChange: (x) => o(r.backendId, {
1931
- target: x.target.value
1932
- }), sx: {
1933
- "& .MuiInputBase-input": {
1934
- fontFamily: "monospace"
1935
- }
1936
- } }) }) })
1937
- ] })
1938
- ] }), e[22] = i, e[23] = r.backendId, e[24] = r.kind, e[25] = o, e[26] = s, e[27] = M) : M = e[27];
1939
- let A;
1940
- return e[28] !== M || e[29] !== f || e[30] !== P || e[31] !== N ? (A = /* @__PURE__ */ l(I, { spacing: 2, children: [
1941
- f,
1942
- v,
1943
- P,
1944
- N,
1945
- M
1946
- ] }), e[28] = M, e[29] = f, e[30] = P, e[31] = N, e[32] = A) : A = e[32], A;
1947
- }
1948
- function Ii(t) {
1949
- return !t;
1950
- }
1951
- function Si(t) {
1952
- return !t;
1953
- }
1954
- function ki(t) {
1955
- return !t;
1956
- }
1957
- const Ei = [{
1958
- value: "header",
1959
- label: "header"
1960
- }, {
1961
- value: "query",
1962
- label: "query"
1963
- }];
1964
- function Et(t) {
1965
- const e = t.security?.apiKey;
1966
- return t.security?.enabled !== !1 && !!e && e.enabled !== !1;
1967
- }
1968
- function Ai({
1969
- config: t,
1970
- selectedEnvironmentId: e,
1971
- isLoading: r = !1,
1972
- onUpdate: s,
1973
- isUpdating: d
1974
- }) {
1975
- const [a, o] = T("apiKey"), [i, c] = T(""), [g, p] = T("header"), [y, u] = T(null), [m, f] = T({}), v = Q(() => {
1976
- if (!t) return !1;
1977
- const x = Et(t) ? "apiKey" : "", k = t.security?.apiKey?.key ?? "", _ = t.security?.apiKey?.in ?? "header";
1978
- return a !== x || i.trim() !== k || g !== _;
1979
- }, [t, a, i, g]);
1980
- nt(() => {
1981
- if (!t || !e) return;
1982
- const A = Et(t);
1983
- o(A ? "apiKey" : ""), c(t.security?.apiKey?.key ?? (A ? "X-API-Key" : "")), p(t.security?.apiKey?.in ?? "header"), f({});
1984
- }, [t, e]);
1985
- const P = j(() => {
1986
- if (!t) return;
1987
- const A = Et(t);
1988
- o(A ? "apiKey" : ""), c(t.security?.apiKey?.key ?? (A ? "X-API-Key" : "")), p(t.security?.apiKey?.in ?? "header"), f({}), u(null);
1989
- }, [t]), N = j(async () => {
1990
- if (!t) return;
1991
- if (a === "apiKey" && i.trim().length === 0) {
1992
- const k = "API Key is required when using API Key authentication";
1993
- f({
1994
- keyValue: k
1995
- }), u({
1996
- message: k,
1997
- severity: "error"
1998
- });
1999
- return;
2000
- }
2001
- f({});
2002
- const A = i.trim(), x = g;
2003
- try {
2004
- await s({
2005
- security: {
2006
- enabled: t.security?.enabled ?? !0,
2007
- apiKey: {
2008
- enabled: a === "apiKey",
2009
- key: a === "apiKey" ? A : "",
2010
- in: x
2011
- }
2012
- }
2013
- }), f({}), u({
2014
- message: "Updated security settings.",
2015
- severity: "success"
2016
- });
2017
- } catch {
2018
- u({
2019
- message: "Failed to update security.",
2020
- severity: "error"
2021
- });
2022
- }
2023
- }, [t, a, i, g, s]), M = r || !t;
2024
- return r ? /* @__PURE__ */ l(I, { spacing: 2, children: [
2025
- /* @__PURE__ */ n(z, { variant: "h6", children: "Authentication" }),
2026
- /* @__PURE__ */ n(I, { spacing: 2, children: [1, 2, 3].map((A) => /* @__PURE__ */ l(I, { spacing: 0.5, children: [
2027
- /* @__PURE__ */ n(Ce, { variant: "text", width: 120, height: 16 }),
2028
- /* @__PURE__ */ n(Ce, { variant: "rounded", height: 40 })
2029
- ] }, A)) })
2030
- ] }) : t ? /* @__PURE__ */ l(I, { spacing: 2, children: [
2031
- /* @__PURE__ */ n(z, { variant: "h6", children: "Authentication" }),
2032
- /* @__PURE__ */ n(X, { container: !0, spacing: 3, children: /* @__PURE__ */ n(X, { size: {
2033
- xs: 12,
2034
- md: 5
2035
- }, children: /* @__PURE__ */ l(oe, { fullWidth: !0, disabled: M, children: [
2036
- /* @__PURE__ */ n(le, { children: "Authentication Method" }),
2037
- /* @__PURE__ */ l(At, { size: "small", value: a || "", onChange: (A) => o(A.target.value || ""), children: [
2038
- /* @__PURE__ */ n(ft, { value: "", children: "None" }),
2039
- /* @__PURE__ */ n(ft, { value: "apiKey", children: "apiKey" })
2040
- ] })
2041
- ] }) }) }),
2042
- a === "apiKey" && /* @__PURE__ */ l(X, { container: !0, spacing: 3, children: [
2043
- /* @__PURE__ */ n(X, { size: {
2044
- xs: 12,
2045
- md: 5
2046
- }, children: /* @__PURE__ */ l(oe, { fullWidth: !0, disabled: M, children: [
2047
- /* @__PURE__ */ n(le, { children: "Key Location" }),
2048
- /* @__PURE__ */ n(At, { size: "small", value: g, onChange: (A) => p(A.target.value), children: Ei.map((A) => /* @__PURE__ */ n(ft, { value: A.value, children: A.label }, A.value)) })
2049
- ] }) }),
2050
- /* @__PURE__ */ n(X, { size: {
2051
- xs: 12,
2052
- md: 5
2053
- }, children: /* @__PURE__ */ l(oe, { fullWidth: !0, disabled: M, error: !!m.keyValue, children: [
2054
- /* @__PURE__ */ n(le, { children: g === "query" ? "Query Param Key" : "Header Key" }),
2055
- /* @__PURE__ */ n($, { size: "small", value: i, onChange: (A) => {
2056
- c(A.target.value), m.keyValue && f({});
2057
- }, error: !!m.keyValue, helperText: m.keyValue, sx: {
2058
- "& .MuiInputBase-input": {
2059
- fontFamily: "monospace"
2060
- }
2061
- } })
2062
- ] }) })
2063
- ] }),
2064
- /* @__PURE__ */ l(I, { spacing: 1.5, width: "100%", children: [
2065
- /* @__PURE__ */ n(et, { in: !!y && !v, timeout: 300, children: y && /* @__PURE__ */ n(ot, { severity: y.severity, onClose: () => u(null), sx: {
2066
- width: "100%",
2067
- maxWidth: 480
2068
- }, children: y.message }) }),
2069
- /* @__PURE__ */ l(I, { direction: "row", spacing: 1.5, justifyContent: "flex-end", children: [
2070
- /* @__PURE__ */ n(Z, { variant: "outlined", onClick: P, disabled: !v || d, children: "Discard" }),
2071
- /* @__PURE__ */ n(Z, { variant: "contained", onClick: () => void N(), disabled: d || !v, children: d ? "Saving..." : "Save" })
2072
- ] })
2073
- ] })
2074
- ] }) : null;
2075
- }
2076
- function wi({
2077
- open: t,
2078
- orgId: e,
2079
- proxy: r,
2080
- environments: s,
2081
- onClose: d
2082
- }) {
2083
- const {
2084
- pushSnackBar: a
2085
- } = Bt(), o = Ft(), [i, c] = T([]), [g, p] = T(!1), [y, u] = T(null), m = ht(1);
2086
- nt(() => {
2087
- if (!t) return;
2088
- const b = Gn(r.environments ?? {});
2089
- c(b), m.current = b.length + 1, p(!1), u(null);
2090
- }, [t, r.environments]);
2091
- const f = Q(() => {
2092
- const b = /* @__PURE__ */ new Map();
2093
- return s.forEach((R) => {
2094
- R.id && b.set(R.id, R.displayName || R.name);
2095
- }), b;
2096
- }, [s]), v = Q(() => {
2097
- const b = /* @__PURE__ */ new Set();
2098
- return i.forEach((R) => {
2099
- R.environments.forEach((L) => b.add(L));
2100
- }), b;
2101
- }, [i]), P = Q(() => i.find((b) => b.id === y), [i, y]), N = Q(() => {
2102
- const b = new Set(P?.environments ?? []);
2103
- return s.filter((R) => !!R.id && (b.has(R.id) || !v.has(R.id)));
2104
- }, [s, v, P]), M = j(() => {
2105
- p(!1), u(null);
2106
- }, []), A = j((b) => {
2107
- const R = String(m.current);
2108
- m.current += 1, c((L) => [...L, {
2109
- ...b,
2110
- id: R
2111
- }]), p(!1);
2112
- }, []), x = j((b) => {
2113
- c((R) => R.map((L) => L.id === y ? {
2114
- ...b,
2115
- id: L.id
2116
- } : L)), u(null);
2117
- }, [y]), k = j((b) => {
2118
- c((R) => R.filter((L) => L.id !== b));
2119
- }, []), _ = j(async () => {
2120
- try {
2121
- const b = ei(i, r.environments ?? {});
2122
- await o.mutateAsync({
2123
- params: {
2124
- orgName: e,
2125
- proxyId: r.id
2126
- },
2127
- body: {
2128
- ...r,
2129
- environments: b
2130
- }
2131
- }), a({
2132
- message: "Endpoints updated successfully.",
2133
- type: "success"
2134
- }), d();
2135
- } catch (b) {
2136
- a({
2137
- message: b instanceof Error ? b.message : "Failed to update endpoints.",
2138
- type: "error"
2139
- });
2140
- }
2141
- }, [i, d, e, r, a, o]), w = o.isPending, h = s.length > 0 && s.every((b) => !!b.id && v.has(b.id));
2142
- return /* @__PURE__ */ l(at, { children: [
2143
- /* @__PURE__ */ l(Ht, { open: t, onClose: d, maxWidth: "md", fullWidth: !0, children: [
2144
- /* @__PURE__ */ n(Ut, { children: "Manage Endpoints" }),
2145
- /* @__PURE__ */ n($t, { children: /* @__PURE__ */ l(I, { spacing: 2, sx: {
2146
- mt: 1
2147
- }, children: [
2148
- /* @__PURE__ */ n(z, { variant: "body2", color: "text.secondary", children: "Endpoints map backend MCP servers to environments. Editing an endpoint updates the upstream URL, authentication, and capabilities for the environments it serves. Environments left without an endpoint become unconfigured." }),
2149
- i.length > 0 ? /* @__PURE__ */ n(I, { spacing: 1.5, children: i.map((b) => /* @__PURE__ */ n(sn, { endpoint: b, environmentLabels: f, onEdit: () => u(b.id), onRemove: () => k(b.id) }, b.id)) }) : /* @__PURE__ */ n(ie, { sx: {
2150
- border: "1px dashed",
2151
- borderColor: "divider",
2152
- borderRadius: 1,
2153
- px: 2,
2154
- py: 3,
2155
- textAlign: "center"
2156
- }, children: /* @__PURE__ */ n(z, { variant: "body2", color: "text.secondary", children: "No endpoints configured yet." }) }),
2157
- /* @__PURE__ */ n(ie, { children: /* @__PURE__ */ n(He, { title: h ? "All environments already have an endpoint." : "", disableHoverListener: !h, children: /* @__PURE__ */ n("span", { children: /* @__PURE__ */ n(Z, { variant: "outlined", startIcon: /* @__PURE__ */ n(Tt, { size: 16 }), onClick: () => p(!0), disabled: h || s.length === 0, children: "Add Endpoint" }) }) }) }),
2158
- s.length > 0 ? /* @__PURE__ */ l(z, { variant: "caption", color: "text.secondary", children: [
2159
- v.size,
2160
- " of ",
2161
- s.length,
2162
- " environments have an endpoint."
2163
- ] }) : null
2164
- ] }) }),
2165
- /* @__PURE__ */ l(qt, { children: [
2166
- /* @__PURE__ */ n(Z, { variant: "outlined", onClick: d, disabled: w, children: "Cancel" }),
2167
- /* @__PURE__ */ n(Z, { variant: "contained", onClick: () => void _(), disabled: w, startIcon: w ? /* @__PURE__ */ n(Nt, { size: 16, color: "inherit" }) : void 0, children: w ? "Saving" : "Save Changes" })
2168
- ] })
2169
- ] }),
2170
- /* @__PURE__ */ n(on, { open: g || y !== null, orgId: e, availableEnvironments: N, initialDraft: P, onClose: M, onAdd: y !== null ? x : A })
2171
- ] });
2172
- }
2173
- const Mi = ["Overview", "Capabilities", "Connection", "Access Control", "Security", "Rewrite", "Policies"];
2174
- function hn() {
2175
- const t = Ve(138), {
2176
- orgId: e,
2177
- proxyId: r
2178
- } = ut(), s = r ?? "", [d, a] = T(0), [o, i] = T(""), [c, g] = T(!1), [p, y] = T(!1), [u, m] = T(""), [f, v] = T(""), [P, N] = T(""), [M, A] = T("");
2179
- let x;
2180
- t[0] === Symbol.for("react.memo_cache_sentinel") ? (x = {
2181
- context: "",
2182
- description: "",
2183
- id: "",
2184
- name: "",
2185
- version: ""
2186
- }, t[0] = x) : x = t[0];
2187
- const [k, _] = T(x);
2188
- let w;
2189
- t[1] !== e || t[2] !== s ? (w = {
2190
- orgName: e,
2191
- proxyId: s
2192
- }, t[1] = e, t[2] = s, t[3] = w) : w = t[3];
2193
- const {
2194
- data: h,
2195
- isLoading: b,
2196
- error: R
2197
- } = Cn(w), L = e ?? "";
2198
- let C;
2199
- t[4] !== L ? (C = {
2200
- orgName: L
2201
- }, t[4] = L, t[5] = C) : C = t[5];
2202
- const {
2203
- data: V
2204
- } = Ot(C);
2205
- let F;
2206
- t[6] !== V ? (F = V === void 0 ? [] : V, t[6] = V, t[7] = F) : F = t[7];
2207
- const S = F, E = Ft();
2208
- h?.environments;
2209
- let K;
2210
- t[8] !== h?.environments ? (K = Object.keys(h?.environments ?? {}), t[8] = h?.environments, t[9] = K) : K = t[9];
2211
- const W = K;
2212
- let H;
2213
- t[10] !== W || t[11] !== S ? (H = W.map((O) => {
2214
- const ee = S.find((ae) => ae.id === O);
2215
- return {
2216
- id: O,
2217
- label: ee?.displayName ?? ee?.name ?? O
2218
- };
2219
- }), t[10] = W, t[11] = S, t[12] = H) : H = t[12];
2220
- const D = H;
2221
- let G, te;
2222
- t[13] !== W || t[14] !== o ? (G = () => {
2223
- W.length !== 0 && (W.includes(o) || i(W[0]));
2224
- }, te = [W, o], t[13] = W, t[14] = o, t[15] = G, t[16] = te) : (G = t[15], te = t[16]), nt(G, te);
2225
- let ne;
2226
- t[17] !== h?.environments || t[18] !== o ? (ne = () => h?.environments?.[o], t[17] = h?.environments, t[18] = o, t[19] = ne) : ne = t[19], h?.environments;
2227
- let ce;
2228
- t[20] !== ne ? (ce = ne(), t[20] = ne, t[21] = ce) : ce = t[21];
2229
- const q = ce;
2230
- let B;
2231
- t[22] !== e || t[23] !== h || t[24] !== o || t[25] !== E ? (B = async (O) => {
2232
- if (!e || !h?.id || !o)
2233
- throw new Error("MCP proxy or environment is not loaded.");
2234
- const ee = h.environments ?? {}, ae = {
2235
- ...ee[o],
2236
- ...O
2237
- };
2238
- return E.mutateAsync({
2239
- params: {
2240
- orgName: e,
2241
- proxyId: h.id
2242
- },
2243
- body: {
2244
- ...h,
2245
- environments: {
2246
- ...ee,
2247
- [o]: ae
2248
- }
2249
- }
2250
- });
2251
- }, t[22] = e, t[23] = h, t[24] = o, t[25] = E, t[26] = B) : B = t[26];
2252
- const Y = B, J = h?.name ?? h?.id ?? r ?? "MCP Proxy", xe = u !== k.name || f !== k.version || P !== k.context || M !== k.description, re = u.trim().length > 0 && f.trim().length > 0;
2253
- let Pe;
2254
- t[27] !== k.id || t[28] !== c || t[29] !== h?.context || t[30] !== h?.description || t[31] !== h?.id || t[32] !== h?.name || t[33] !== h?.version ? (Pe = () => {
2255
- const O = h?.id ?? "";
2256
- if (!(O !== k.id) && c)
2257
- return;
2258
- const ae = {
2259
- context: h?.context ?? "",
2260
- description: h?.description ?? "",
2261
- id: O,
2262
- name: h?.name ?? "",
2263
- version: h?.version ?? ""
2264
- };
2265
- m(ae.name), v(ae.version), N(ae.context), A(ae.description), _(ae), g(!1);
2266
- }, t[27] = k.id, t[28] = c, t[29] = h?.context, t[30] = h?.description, t[31] = h?.id, t[32] = h?.name, t[33] = h?.version, t[34] = Pe) : Pe = t[34];
2267
- const Ue = h?.id, $e = h?.name, je = h?.version, qe = h?.context, Ye = h?.description;
2268
- let Ke;
2269
- t[35] !== k.id || t[36] !== c || t[37] !== Ue || t[38] !== $e || t[39] !== je || t[40] !== qe || t[41] !== Ye ? (Ke = [k.id, c, Ue, $e, je, qe, Ye], t[35] = k.id, t[36] = c, t[37] = Ue, t[38] = $e, t[39] = je, t[40] = qe, t[41] = Ye, t[42] = Ke) : Ke = t[42], nt(Pe, Ke);
2270
- let Ie;
2271
- t[43] !== k.context || t[44] !== k.description || t[45] !== k.name || t[46] !== k.version ? (Ie = () => {
2272
- m(k.name), v(k.version), N(k.context), A(k.description), g(!1);
2273
- }, t[43] = k.context, t[44] = k.description, t[45] = k.name, t[46] = k.version, t[47] = Ie) : Ie = t[47];
2274
- const Ge = Ie;
2275
- let Be;
2276
- t[48] !== P || t[49] !== M || t[50] !== u || t[51] !== e || t[52] !== h || t[53] !== E || t[54] !== f ? (Be = async () => {
2277
- if (!e || !h?.id)
2278
- return;
2279
- const O = await E.mutateAsync({
2280
- params: {
2281
- orgName: e,
2282
- proxyId: h.id
2283
- },
2284
- body: {
2285
- ...h,
2286
- context: Vt(P),
2287
- description: Vt(M),
2288
- name: u.trim(),
2289
- version: f.trim()
2290
- }
2291
- }), ee = {
2292
- context: O.context ?? "",
2293
- description: O.description ?? "",
2294
- id: O.id ?? "",
2295
- name: O.name ?? "",
2296
- version: O.version ?? ""
2297
- };
2298
- m(ee.name), v(ee.version), N(ee.context), A(ee.description), _(ee), g(!1);
2299
- }, t[48] = P, t[49] = M, t[50] = u, t[51] = e, t[52] = h, t[53] = E, t[54] = f, t[55] = Be) : Be = t[55];
2300
- const it = Be;
2301
- if (b) {
2302
- let O;
2303
- return t[56] === Symbol.for("react.memo_cache_sentinel") ? (O = /* @__PURE__ */ n(xt, { fullWidth: !0, children: /* @__PURE__ */ l(I, { spacing: 4, children: [
2304
- /* @__PURE__ */ n(Ce, { variant: "rounded", height: 168 }),
2305
- /* @__PURE__ */ n(Ce, { variant: "rounded", height: 360 }),
2306
- /* @__PURE__ */ n(Ce, { variant: "rounded", height: 96 })
2307
- ] }) }), t[56] = O) : O = t[56], O;
2308
- }
2309
- if (R) {
2310
- let O;
2311
- t[57] === Symbol.for("react.memo_cache_sentinel") ? (O = /* @__PURE__ */ n(Mn, { size: 18 }), t[57] = O) : O = t[57];
2312
- const ee = R instanceof Error ? R.message : "Failed to load MCP proxy. Please try again.";
2313
- let ae;
2314
- return t[58] !== ee ? (ae = /* @__PURE__ */ n(xt, { fullWidth: !0, children: /* @__PURE__ */ n(ot, { severity: "error", icon: O, children: ee }) }), t[58] = ee, t[59] = ae) : ae = t[59], ae;
2315
- }
2316
- const de = W.length > 0;
2317
- let Oe;
2318
- t[60] === Symbol.for("react.memo_cache_sentinel") ? (Oe = {
2319
- p: 3
2320
- }, t[60] = Oe) : Oe = t[60];
2321
- let De;
2322
- t[61] === Symbol.for("react.memo_cache_sentinel") ? (De = {
2323
- xs: "column",
2324
- md: "row"
2325
- }, t[61] = De) : De = t[61];
2326
- let Je;
2327
- t[62] === Symbol.for("react.memo_cache_sentinel") ? (Je = {
2328
- bgcolor: "primary.main",
2329
- color: "primary.contrastText",
2330
- fontSize: 28,
2331
- fontWeight: 700,
2332
- height: 88,
2333
- width: 88
2334
- }, t[62] = Je) : Je = t[62];
2335
- let ue;
2336
- t[63] !== J ? (ue = en(J, {
2337
- fallback: "MP"
2338
- }), t[63] = J, t[64] = ue) : ue = t[64];
2339
- let he;
2340
- t[65] !== ue ? (he = /* @__PURE__ */ n(Yt, { sx: Je, children: ue }), t[65] = ue, t[66] = he) : he = t[66];
2341
- let Se;
2342
- t[67] !== J || t[68] !== c || t[69] !== u ? (Se = c ? /* @__PURE__ */ n($, { label: "Name", size: "small", value: u, onChange: (O) => m(O.target.value), error: u.trim().length === 0, helperText: u.trim().length === 0 ? "Name is required." : void 0, sx: {
2343
- minWidth: {
2344
- xs: "100%",
2345
- sm: 320
2346
- }
2347
- } }) : /* @__PURE__ */ n(z, { variant: "h4", fontWeight: 500, children: J }), t[67] = J, t[68] = c, t[69] = u, t[70] = Se) : Se = t[70];
2348
- let me;
2349
- t[71] !== c || t[72] !== h || t[73] !== f ? (me = c ? /* @__PURE__ */ n($, { label: "Version", size: "small", value: f, onChange: (O) => v(O.target.value), error: f.trim().length === 0, helperText: f.trim().length === 0 ? "Version is required." : void 0, sx: {
2350
- minWidth: 160
2351
- } }) : h?.version ? /* @__PURE__ */ n(Te, { label: Nn(h.version), size: "small", variant: "outlined" }) : null, t[71] = c, t[72] = h, t[73] = f, t[74] = me) : me = t[74];
2352
- let ke;
2353
- t[75] === Symbol.for("react.memo_cache_sentinel") ? (ke = () => g(!0), t[75] = ke) : ke = t[75];
2354
- let Ee;
2355
- t[76] === Symbol.for("react.memo_cache_sentinel") ? (Ee = /* @__PURE__ */ n(Zt, { size: 18 }), t[76] = Ee) : Ee = t[76];
2356
- let pe;
2357
- t[77] !== E.isPending ? (pe = /* @__PURE__ */ n(lt, { size: "small", onClick: ke, disabled: E.isPending, "aria-label": "Edit MCP proxy details", children: Ee }), t[77] = E.isPending, t[78] = pe) : pe = t[78];
2358
- let Ae;
2359
- t[79] !== Se || t[80] !== me || t[81] !== pe ? (Ae = /* @__PURE__ */ l(I, { direction: "row", spacing: 1, alignItems: "center", children: [
2360
- Se,
2361
- me,
2362
- pe
2363
- ] }), t[79] = Se, t[80] = me, t[81] = pe, t[82] = Ae) : Ae = t[82];
2364
- let Re;
2365
- t[83] !== P || t[84] !== M || t[85] !== c || t[86] !== h?.context || t[87] !== h?.description ? (Re = c ? /* @__PURE__ */ l(I, { spacing: 1.5, sx: {
2366
- maxWidth: 560
2367
- }, children: [
2368
- /* @__PURE__ */ n($, { label: "Context", size: "small", value: P, onChange: (O) => N(O.target.value), placeholder: "/default/my-mcp-proxy" }),
2369
- /* @__PURE__ */ n($, { label: "Description", size: "small", multiline: !0, minRows: 3, value: M, onChange: (O) => A(O.target.value) })
2370
- ] }) : /* @__PURE__ */ l(at, { children: [
2371
- /* @__PURE__ */ l(I, { direction: "row", spacing: 2, alignItems: "center", children: [
2372
- /* @__PURE__ */ n(z, { variant: "body2", color: "text.secondary", children: "Context :" }),
2373
- /* @__PURE__ */ n(z, { variant: "body2", children: h?.context ?? "-" })
2374
- ] }),
2375
- /* @__PURE__ */ n(z, { variant: "body2", color: "text.secondary", children: h?.description || "No description provided." })
2376
- ] }), t[83] = P, t[84] = M, t[85] = c, t[86] = h?.context, t[87] = h?.description, t[88] = Re) : Re = t[88];
2377
- let we, Me;
2378
- t[89] === Symbol.for("react.memo_cache_sentinel") ? (we = /* @__PURE__ */ n(z, { variant: "body2", color: "text.secondary", children: "Last updated :" }), Me = /* @__PURE__ */ n(_n, { size: 16 }), t[89] = we, t[90] = Me) : (we = t[89], Me = t[90]);
2379
- const rt = h?.updatedAt;
2380
- let fe;
2381
- t[91] !== rt ? (fe = tn(rt), t[91] = rt, t[92] = fe) : fe = t[92];
2382
- let ge;
2383
- t[93] !== fe ? (ge = /* @__PURE__ */ l(I, { direction: "row", spacing: 1, alignItems: "center", children: [
2384
- we,
2385
- Me,
2386
- /* @__PURE__ */ n(z, { variant: "body2", children: fe })
2387
- ] }), t[93] = fe, t[94] = ge) : ge = t[94];
2388
- let Le;
2389
- t[95] !== Ae || t[96] !== Re || t[97] !== ge ? (Le = /* @__PURE__ */ l(I, { spacing: 1, children: [
2390
- Ae,
2391
- Re,
2392
- ge
2393
- ] }), t[95] = Ae, t[96] = Re, t[97] = ge, t[98] = Le) : Le = t[98];
2394
- let We;
2395
- t[99] !== he || t[100] !== Le ? (We = /* @__PURE__ */ n(Ne, { variant: "outlined", sx: Oe, children: /* @__PURE__ */ n(I, { direction: De, spacing: 3, justifyContent: "space-between", children: /* @__PURE__ */ l(I, { direction: "row", spacing: 3, alignItems: "flex-start", children: [
2396
- he,
2397
- Le
2398
- ] }) }) }), t[99] = he, t[100] = Le, t[101] = We) : We = t[101];
2399
- let ye;
2400
- t[102] !== D || t[103] !== de || t[104] !== o ? (ye = de ? /* @__PURE__ */ l(I, { direction: "row", spacing: 2, alignItems: "center", children: [
2401
- /* @__PURE__ */ n(z, { variant: "body2", color: "text.secondary", children: "Environment" }),
2402
- /* @__PURE__ */ n(oe, { size: "small", sx: {
2403
- minWidth: 260
2404
- }, children: /* @__PURE__ */ n(At, { value: o, onChange: (O) => i(O.target.value), children: D.map(zi) }) })
2405
- ] }) : /* @__PURE__ */ n("span", {}), t[102] = D, t[103] = de, t[104] = o, t[105] = ye) : ye = t[105];
2406
- let _e;
2407
- t[106] === Symbol.for("react.memo_cache_sentinel") ? (_e = /* @__PURE__ */ n(Z, { variant: "outlined", startIcon: /* @__PURE__ */ n(zn, { size: 16 }), onClick: () => y(!0), children: "Manage Endpoints" }), t[106] = _e) : _e = t[106];
2408
- let ve;
2409
- t[107] !== ye ? (ve = /* @__PURE__ */ l(I, { direction: "row", spacing: 2, alignItems: "center", justifyContent: "space-between", children: [
2410
- ye,
2411
- _e
2412
- ] }), t[107] = ye, t[108] = ve) : ve = t[108];
2413
- let ze;
2414
- t[109] !== de || t[110] !== b || t[111] !== e || t[112] !== h || t[113] !== q || t[114] !== o || t[115] !== d || t[116] !== E.isPending || t[117] !== Y ? (ze = de ? /* @__PURE__ */ l(Ne, { variant: "outlined", children: [
2415
- /* @__PURE__ */ n(kn, { value: d, onChange: (O, ee) => a(ee), children: Mi.map(_i) }),
2416
- /* @__PURE__ */ n(zt, {}),
2417
- /* @__PURE__ */ l(ie, { sx: {
2418
- p: 3
2419
- }, children: [
2420
- d === 0 && /* @__PURE__ */ n(mi, { proxy: h, config: q, isLoading: b }),
2421
- d === 1 && /* @__PURE__ */ n(rn, { tools: q?.capabilities?.tools, resources: q?.capabilities?.resources, prompts: q?.capabilities?.prompts, sectionTitleVariant: "h6" }),
2422
- d === 2 && /* @__PURE__ */ n(di, { config: q, selectedEnvironmentId: o, isLoading: b, onUpdate: Y, isUpdating: E.isPending }),
2423
- d === 3 && /* @__PURE__ */ n(ci, { config: q, selectedEnvironmentId: o, orgName: e, isLoading: b, onUpdate: Y, isUpdating: E.isPending }),
2424
- d === 4 && /* @__PURE__ */ n(Ai, { config: q, selectedEnvironmentId: o, isLoading: b, onUpdate: Y, isUpdating: E.isPending }),
2425
- d === 5 && /* @__PURE__ */ n(Ci, { config: q, selectedEnvironmentId: o, orgName: e, isLoading: b, onUpdate: Y, isUpdating: E.isPending }),
2426
- d === 6 && /* @__PURE__ */ n(yi, { config: q, selectedEnvironmentId: o, orgName: e, onUpdate: Y, isUpdating: E.isPending })
2427
- ] })
2428
- ] }) : /* @__PURE__ */ n(Ne, { variant: "outlined", sx: {
2429
- p: 3
2430
- }, children: /* @__PURE__ */ n(ot, { severity: "info", children: "This MCP proxy has no environments configured." }) }), t[109] = de, t[110] = b, t[111] = e, t[112] = h, t[113] = q, t[114] = o, t[115] = d, t[116] = E.isPending, t[117] = Y, t[118] = ze) : ze = t[118];
2431
- let U;
2432
- t[119] !== re || t[120] !== it || t[121] !== xe || t[122] !== Ge || t[123] !== E.isPending ? (U = xe ? /* @__PURE__ */ n(Ne, { variant: "outlined", sx: {
2433
- p: 2
2434
- }, children: /* @__PURE__ */ l(I, { direction: "row", justifyContent: "space-between", spacing: 1, children: [
2435
- /* @__PURE__ */ n(z, { variant: "body2", color: "warning.main", fontWeight: 600, children: "You have unsaved changes." }),
2436
- /* @__PURE__ */ l(I, { direction: "row", justifyContent: "flex-end", spacing: 1, children: [
2437
- /* @__PURE__ */ n(Z, { variant: "outlined", disabled: E.isPending, onClick: Ge, children: "Cancel" }),
2438
- /* @__PURE__ */ n(Z, { variant: "contained", disabled: !re || E.isPending, onClick: it, children: E.isPending ? "Saving..." : "Save" })
2439
- ] })
2440
- ] }) }) : null, t[119] = re, t[120] = it, t[121] = xe, t[122] = Ge, t[123] = E.isPending, t[124] = U) : U = t[124];
2441
- let se;
2442
- t[125] !== We || t[126] !== ve || t[127] !== ze || t[128] !== U ? (se = /* @__PURE__ */ l(I, { spacing: 4, children: [
2443
- We,
2444
- ve,
2445
- ze,
2446
- U
2447
- ] }), t[125] = We, t[126] = ve, t[127] = ze, t[128] = U, t[129] = se) : se = t[129];
2448
- let Xe;
2449
- t[130] !== S || t[131] !== p || t[132] !== e || t[133] !== h ? (Xe = h ? /* @__PURE__ */ n(wi, { open: p, orgId: e ?? "", proxy: h, environments: S, onClose: () => y(!1) }) : null, t[130] = S, t[131] = p, t[132] = e, t[133] = h, t[134] = Xe) : Xe = t[134];
2450
- let st;
2451
- return t[135] !== se || t[136] !== Xe ? (st = /* @__PURE__ */ l(xt, { fullWidth: !0, children: [
2452
- se,
2453
- Xe
2454
- ] }), t[135] = se, t[136] = Xe, t[137] = st) : st = t[137], st;
2455
- }
2456
- function _i(t) {
2457
- return /* @__PURE__ */ n(En, { label: t }, t);
2458
- }
2459
- function zi(t) {
2460
- return /* @__PURE__ */ n(ft, { value: t.id, children: t.label }, t.id);
2461
- }
2462
- function Vt(t) {
2463
- const e = t.trim();
2464
- return e.length > 0 ? e : void 0;
2465
- }
2466
- const Kt = () => {
2467
- const t = Ve(25), {
2468
- orgId: e
2469
- } = ut(), r = e ?? "";
2470
- let s, d, a, o, i, c, g, p;
2471
- if (t[0] !== r) {
2472
- const f = {
2473
- orgId: r
2474
- };
2475
- a = pn, t[9] === Symbol.for("react.memo_cache_sentinel") ? (c = /* @__PURE__ */ n(mt, { index: !0, element: /* @__PURE__ */ n(Dt, { title: "MCP Proxies", disableIcon: !0, children: /* @__PURE__ */ n(ii, {}) }) }), t[9] = c) : c = t[9], t[10] === Symbol.for("react.memo_cache_sentinel") ? (g = /* @__PURE__ */ n(mt, { path: "add", element: /* @__PURE__ */ n(cn, {}) }), t[10] = g) : g = t[10], t[11] === Symbol.for("react.memo_cache_sentinel") ? (p = /* @__PURE__ */ n(mt, { path: "view/:proxyId", element: /* @__PURE__ */ n(hn, {}) }), t[11] = p) : p = t[11], d = mt, i = "*", s = fn, o = ct(dt.children.org.children.mcpProxies.path, f), t[0] = r, t[1] = s, t[2] = d, t[3] = a, t[4] = o, t[5] = i, t[6] = c, t[7] = g, t[8] = p;
2476
- } else
2477
- s = t[1], d = t[2], a = t[3], o = t[4], i = t[5], c = t[6], g = t[7], p = t[8];
2478
- let y;
2479
- t[12] !== s || t[13] !== o ? (y = /* @__PURE__ */ n(s, { to: o, replace: !0 }), t[12] = s, t[13] = o, t[14] = y) : y = t[14];
2480
- let u;
2481
- t[15] !== d || t[16] !== i || t[17] !== y ? (u = /* @__PURE__ */ n(d, { path: i, element: y }), t[15] = d, t[16] = i, t[17] = y, t[18] = u) : u = t[18];
2482
- let m;
2483
- return t[19] !== a || t[20] !== c || t[21] !== g || t[22] !== p || t[23] !== u ? (m = /* @__PURE__ */ l(a, { children: [
2484
- c,
2485
- g,
2486
- p,
2487
- u
2488
- ] }), t[19] = a, t[20] = c, t[21] = g, t[22] = p, t[23] = u, t[24] = m) : m = t[24], m;
2489
- }, Ui = {
2490
- title: "MCP Proxies",
2491
- description: "A page component for MCP Proxy management",
2492
- icon: Qt,
2493
- path: "/mcp-proxies",
2494
- component: Kt,
2495
- levels: {
2496
- organization: Kt,
2497
- addMCPProxyOrganization: cn,
2498
- viewMCPProxyOrganization: hn
2499
- }
2500
- };
2501
- export {
2502
- cn as AddMCPProxyOrganization,
2503
- Qt as MCPLogo,
2504
- Kt as MCPProxiesOrganization,
2505
- hn as ViewMCPProxy,
2506
- Ui as metaData
2507
- };