@trops/dash-core 0.1.58 → 0.1.60
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/index.esm.js +85 -25
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +85 -25
- package/dist/index.js.map +1 -1
- package/dist/mcp/mcpServerCatalog.json +4 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -26604,6 +26604,10 @@ var CustomMcpServerForm = function CustomMcpServerForm(_ref2) {
|
|
|
26604
26604
|
isEditMode = _ref2$isEditMode === void 0 ? false : _ref2$isEditMode,
|
|
26605
26605
|
_ref2$initialName = _ref2.initialName,
|
|
26606
26606
|
initialName = _ref2$initialName === void 0 ? "" : _ref2$initialName,
|
|
26607
|
+
_ref2$initialProvider = _ref2.initialProviderType,
|
|
26608
|
+
initialProviderType = _ref2$initialProvider === void 0 ? "custom" : _ref2$initialProvider,
|
|
26609
|
+
_ref2$initialCredenti = _ref2.initialCredentialSchema,
|
|
26610
|
+
initialCredentialSchema = _ref2$initialCredenti === void 0 ? {} : _ref2$initialCredenti,
|
|
26607
26611
|
_ref2$initialTranspor = _ref2.initialTransport,
|
|
26608
26612
|
initialTransport = _ref2$initialTranspor === void 0 ? "stdio" : _ref2$initialTranspor,
|
|
26609
26613
|
_ref2$initialCommand = _ref2.initialCommand,
|
|
@@ -26616,8 +26620,8 @@ var CustomMcpServerForm = function CustomMcpServerForm(_ref2) {
|
|
|
26616
26620
|
initialUrl = _ref2$initialUrl === void 0 ? "" : _ref2$initialUrl,
|
|
26617
26621
|
_ref2$initialHeaderRo = _ref2.initialHeaderRows,
|
|
26618
26622
|
initialHeaderRows = _ref2$initialHeaderRo === void 0 ? [] : _ref2$initialHeaderRo,
|
|
26619
|
-
_ref2$
|
|
26620
|
-
initialCredentials = _ref2$
|
|
26623
|
+
_ref2$initialCredenti2 = _ref2.initialCredentials,
|
|
26624
|
+
initialCredentials = _ref2$initialCredenti2 === void 0 ? {} : _ref2$initialCredenti2;
|
|
26621
26625
|
var appContext = React.useContext(AppContext);
|
|
26622
26626
|
var dashApi = appContext === null || appContext === void 0 ? void 0 : appContext.dashApi;
|
|
26623
26627
|
|
|
@@ -26709,8 +26713,8 @@ var CustomMcpServerForm = function CustomMcpServerForm(_ref2) {
|
|
|
26709
26713
|
|
|
26710
26714
|
// Derive credential fields from the live mcpConfig
|
|
26711
26715
|
var formFields = React.useMemo(function () {
|
|
26712
|
-
return deriveFormFields(mcpConfig,
|
|
26713
|
-
}, [mcpConfig]);
|
|
26716
|
+
return deriveFormFields(mcpConfig, initialCredentialSchema);
|
|
26717
|
+
}, [mcpConfig, initialCredentialSchema]);
|
|
26714
26718
|
|
|
26715
26719
|
// --- envMapping row handlers ---
|
|
26716
26720
|
var addEnvRow = function addEnvRow() {
|
|
@@ -26886,11 +26890,11 @@ var CustomMcpServerForm = function CustomMcpServerForm(_ref2) {
|
|
|
26886
26890
|
url: result.url,
|
|
26887
26891
|
headerRows: result.headerRows
|
|
26888
26892
|
});
|
|
26889
|
-
onSave(name,
|
|
26893
|
+
onSave(name, initialProviderType, result.credentialData, config);
|
|
26890
26894
|
return;
|
|
26891
26895
|
}
|
|
26892
26896
|
if (!validateForm()) return;
|
|
26893
|
-
onSave(providerName.trim(),
|
|
26897
|
+
onSave(providerName.trim(), initialProviderType, credentialData, mcpConfig);
|
|
26894
26898
|
};
|
|
26895
26899
|
return /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
26896
26900
|
className: "flex flex-col flex-1 min-h-0",
|
|
@@ -27387,30 +27391,38 @@ var McpCatalogDetail = function McpCatalogDetail(_ref) {
|
|
|
27387
27391
|
_useState14 = _slicedToArray(_useState13, 2),
|
|
27388
27392
|
isCustom = _useState14[0],
|
|
27389
27393
|
setIsCustom = _useState14[1];
|
|
27390
|
-
|
|
27391
|
-
// Configuration form state
|
|
27392
|
-
var _useState15 = React.useState(""),
|
|
27394
|
+
var _useState15 = React.useState(false),
|
|
27393
27395
|
_useState16 = _slicedToArray(_useState15, 2),
|
|
27394
|
-
|
|
27395
|
-
|
|
27396
|
-
var _useState17 = React.useState(
|
|
27396
|
+
isAuthorizing = _useState16[0],
|
|
27397
|
+
setIsAuthorizing = _useState16[1];
|
|
27398
|
+
var _useState17 = React.useState(null),
|
|
27397
27399
|
_useState18 = _slicedToArray(_useState17, 2),
|
|
27398
|
-
|
|
27399
|
-
|
|
27400
|
-
var _useState19 = React.useState({}),
|
|
27401
|
-
_useState20 = _slicedToArray(_useState19, 2),
|
|
27402
|
-
formErrors = _useState20[0],
|
|
27403
|
-
setFormErrors = _useState20[1];
|
|
27400
|
+
authResult = _useState18[0],
|
|
27401
|
+
setAuthResult = _useState18[1];
|
|
27404
27402
|
|
|
27405
|
-
//
|
|
27406
|
-
var
|
|
27403
|
+
// Configuration form state
|
|
27404
|
+
var _useState19 = React.useState(""),
|
|
27405
|
+
_useState20 = _slicedToArray(_useState19, 2),
|
|
27406
|
+
providerName = _useState20[0],
|
|
27407
|
+
setProviderName = _useState20[1];
|
|
27408
|
+
var _useState21 = React.useState({}),
|
|
27407
27409
|
_useState22 = _slicedToArray(_useState21, 2),
|
|
27408
|
-
|
|
27409
|
-
|
|
27410
|
-
var _useState23 = React.useState(
|
|
27410
|
+
credentialData = _useState22[0],
|
|
27411
|
+
setCredentialData = _useState22[1];
|
|
27412
|
+
var _useState23 = React.useState({}),
|
|
27411
27413
|
_useState24 = _slicedToArray(_useState23, 2),
|
|
27412
|
-
|
|
27413
|
-
|
|
27414
|
+
formErrors = _useState24[0],
|
|
27415
|
+
setFormErrors = _useState24[1];
|
|
27416
|
+
|
|
27417
|
+
// Advanced config row state
|
|
27418
|
+
var _useState25 = React.useState([]),
|
|
27419
|
+
_useState26 = _slicedToArray(_useState25, 2),
|
|
27420
|
+
envMappingRows = _useState26[0],
|
|
27421
|
+
setEnvMappingRows = _useState26[1];
|
|
27422
|
+
var _useState27 = React.useState([]),
|
|
27423
|
+
_useState28 = _slicedToArray(_useState27, 2),
|
|
27424
|
+
headerRows = _useState28[0],
|
|
27425
|
+
setHeaderRows = _useState28[1];
|
|
27414
27426
|
var rowIdRef = React.useRef(0);
|
|
27415
27427
|
var nextRowId = function nextRowId() {
|
|
27416
27428
|
return "cat_".concat(++rowIdRef.current);
|
|
@@ -27457,6 +27469,7 @@ var McpCatalogDetail = function McpCatalogDetail(_ref) {
|
|
|
27457
27469
|
setSelectedServer(server);
|
|
27458
27470
|
setIsConfiguring(true);
|
|
27459
27471
|
setTestResult(null);
|
|
27472
|
+
setAuthResult(null);
|
|
27460
27473
|
setProviderName(server.name);
|
|
27461
27474
|
setCredentialData({});
|
|
27462
27475
|
setFormErrors({});
|
|
@@ -27528,6 +27541,33 @@ var McpCatalogDetail = function McpCatalogDetail(_ref) {
|
|
|
27528
27541
|
});
|
|
27529
27542
|
};
|
|
27530
27543
|
|
|
27544
|
+
// Handle authorize (OAuth browser flow)
|
|
27545
|
+
var handleAuthorize = function handleAuthorize() {
|
|
27546
|
+
if (!dashApi || !(selectedServer !== null && selectedServer !== void 0 && selectedServer.authCommand)) return;
|
|
27547
|
+
setIsAuthorizing(true);
|
|
27548
|
+
setAuthResult(null);
|
|
27549
|
+
dashApi.mcpRunAuth(effectiveMcpConfig, credentialData, selectedServer.authCommand, function (event, result) {
|
|
27550
|
+
if (result.error) {
|
|
27551
|
+
setAuthResult({
|
|
27552
|
+
success: false,
|
|
27553
|
+
message: result.message
|
|
27554
|
+
});
|
|
27555
|
+
} else {
|
|
27556
|
+
setAuthResult({
|
|
27557
|
+
success: true,
|
|
27558
|
+
message: "Authorized!"
|
|
27559
|
+
});
|
|
27560
|
+
}
|
|
27561
|
+
setIsAuthorizing(false);
|
|
27562
|
+
}, function (event, err) {
|
|
27563
|
+
setAuthResult({
|
|
27564
|
+
success: false,
|
|
27565
|
+
message: (err === null || err === void 0 ? void 0 : err.message) || "Authorization failed"
|
|
27566
|
+
});
|
|
27567
|
+
setIsAuthorizing(false);
|
|
27568
|
+
});
|
|
27569
|
+
};
|
|
27570
|
+
|
|
27531
27571
|
// Handle save
|
|
27532
27572
|
var handleSaveProvider = function handleSaveProvider() {
|
|
27533
27573
|
if (!selectedServer || !validateForm()) return;
|
|
@@ -27551,6 +27591,7 @@ var McpCatalogDetail = function McpCatalogDetail(_ref) {
|
|
|
27551
27591
|
setIsConfiguring(false);
|
|
27552
27592
|
setIsCustom(false);
|
|
27553
27593
|
setTestResult(null);
|
|
27594
|
+
setAuthResult(null);
|
|
27554
27595
|
setProviderName("");
|
|
27555
27596
|
setCredentialData({});
|
|
27556
27597
|
setFormErrors({});
|
|
@@ -27739,6 +27780,16 @@ var McpCatalogDetail = function McpCatalogDetail(_ref) {
|
|
|
27739
27780
|
})]
|
|
27740
27781
|
}, field.key);
|
|
27741
27782
|
})]
|
|
27783
|
+
}), authResult && /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
27784
|
+
className: "p-3 rounded-lg text-sm ".concat(authResult.success ? "bg-green-900/30 border border-green-700 text-green-300" : "bg-red-900/30 border border-red-700 text-red-300"),
|
|
27785
|
+
children: /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
27786
|
+
className: "flex items-center gap-2",
|
|
27787
|
+
children: [/*#__PURE__*/jsxRuntime.jsx(DashReact.FontAwesomeIcon, {
|
|
27788
|
+
icon: authResult.success ? "circle-check" : "circle-exclamation"
|
|
27789
|
+
}), /*#__PURE__*/jsxRuntime.jsx("span", {
|
|
27790
|
+
children: authResult.message
|
|
27791
|
+
})]
|
|
27792
|
+
})
|
|
27742
27793
|
}), testResult && /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
27743
27794
|
className: "p-3 rounded-lg text-sm ".concat(testResult.success ? "bg-green-900/30 border border-green-700 text-green-300" : "bg-red-900/30 border border-red-700 text-red-300"),
|
|
27744
27795
|
children: [/*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
@@ -27770,6 +27821,10 @@ var McpCatalogDetail = function McpCatalogDetail(_ref) {
|
|
|
27770
27821
|
title: "Cancel",
|
|
27771
27822
|
onClick: onCancel,
|
|
27772
27823
|
size: "sm"
|
|
27824
|
+
}), (selectedServer === null || selectedServer === void 0 ? void 0 : selectedServer.authCommand) && /*#__PURE__*/jsxRuntime.jsx(DashReact.Button, {
|
|
27825
|
+
title: isAuthorizing ? "Authorizing..." : "Authorize",
|
|
27826
|
+
onClick: handleAuthorize,
|
|
27827
|
+
size: "sm"
|
|
27773
27828
|
}), /*#__PURE__*/jsxRuntime.jsx(DashReact.Button, {
|
|
27774
27829
|
title: isTesting ? "Testing..." : "Test Connection",
|
|
27775
27830
|
onClick: handleTestConnection,
|
|
@@ -28181,9 +28236,14 @@ var ProvidersSection = function ProvidersSection(_ref) {
|
|
|
28181
28236
|
});
|
|
28182
28237
|
} else if (isEditingMcp && selectedName && selectedProvider) {
|
|
28183
28238
|
var mc = selectedProvider.mcpConfig || {};
|
|
28239
|
+
var editCatalogEntry = catalog.find(function (entry) {
|
|
28240
|
+
return entry.id === selectedProvider.type;
|
|
28241
|
+
});
|
|
28184
28242
|
detailContent = /*#__PURE__*/jsxRuntime.jsx(CustomMcpServerForm, {
|
|
28185
28243
|
isEditMode: true,
|
|
28186
28244
|
initialName: selectedName,
|
|
28245
|
+
initialProviderType: selectedProvider.type || "custom",
|
|
28246
|
+
initialCredentialSchema: (editCatalogEntry === null || editCatalogEntry === void 0 ? void 0 : editCatalogEntry.credentialSchema) || {},
|
|
28187
28247
|
initialTransport: mc.transport || "stdio",
|
|
28188
28248
|
initialCommand: mc.command || "",
|
|
28189
28249
|
initialArgs: (mc.args || []).join(" "),
|