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