@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.esm.js
CHANGED
|
@@ -26585,6 +26585,10 @@ var CustomMcpServerForm = function CustomMcpServerForm(_ref2) {
|
|
|
26585
26585
|
isEditMode = _ref2$isEditMode === void 0 ? false : _ref2$isEditMode,
|
|
26586
26586
|
_ref2$initialName = _ref2.initialName,
|
|
26587
26587
|
initialName = _ref2$initialName === void 0 ? "" : _ref2$initialName,
|
|
26588
|
+
_ref2$initialProvider = _ref2.initialProviderType,
|
|
26589
|
+
initialProviderType = _ref2$initialProvider === void 0 ? "custom" : _ref2$initialProvider,
|
|
26590
|
+
_ref2$initialCredenti = _ref2.initialCredentialSchema,
|
|
26591
|
+
initialCredentialSchema = _ref2$initialCredenti === void 0 ? {} : _ref2$initialCredenti,
|
|
26588
26592
|
_ref2$initialTranspor = _ref2.initialTransport,
|
|
26589
26593
|
initialTransport = _ref2$initialTranspor === void 0 ? "stdio" : _ref2$initialTranspor,
|
|
26590
26594
|
_ref2$initialCommand = _ref2.initialCommand,
|
|
@@ -26597,8 +26601,8 @@ var CustomMcpServerForm = function CustomMcpServerForm(_ref2) {
|
|
|
26597
26601
|
initialUrl = _ref2$initialUrl === void 0 ? "" : _ref2$initialUrl,
|
|
26598
26602
|
_ref2$initialHeaderRo = _ref2.initialHeaderRows,
|
|
26599
26603
|
initialHeaderRows = _ref2$initialHeaderRo === void 0 ? [] : _ref2$initialHeaderRo,
|
|
26600
|
-
_ref2$
|
|
26601
|
-
initialCredentials = _ref2$
|
|
26604
|
+
_ref2$initialCredenti2 = _ref2.initialCredentials,
|
|
26605
|
+
initialCredentials = _ref2$initialCredenti2 === void 0 ? {} : _ref2$initialCredenti2;
|
|
26602
26606
|
var appContext = useContext(AppContext);
|
|
26603
26607
|
var dashApi = appContext === null || appContext === void 0 ? void 0 : appContext.dashApi;
|
|
26604
26608
|
|
|
@@ -26690,8 +26694,8 @@ var CustomMcpServerForm = function CustomMcpServerForm(_ref2) {
|
|
|
26690
26694
|
|
|
26691
26695
|
// Derive credential fields from the live mcpConfig
|
|
26692
26696
|
var formFields = useMemo(function () {
|
|
26693
|
-
return deriveFormFields(mcpConfig,
|
|
26694
|
-
}, [mcpConfig]);
|
|
26697
|
+
return deriveFormFields(mcpConfig, initialCredentialSchema);
|
|
26698
|
+
}, [mcpConfig, initialCredentialSchema]);
|
|
26695
26699
|
|
|
26696
26700
|
// --- envMapping row handlers ---
|
|
26697
26701
|
var addEnvRow = function addEnvRow() {
|
|
@@ -26867,11 +26871,11 @@ var CustomMcpServerForm = function CustomMcpServerForm(_ref2) {
|
|
|
26867
26871
|
url: result.url,
|
|
26868
26872
|
headerRows: result.headerRows
|
|
26869
26873
|
});
|
|
26870
|
-
onSave(name,
|
|
26874
|
+
onSave(name, initialProviderType, result.credentialData, config);
|
|
26871
26875
|
return;
|
|
26872
26876
|
}
|
|
26873
26877
|
if (!validateForm()) return;
|
|
26874
|
-
onSave(providerName.trim(),
|
|
26878
|
+
onSave(providerName.trim(), initialProviderType, credentialData, mcpConfig);
|
|
26875
26879
|
};
|
|
26876
26880
|
return /*#__PURE__*/jsxs("div", {
|
|
26877
26881
|
className: "flex flex-col flex-1 min-h-0",
|
|
@@ -27368,30 +27372,38 @@ var McpCatalogDetail = function McpCatalogDetail(_ref) {
|
|
|
27368
27372
|
_useState14 = _slicedToArray(_useState13, 2),
|
|
27369
27373
|
isCustom = _useState14[0],
|
|
27370
27374
|
setIsCustom = _useState14[1];
|
|
27371
|
-
|
|
27372
|
-
// Configuration form state
|
|
27373
|
-
var _useState15 = useState(""),
|
|
27375
|
+
var _useState15 = useState(false),
|
|
27374
27376
|
_useState16 = _slicedToArray(_useState15, 2),
|
|
27375
|
-
|
|
27376
|
-
|
|
27377
|
-
var _useState17 = useState(
|
|
27377
|
+
isAuthorizing = _useState16[0],
|
|
27378
|
+
setIsAuthorizing = _useState16[1];
|
|
27379
|
+
var _useState17 = useState(null),
|
|
27378
27380
|
_useState18 = _slicedToArray(_useState17, 2),
|
|
27379
|
-
|
|
27380
|
-
|
|
27381
|
-
var _useState19 = useState({}),
|
|
27382
|
-
_useState20 = _slicedToArray(_useState19, 2),
|
|
27383
|
-
formErrors = _useState20[0],
|
|
27384
|
-
setFormErrors = _useState20[1];
|
|
27381
|
+
authResult = _useState18[0],
|
|
27382
|
+
setAuthResult = _useState18[1];
|
|
27385
27383
|
|
|
27386
|
-
//
|
|
27387
|
-
var
|
|
27384
|
+
// Configuration form state
|
|
27385
|
+
var _useState19 = useState(""),
|
|
27386
|
+
_useState20 = _slicedToArray(_useState19, 2),
|
|
27387
|
+
providerName = _useState20[0],
|
|
27388
|
+
setProviderName = _useState20[1];
|
|
27389
|
+
var _useState21 = useState({}),
|
|
27388
27390
|
_useState22 = _slicedToArray(_useState21, 2),
|
|
27389
|
-
|
|
27390
|
-
|
|
27391
|
-
var _useState23 = useState(
|
|
27391
|
+
credentialData = _useState22[0],
|
|
27392
|
+
setCredentialData = _useState22[1];
|
|
27393
|
+
var _useState23 = useState({}),
|
|
27392
27394
|
_useState24 = _slicedToArray(_useState23, 2),
|
|
27393
|
-
|
|
27394
|
-
|
|
27395
|
+
formErrors = _useState24[0],
|
|
27396
|
+
setFormErrors = _useState24[1];
|
|
27397
|
+
|
|
27398
|
+
// Advanced config row state
|
|
27399
|
+
var _useState25 = useState([]),
|
|
27400
|
+
_useState26 = _slicedToArray(_useState25, 2),
|
|
27401
|
+
envMappingRows = _useState26[0],
|
|
27402
|
+
setEnvMappingRows = _useState26[1];
|
|
27403
|
+
var _useState27 = useState([]),
|
|
27404
|
+
_useState28 = _slicedToArray(_useState27, 2),
|
|
27405
|
+
headerRows = _useState28[0],
|
|
27406
|
+
setHeaderRows = _useState28[1];
|
|
27395
27407
|
var rowIdRef = useRef(0);
|
|
27396
27408
|
var nextRowId = function nextRowId() {
|
|
27397
27409
|
return "cat_".concat(++rowIdRef.current);
|
|
@@ -27438,6 +27450,7 @@ var McpCatalogDetail = function McpCatalogDetail(_ref) {
|
|
|
27438
27450
|
setSelectedServer(server);
|
|
27439
27451
|
setIsConfiguring(true);
|
|
27440
27452
|
setTestResult(null);
|
|
27453
|
+
setAuthResult(null);
|
|
27441
27454
|
setProviderName(server.name);
|
|
27442
27455
|
setCredentialData({});
|
|
27443
27456
|
setFormErrors({});
|
|
@@ -27509,6 +27522,33 @@ var McpCatalogDetail = function McpCatalogDetail(_ref) {
|
|
|
27509
27522
|
});
|
|
27510
27523
|
};
|
|
27511
27524
|
|
|
27525
|
+
// Handle authorize (OAuth browser flow)
|
|
27526
|
+
var handleAuthorize = function handleAuthorize() {
|
|
27527
|
+
if (!dashApi || !(selectedServer !== null && selectedServer !== void 0 && selectedServer.authCommand)) return;
|
|
27528
|
+
setIsAuthorizing(true);
|
|
27529
|
+
setAuthResult(null);
|
|
27530
|
+
dashApi.mcpRunAuth(effectiveMcpConfig, credentialData, selectedServer.authCommand, function (event, result) {
|
|
27531
|
+
if (result.error) {
|
|
27532
|
+
setAuthResult({
|
|
27533
|
+
success: false,
|
|
27534
|
+
message: result.message
|
|
27535
|
+
});
|
|
27536
|
+
} else {
|
|
27537
|
+
setAuthResult({
|
|
27538
|
+
success: true,
|
|
27539
|
+
message: "Authorized!"
|
|
27540
|
+
});
|
|
27541
|
+
}
|
|
27542
|
+
setIsAuthorizing(false);
|
|
27543
|
+
}, function (event, err) {
|
|
27544
|
+
setAuthResult({
|
|
27545
|
+
success: false,
|
|
27546
|
+
message: (err === null || err === void 0 ? void 0 : err.message) || "Authorization failed"
|
|
27547
|
+
});
|
|
27548
|
+
setIsAuthorizing(false);
|
|
27549
|
+
});
|
|
27550
|
+
};
|
|
27551
|
+
|
|
27512
27552
|
// Handle save
|
|
27513
27553
|
var handleSaveProvider = function handleSaveProvider() {
|
|
27514
27554
|
if (!selectedServer || !validateForm()) return;
|
|
@@ -27532,6 +27572,7 @@ var McpCatalogDetail = function McpCatalogDetail(_ref) {
|
|
|
27532
27572
|
setIsConfiguring(false);
|
|
27533
27573
|
setIsCustom(false);
|
|
27534
27574
|
setTestResult(null);
|
|
27575
|
+
setAuthResult(null);
|
|
27535
27576
|
setProviderName("");
|
|
27536
27577
|
setCredentialData({});
|
|
27537
27578
|
setFormErrors({});
|
|
@@ -27720,6 +27761,16 @@ var McpCatalogDetail = function McpCatalogDetail(_ref) {
|
|
|
27720
27761
|
})]
|
|
27721
27762
|
}, field.key);
|
|
27722
27763
|
})]
|
|
27764
|
+
}), authResult && /*#__PURE__*/jsx("div", {
|
|
27765
|
+
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"),
|
|
27766
|
+
children: /*#__PURE__*/jsxs("div", {
|
|
27767
|
+
className: "flex items-center gap-2",
|
|
27768
|
+
children: [/*#__PURE__*/jsx(FontAwesomeIcon, {
|
|
27769
|
+
icon: authResult.success ? "circle-check" : "circle-exclamation"
|
|
27770
|
+
}), /*#__PURE__*/jsx("span", {
|
|
27771
|
+
children: authResult.message
|
|
27772
|
+
})]
|
|
27773
|
+
})
|
|
27723
27774
|
}), testResult && /*#__PURE__*/jsxs("div", {
|
|
27724
27775
|
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"),
|
|
27725
27776
|
children: [/*#__PURE__*/jsxs("div", {
|
|
@@ -27751,6 +27802,10 @@ var McpCatalogDetail = function McpCatalogDetail(_ref) {
|
|
|
27751
27802
|
title: "Cancel",
|
|
27752
27803
|
onClick: onCancel,
|
|
27753
27804
|
size: "sm"
|
|
27805
|
+
}), (selectedServer === null || selectedServer === void 0 ? void 0 : selectedServer.authCommand) && /*#__PURE__*/jsx(Button, {
|
|
27806
|
+
title: isAuthorizing ? "Authorizing..." : "Authorize",
|
|
27807
|
+
onClick: handleAuthorize,
|
|
27808
|
+
size: "sm"
|
|
27754
27809
|
}), /*#__PURE__*/jsx(Button, {
|
|
27755
27810
|
title: isTesting ? "Testing..." : "Test Connection",
|
|
27756
27811
|
onClick: handleTestConnection,
|
|
@@ -28162,9 +28217,14 @@ var ProvidersSection = function ProvidersSection(_ref) {
|
|
|
28162
28217
|
});
|
|
28163
28218
|
} else if (isEditingMcp && selectedName && selectedProvider) {
|
|
28164
28219
|
var mc = selectedProvider.mcpConfig || {};
|
|
28220
|
+
var editCatalogEntry = catalog.find(function (entry) {
|
|
28221
|
+
return entry.id === selectedProvider.type;
|
|
28222
|
+
});
|
|
28165
28223
|
detailContent = /*#__PURE__*/jsx(CustomMcpServerForm, {
|
|
28166
28224
|
isEditMode: true,
|
|
28167
28225
|
initialName: selectedName,
|
|
28226
|
+
initialProviderType: selectedProvider.type || "custom",
|
|
28227
|
+
initialCredentialSchema: (editCatalogEntry === null || editCatalogEntry === void 0 ? void 0 : editCatalogEntry.credentialSchema) || {},
|
|
28168
28228
|
initialTransport: mc.transport || "stdio",
|
|
28169
28229
|
initialCommand: mc.command || "",
|
|
28170
28230
|
initialArgs: (mc.args || []).join(" "),
|