@trops/dash-core 0.1.70 → 0.1.71

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.js CHANGED
@@ -10525,7 +10525,8 @@ var McpServerPicker = function McpServerPicker(_ref) {
10525
10525
  var _testResult$tools;
10526
10526
  var isOpen = _ref.isOpen,
10527
10527
  setIsOpen = _ref.setIsOpen,
10528
- onSave = _ref.onSave;
10528
+ onSave = _ref.onSave,
10529
+ autoSelectId = _ref.autoSelectId;
10529
10530
  var appContext = React.useContext(AppContext);
10530
10531
  var dashApi = appContext === null || appContext === void 0 ? void 0 : appContext.dashApi;
10531
10532
  var _useState = React.useState([]),
@@ -10557,29 +10558,47 @@ var McpServerPicker = function McpServerPicker(_ref) {
10557
10558
  isLoadingCatalog = _useState12[0],
10558
10559
  setIsLoadingCatalog = _useState12[1];
10559
10560
 
10560
- // Configuration form state
10561
- var _useState13 = React.useState(""),
10561
+ // Stepper state
10562
+ var _useState13 = React.useState(0),
10562
10563
  _useState14 = _slicedToArray(_useState13, 2),
10563
- providerName = _useState14[0],
10564
- setProviderName = _useState14[1];
10565
- var _useState15 = React.useState({}),
10564
+ wizardStep = _useState14[0],
10565
+ setWizardStep = _useState14[1];
10566
+ var _useState15 = React.useState(false),
10566
10567
  _useState16 = _slicedToArray(_useState15, 2),
10567
- credentialData = _useState16[0],
10568
- setCredentialData = _useState16[1];
10569
- var _useState17 = React.useState({}),
10568
+ isAuthorizing = _useState16[0],
10569
+ setIsAuthorizing = _useState16[1];
10570
+ var _useState17 = React.useState(null),
10570
10571
  _useState18 = _slicedToArray(_useState17, 2),
10571
- formErrors = _useState18[0],
10572
- setFormErrors = _useState18[1];
10573
-
10574
- // Advanced config row state
10575
- var _useState19 = React.useState([]),
10572
+ authResult = _useState18[0],
10573
+ setAuthResult = _useState18[1];
10574
+ var _useState19 = React.useState(null),
10576
10575
  _useState20 = _slicedToArray(_useState19, 2),
10577
- envMappingRows = _useState20[0],
10578
- setEnvMappingRows = _useState20[1];
10579
- var _useState21 = React.useState([]),
10576
+ selectedTools = _useState20[0],
10577
+ setSelectedTools = _useState20[1];
10578
+
10579
+ // Configuration form state
10580
+ var _useState21 = React.useState(""),
10580
10581
  _useState22 = _slicedToArray(_useState21, 2),
10581
- headerRows = _useState22[0],
10582
- setHeaderRows = _useState22[1];
10582
+ providerName = _useState22[0],
10583
+ setProviderName = _useState22[1];
10584
+ var _useState23 = React.useState({}),
10585
+ _useState24 = _slicedToArray(_useState23, 2),
10586
+ credentialData = _useState24[0],
10587
+ setCredentialData = _useState24[1];
10588
+ var _useState25 = React.useState({}),
10589
+ _useState26 = _slicedToArray(_useState25, 2),
10590
+ formErrors = _useState26[0],
10591
+ setFormErrors = _useState26[1];
10592
+
10593
+ // Advanced config row state
10594
+ var _useState27 = React.useState([]),
10595
+ _useState28 = _slicedToArray(_useState27, 2),
10596
+ envMappingRows = _useState28[0],
10597
+ setEnvMappingRows = _useState28[1];
10598
+ var _useState29 = React.useState([]),
10599
+ _useState30 = _slicedToArray(_useState29, 2),
10600
+ headerRows = _useState30[0],
10601
+ setHeaderRows = _useState30[1];
10583
10602
  var rowIdRef = React.useRef(0);
10584
10603
  var nextRowId = function nextRowId() {
10585
10604
  return "pick_".concat(++rowIdRef.current);
@@ -10597,13 +10616,28 @@ var McpServerPicker = function McpServerPicker(_ref) {
10597
10616
  return deriveFormFields(effectiveMcpConfig, selectedServer.credentialSchema || {});
10598
10617
  }, [selectedServer, effectiveMcpConfig]);
10599
10618
 
10619
+ // Dynamic wizard steps based on whether auth is needed
10620
+ var hasAuth = !!(selectedServer !== null && selectedServer !== void 0 && selectedServer.authCommand);
10621
+ var wizardSteps = hasAuth ? ["configure", "authorize", "testTools"] : ["configure", "testTools"];
10622
+ var totalSteps = wizardSteps.length;
10623
+ var currentStepType = wizardSteps[wizardStep];
10624
+
10600
10625
  // Load catalog on open
10601
10626
  React.useEffect(function () {
10602
10627
  if (isOpen && dashApi && catalog.length === 0) {
10603
10628
  setIsLoadingCatalog(true);
10604
10629
  dashApi.mcpGetCatalog(function (event, result) {
10605
- setCatalog(result.catalog || []);
10630
+ var loadedCatalog = result.catalog || [];
10631
+ setCatalog(loadedCatalog);
10606
10632
  setIsLoadingCatalog(false);
10633
+
10634
+ // Auto-select if autoSelectId is provided
10635
+ if (autoSelectId) {
10636
+ var match = loadedCatalog.find(function (s) {
10637
+ return s.id === autoSelectId;
10638
+ });
10639
+ if (match) handleSelectServer(match);
10640
+ }
10607
10641
  }, function (event, err) {
10608
10642
  setIsLoadingCatalog(false);
10609
10643
  });
@@ -10611,6 +10645,17 @@ var McpServerPicker = function McpServerPicker(_ref) {
10611
10645
  // eslint-disable-next-line react-hooks/exhaustive-deps
10612
10646
  }, [isOpen, dashApi]);
10613
10647
 
10648
+ // Auto-select from already-loaded catalog when autoSelectId changes
10649
+ React.useEffect(function () {
10650
+ if (isOpen && autoSelectId && catalog.length > 0 && !isConfiguring) {
10651
+ var match = catalog.find(function (s) {
10652
+ return s.id === autoSelectId;
10653
+ });
10654
+ if (match) handleSelectServer(match);
10655
+ }
10656
+ // eslint-disable-next-line react-hooks/exhaustive-deps
10657
+ }, [isOpen, autoSelectId]);
10658
+
10614
10659
  // Filter catalog by search
10615
10660
  var filteredCatalog = catalog.filter(function (server) {
10616
10661
  if (!searchQuery) return true;
@@ -10620,15 +10665,33 @@ var McpServerPicker = function McpServerPicker(_ref) {
10620
10665
  });
10621
10666
  });
10622
10667
 
10668
+ // Wizard step navigation with validation gates
10669
+ var handleWizardStepChange = function handleWizardStepChange(newStep) {
10670
+ if (newStep < wizardStep) {
10671
+ setWizardStep(newStep);
10672
+ return;
10673
+ }
10674
+ if (currentStepType === "configure" && newStep > wizardStep) {
10675
+ if (!validateForm()) return;
10676
+ }
10677
+ if (currentStepType === "authorize" && newStep > wizardStep) {
10678
+ if (!(authResult !== null && authResult !== void 0 && authResult.success)) return;
10679
+ }
10680
+ setWizardStep(newStep);
10681
+ };
10682
+
10623
10683
  // Handle server selection -> show configuration form
10624
10684
  var handleSelectServer = function handleSelectServer(server) {
10625
10685
  var _server$mcpConfig, _server$mcpConfig2;
10626
10686
  setSelectedServer(server);
10627
10687
  setIsConfiguring(true);
10628
10688
  setTestResult(null);
10689
+ setAuthResult(null);
10629
10690
  setProviderName(server.name);
10630
10691
  setCredentialData({});
10631
10692
  setFormErrors({});
10693
+ setWizardStep(0);
10694
+ setSelectedTools(null);
10632
10695
  setEnvMappingRows(envMappingToRows((_server$mcpConfig = server.mcpConfig) === null || _server$mcpConfig === void 0 ? void 0 : _server$mcpConfig.envMapping, nextRowId));
10633
10696
  setHeaderRows(headerTemplateToRows((_server$mcpConfig2 = server.mcpConfig) === null || _server$mcpConfig2 === void 0 ? void 0 : _server$mcpConfig2.headerTemplate, nextRowId));
10634
10697
  };
@@ -10685,6 +10748,11 @@ var McpServerPicker = function McpServerPicker(_ref) {
10685
10748
  message: "Connected! Found ".concat((result.tools || []).length, " tools.")
10686
10749
  });
10687
10750
 
10751
+ // Pre-select all tools
10752
+ setSelectedTools((result.tools || []).map(function (t) {
10753
+ return t.name;
10754
+ }));
10755
+
10688
10756
  // Stop the test server
10689
10757
  dashApi.mcpStopServer(testName, function () {}, function () {});
10690
10758
  setIsTesting(false);
@@ -10697,33 +10765,66 @@ var McpServerPicker = function McpServerPicker(_ref) {
10697
10765
  });
10698
10766
  };
10699
10767
 
10768
+ // Handle authorize (OAuth browser flow)
10769
+ var handleAuthorize = function handleAuthorize() {
10770
+ if (!dashApi || !(selectedServer !== null && selectedServer !== void 0 && selectedServer.authCommand)) return;
10771
+ setIsAuthorizing(true);
10772
+ setAuthResult(null);
10773
+ dashApi.mcpRunAuth(effectiveMcpConfig, credentialData, selectedServer.authCommand, function (event, result) {
10774
+ if (result.error) {
10775
+ setAuthResult({
10776
+ success: false,
10777
+ message: result.message
10778
+ });
10779
+ } else {
10780
+ setAuthResult({
10781
+ success: true,
10782
+ message: "Authorized!"
10783
+ });
10784
+ }
10785
+ setIsAuthorizing(false);
10786
+ }, function (event, err) {
10787
+ setAuthResult({
10788
+ success: false,
10789
+ message: (err === null || err === void 0 ? void 0 : err.message) || "Authorization failed"
10790
+ });
10791
+ setIsAuthorizing(false);
10792
+ });
10793
+ };
10794
+
10700
10795
  // Handle save - create the MCP provider
10701
10796
  var handleSaveProvider = function handleSaveProvider() {
10702
10797
  if (!selectedServer || !validateForm()) return;
10703
- onSave(providerName.trim(), selectedServer.id, credentialData, effectiveMcpConfig);
10798
+ onSave(providerName.trim(), selectedServer.id, credentialData, effectiveMcpConfig, selectedTools);
10704
10799
  handleClose();
10705
10800
  };
10706
10801
  var handleClose = function handleClose() {
10707
10802
  setSelectedServer(null);
10708
10803
  setIsConfiguring(false);
10709
10804
  setTestResult(null);
10805
+ setAuthResult(null);
10806
+ setSelectedTools(null);
10710
10807
  setSearchQuery("");
10711
10808
  setProviderName("");
10712
10809
  setCredentialData({});
10713
10810
  setFormErrors({});
10714
10811
  setEnvMappingRows([]);
10715
10812
  setHeaderRows([]);
10813
+ setWizardStep(0);
10716
10814
  setIsOpen(false);
10717
10815
  };
10718
10816
  var handleBack = function handleBack() {
10719
10817
  setSelectedServer(null);
10720
10818
  setIsConfiguring(false);
10721
10819
  setTestResult(null);
10820
+ setAuthResult(null);
10821
+ setSelectedTools(null);
10722
10822
  setProviderName("");
10723
10823
  setCredentialData({});
10724
10824
  setFormErrors({});
10725
10825
  setEnvMappingRows([]);
10726
10826
  setHeaderRows([]);
10827
+ setWizardStep(0);
10727
10828
  };
10728
10829
 
10729
10830
  // Prune credential data when form fields change (advanced config removed a field)
@@ -10859,153 +10960,268 @@ var McpServerPicker = function McpServerPicker(_ref) {
10859
10960
  })]
10860
10961
  }) :
10861
10962
  /*#__PURE__*/
10862
- // MCP Server Configuration Form
10963
+ // MCP Server Configuration — Stepper
10863
10964
  jsxRuntime.jsxs("div", {
10864
- className: "flex flex-col gap-6 p-6",
10865
- children: [/*#__PURE__*/jsxRuntime.jsxs("div", {
10866
- className: "bg-white/5 border border-white/10 rounded-lg p-4 space-y-3",
10867
- children: [/*#__PURE__*/jsxRuntime.jsx("p", {
10868
- className: "text-xs font-semibold opacity-40 uppercase tracking-wider",
10869
- children: "MCP Server Connection"
10870
- }), /*#__PURE__*/jsxRuntime.jsxs("div", {
10871
- className: "space-y-2 text-sm",
10872
- children: [/*#__PURE__*/jsxRuntime.jsxs("div", {
10873
- className: "flex gap-2",
10874
- children: [/*#__PURE__*/jsxRuntime.jsx("span", {
10875
- className: "opacity-50 w-24 shrink-0",
10876
- children: "Transport:"
10877
- }), /*#__PURE__*/jsxRuntime.jsx(DashReact.Tag, {
10878
- text: effectiveMcpConfig.transport === "streamable_http" ? "Streamable HTTP" : "stdio"
10879
- })]
10880
- }), effectiveMcpConfig.transport === "streamable_http" ? /*#__PURE__*/jsxRuntime.jsxs("div", {
10881
- className: "flex gap-2",
10882
- children: [/*#__PURE__*/jsxRuntime.jsx("span", {
10883
- className: "opacity-50 w-24 shrink-0",
10884
- children: "Endpoint:"
10885
- }), /*#__PURE__*/jsxRuntime.jsx("span", {
10886
- className: "text-xs opacity-70",
10887
- children: "Remote hosted server (URL provided below)"
10888
- })]
10889
- }) : /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
10890
- children: [/*#__PURE__*/jsxRuntime.jsxs("div", {
10891
- className: "flex gap-2",
10892
- children: [/*#__PURE__*/jsxRuntime.jsx("span", {
10893
- className: "opacity-50 w-24 shrink-0",
10894
- children: "Command:"
10895
- }), /*#__PURE__*/jsxRuntime.jsxs("code", {
10896
- className: "text-xs bg-white/5 px-2 py-0.5 rounded",
10897
- children: [effectiveMcpConfig.command, " ", (effectiveMcpConfig.args || []).join(" ")]
10965
+ className: "flex flex-col h-full",
10966
+ children: [/*#__PURE__*/jsxRuntime.jsx("div", {
10967
+ className: "flex-1 min-h-0 flex flex-col",
10968
+ children: /*#__PURE__*/jsxRuntime.jsxs(DashReact.Stepper, {
10969
+ activeStep: wizardStep,
10970
+ onStepChange: handleWizardStepChange,
10971
+ showNavigation: false,
10972
+ className: "flex-1 min-h-0 flex flex-col px-6 pt-4",
10973
+ children: [/*#__PURE__*/jsxRuntime.jsx(DashReact.Stepper.Step, {
10974
+ label: "Configure",
10975
+ description: "Name & credentials",
10976
+ children: /*#__PURE__*/jsxRuntime.jsxs("div", {
10977
+ className: "flex-1 min-h-0 overflow-y-auto pb-4 space-y-5",
10978
+ children: [/*#__PURE__*/jsxRuntime.jsxs("div", {
10979
+ className: "bg-white/5 border border-white/10 rounded-lg p-4 space-y-3",
10980
+ children: [/*#__PURE__*/jsxRuntime.jsx("p", {
10981
+ className: "text-xs font-semibold opacity-40 uppercase tracking-wider",
10982
+ children: "MCP Server Connection"
10983
+ }), /*#__PURE__*/jsxRuntime.jsxs("div", {
10984
+ className: "space-y-2 text-sm",
10985
+ children: [/*#__PURE__*/jsxRuntime.jsxs("div", {
10986
+ className: "flex gap-2",
10987
+ children: [/*#__PURE__*/jsxRuntime.jsx("span", {
10988
+ className: "opacity-50 w-24 shrink-0",
10989
+ children: "Transport:"
10990
+ }), /*#__PURE__*/jsxRuntime.jsx(DashReact.Tag, {
10991
+ text: effectiveMcpConfig.transport === "streamable_http" ? "Streamable HTTP" : "stdio"
10992
+ })]
10993
+ }), effectiveMcpConfig.transport === "streamable_http" ? /*#__PURE__*/jsxRuntime.jsxs("div", {
10994
+ className: "flex gap-2",
10995
+ children: [/*#__PURE__*/jsxRuntime.jsx("span", {
10996
+ className: "opacity-50 w-24 shrink-0",
10997
+ children: "Endpoint:"
10998
+ }), /*#__PURE__*/jsxRuntime.jsx("span", {
10999
+ className: "text-xs opacity-70",
11000
+ children: "Remote hosted server (URL provided below)"
11001
+ })]
11002
+ }) : /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
11003
+ children: [/*#__PURE__*/jsxRuntime.jsxs("div", {
11004
+ className: "flex gap-2",
11005
+ children: [/*#__PURE__*/jsxRuntime.jsx("span", {
11006
+ className: "opacity-50 w-24 shrink-0",
11007
+ children: "Command:"
11008
+ }), /*#__PURE__*/jsxRuntime.jsxs("code", {
11009
+ className: "text-xs bg-white/5 px-2 py-0.5 rounded",
11010
+ children: [effectiveMcpConfig.command, " ", (effectiveMcpConfig.args || []).join(" ")]
11011
+ })]
11012
+ }), effectiveMcpConfig.envMapping && Object.keys(effectiveMcpConfig.envMapping).length > 0 && /*#__PURE__*/jsxRuntime.jsxs("div", {
11013
+ className: "flex gap-2",
11014
+ children: [/*#__PURE__*/jsxRuntime.jsx("span", {
11015
+ className: "opacity-50 w-24 shrink-0",
11016
+ children: "Env Vars:"
11017
+ }), /*#__PURE__*/jsxRuntime.jsx("span", {
11018
+ className: "text-xs opacity-70",
11019
+ children: Object.keys(effectiveMcpConfig.envMapping).join(", ")
11020
+ })]
11021
+ })]
11022
+ })]
11023
+ })]
11024
+ }), /*#__PURE__*/jsxRuntime.jsx(AdvancedMcpConfig, {
11025
+ transport: effectiveMcpConfig.transport || "stdio",
11026
+ envMappingRows: envMappingRows,
11027
+ onEnvMappingRowsChange: setEnvMappingRows,
11028
+ headerRows: headerRows,
11029
+ onHeaderRowsChange: setHeaderRows
11030
+ }), /*#__PURE__*/jsxRuntime.jsxs("div", {
11031
+ className: "flex flex-col gap-2",
11032
+ children: [/*#__PURE__*/jsxRuntime.jsx(DashReact.FormLabel, {
11033
+ label: "Provider Name",
11034
+ required: true
11035
+ }), /*#__PURE__*/jsxRuntime.jsx("p", {
11036
+ className: "text-sm opacity-50",
11037
+ children: "A name to identify this MCP server instance (e.g., \"Algolia Production\")"
11038
+ }), /*#__PURE__*/jsxRuntime.jsx(DashReact.InputText, {
11039
+ value: providerName,
11040
+ onChange: function onChange(value) {
11041
+ setProviderName(value);
11042
+ if (formErrors.providerName && value !== null && value !== void 0 && value.trim()) {
11043
+ setFormErrors(function (prev) {
11044
+ var next = _objectSpread$o({}, prev);
11045
+ delete next.providerName;
11046
+ return next;
11047
+ });
11048
+ }
11049
+ },
11050
+ placeholder: "Enter provider name"
11051
+ }), formErrors.providerName && /*#__PURE__*/jsxRuntime.jsx("p", {
11052
+ className: "text-sm text-red-400",
11053
+ children: formErrors.providerName
11054
+ })]
11055
+ }), formFields.length > 0 && /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
11056
+ children: [/*#__PURE__*/jsxRuntime.jsx("div", {
11057
+ className: "border-t border-white/10 pt-4",
11058
+ children: /*#__PURE__*/jsxRuntime.jsx("p", {
11059
+ className: "text-xs font-semibold opacity-40 uppercase tracking-wider",
11060
+ children: effectiveMcpConfig.transport === "streamable_http" ? "Server Configuration" : "Authentication"
11061
+ })
11062
+ }), formFields.map(function (field) {
11063
+ return /*#__PURE__*/jsxRuntime.jsxs("div", {
11064
+ className: "flex flex-col gap-2",
11065
+ children: [/*#__PURE__*/jsxRuntime.jsx(DashReact.FormLabel, {
11066
+ label: field.displayName,
11067
+ required: field.required
11068
+ }), field.instructions && /*#__PURE__*/jsxRuntime.jsx("p", {
11069
+ className: "text-sm opacity-50",
11070
+ children: field.instructions
11071
+ }), /*#__PURE__*/jsxRuntime.jsxs("div", {
11072
+ className: "flex gap-2",
11073
+ children: [/*#__PURE__*/jsxRuntime.jsx("div", {
11074
+ className: "flex-1",
11075
+ children: /*#__PURE__*/jsxRuntime.jsx(DashReact.InputText, {
11076
+ type: field.secret ? "password" : "text",
11077
+ value: credentialData[field.key] || "",
11078
+ onChange: function onChange(value) {
11079
+ return handleCredentialChange(field.key, value);
11080
+ },
11081
+ placeholder: field.type === "file" ? "Select a file..." : "Enter ".concat(field.displayName.toLowerCase())
11082
+ })
11083
+ }), field.type === "file" && /*#__PURE__*/jsxRuntime.jsx("button", {
11084
+ onClick: /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
11085
+ var filepath;
11086
+ return _regeneratorRuntime.wrap(function (_context) {
11087
+ while (1) switch (_context.prev = _context.next) {
11088
+ case 0:
11089
+ _context.next = 1;
11090
+ return window.mainApi.dialog.chooseFile(true, ["json"]);
11091
+ case 1:
11092
+ filepath = _context.sent;
11093
+ if (filepath) handleCredentialChange(field.key, filepath);
11094
+ case 2:
11095
+ case "end":
11096
+ return _context.stop();
11097
+ }
11098
+ }, _callee);
11099
+ })),
11100
+ className: "px-3 py-1.5 text-sm rounded bg-white/10 hover:bg-white/20 transition-colors",
11101
+ children: "Browse"
11102
+ })]
11103
+ }), formErrors[field.key] && /*#__PURE__*/jsxRuntime.jsx("p", {
11104
+ className: "text-sm text-red-400",
11105
+ children: formErrors[field.key]
11106
+ })]
11107
+ }, field.key);
11108
+ })]
10898
11109
  })]
10899
- }), effectiveMcpConfig.envMapping && Object.keys(effectiveMcpConfig.envMapping).length > 0 && /*#__PURE__*/jsxRuntime.jsxs("div", {
10900
- className: "flex gap-2",
10901
- children: [/*#__PURE__*/jsxRuntime.jsx("span", {
10902
- className: "opacity-50 w-24 shrink-0",
10903
- children: "Env Vars:"
10904
- }), /*#__PURE__*/jsxRuntime.jsx("span", {
10905
- className: "text-xs opacity-70",
10906
- children: Object.keys(effectiveMcpConfig.envMapping).join(", ")
11110
+ })
11111
+ }), hasAuth && /*#__PURE__*/jsxRuntime.jsx(DashReact.Stepper.Step, {
11112
+ label: "Authorize",
11113
+ description: "OAuth authentication",
11114
+ children: /*#__PURE__*/jsxRuntime.jsxs("div", {
11115
+ className: "flex-1 min-h-0 overflow-y-auto pb-4 space-y-5",
11116
+ children: [/*#__PURE__*/jsxRuntime.jsxs("div", {
11117
+ className: "flex flex-col items-center justify-center py-8 space-y-4",
11118
+ children: [/*#__PURE__*/jsxRuntime.jsx("p", {
11119
+ className: "text-sm opacity-60 text-center max-w-md",
11120
+ children: "This server requires OAuth authorization. Click the button below to open a browser window and complete the authentication flow."
11121
+ }), /*#__PURE__*/jsxRuntime.jsx(DashReact.Button, {
11122
+ title: isAuthorizing ? "Authorizing..." : "Authorize",
11123
+ onClick: handleAuthorize,
11124
+ size: "md"
11125
+ })]
11126
+ }), authResult && /*#__PURE__*/jsxRuntime.jsx("div", {
11127
+ 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"),
11128
+ children: /*#__PURE__*/jsxRuntime.jsxs("div", {
11129
+ className: "flex items-center gap-2",
11130
+ children: [/*#__PURE__*/jsxRuntime.jsx(DashReact.FontAwesomeIcon, {
11131
+ icon: authResult.success ? "circle-check" : "circle-exclamation"
11132
+ }), /*#__PURE__*/jsxRuntime.jsx("span", {
11133
+ children: authResult.message
11134
+ })]
11135
+ })
11136
+ }), authResult && !authResult.success && /*#__PURE__*/jsxRuntime.jsxs("div", {
11137
+ className: "bg-white/5 border border-white/10 rounded-lg p-4 space-y-2",
11138
+ children: [/*#__PURE__*/jsxRuntime.jsx("p", {
11139
+ className: "text-xs font-semibold opacity-40 uppercase tracking-wider",
11140
+ children: "Troubleshooting"
11141
+ }), /*#__PURE__*/jsxRuntime.jsxs("ul", {
11142
+ className: "text-sm opacity-60 space-y-1 list-disc list-inside",
11143
+ children: [/*#__PURE__*/jsxRuntime.jsx("li", {
11144
+ children: "Ensure Node.js and npx are available in your PATH"
11145
+ }), /*#__PURE__*/jsxRuntime.jsx("li", {
11146
+ children: "Try running the auth command manually in your terminal"
11147
+ }), /*#__PURE__*/jsxRuntime.jsx("li", {
11148
+ children: "Check that your OAuth credentials file is valid"
11149
+ }), /*#__PURE__*/jsxRuntime.jsx("li", {
11150
+ children: "If using nvm, ensure the correct Node version is active"
11151
+ })]
11152
+ })]
10907
11153
  })]
10908
- })]
11154
+ })
11155
+ }), /*#__PURE__*/jsxRuntime.jsx(DashReact.Stepper.Step, {
11156
+ label: "Test & Tools",
11157
+ description: "Verify & select tools",
11158
+ children: /*#__PURE__*/jsxRuntime.jsxs("div", {
11159
+ className: "flex-1 min-h-0 flex flex-col pb-4 space-y-4",
11160
+ children: [/*#__PURE__*/jsxRuntime.jsxs("div", {
11161
+ className: "flex items-center gap-3",
11162
+ children: [/*#__PURE__*/jsxRuntime.jsx(DashReact.Button, {
11163
+ title: isTesting ? "Fetching..." : "Fetch Tools",
11164
+ onClick: handleTestConnection,
11165
+ size: "sm"
11166
+ }), testResult && /*#__PURE__*/jsxRuntime.jsxs("span", {
11167
+ className: "text-sm ".concat(testResult.success ? "text-green-400" : "text-red-400"),
11168
+ children: [/*#__PURE__*/jsxRuntime.jsx(DashReact.FontAwesomeIcon, {
11169
+ icon: testResult.success ? "circle-check" : "circle-exclamation",
11170
+ className: "mr-1"
11171
+ }), testResult.message]
11172
+ })]
11173
+ }), (testResult === null || testResult === void 0 ? void 0 : testResult.success) && ((_testResult$tools = testResult.tools) === null || _testResult$tools === void 0 ? void 0 : _testResult$tools.length) > 0 && selectedTools && /*#__PURE__*/jsxRuntime.jsx(ToolSelector, {
11174
+ tools: testResult.tools,
11175
+ selectedTools: selectedTools,
11176
+ onSelectionChange: setSelectedTools
11177
+ }), !testResult && /*#__PURE__*/jsxRuntime.jsx("div", {
11178
+ className: "text-center py-8 opacity-50",
11179
+ children: "Click \"Fetch Tools\" to test the connection and discover available tools."
11180
+ })]
11181
+ })
10909
11182
  })]
10910
- })]
10911
- }), /*#__PURE__*/jsxRuntime.jsx(AdvancedMcpConfig, {
10912
- transport: effectiveMcpConfig.transport || "stdio",
10913
- envMappingRows: envMappingRows,
10914
- onEnvMappingRowsChange: setEnvMappingRows,
10915
- headerRows: headerRows,
10916
- onHeaderRowsChange: setHeaderRows
11183
+ })
10917
11184
  }), /*#__PURE__*/jsxRuntime.jsxs("div", {
10918
- className: "flex flex-col gap-2",
10919
- children: [/*#__PURE__*/jsxRuntime.jsx(DashReact.FormLabel, {
10920
- label: "Provider Name",
10921
- required: true
10922
- }), /*#__PURE__*/jsxRuntime.jsx("p", {
10923
- className: "text-sm opacity-50",
10924
- children: "A name to identify this MCP server instance (e.g., \"Algolia Production\")"
10925
- }), /*#__PURE__*/jsxRuntime.jsx(DashReact.InputText, {
10926
- value: providerName,
10927
- onChange: function onChange(value) {
10928
- setProviderName(value);
10929
- if (formErrors.providerName && value !== null && value !== void 0 && value.trim()) {
10930
- setFormErrors(function (prev) {
10931
- var next = _objectSpread$o({}, prev);
10932
- delete next.providerName;
10933
- return next;
10934
- });
10935
- }
10936
- },
10937
- placeholder: "Enter provider name"
10938
- }), formErrors.providerName && /*#__PURE__*/jsxRuntime.jsx("p", {
10939
- className: "text-sm text-red-400",
10940
- children: formErrors.providerName
10941
- })]
10942
- }), formFields.length > 0 && /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
10943
- children: [/*#__PURE__*/jsxRuntime.jsx("div", {
10944
- className: "border-t border-white/10 pt-4",
10945
- children: /*#__PURE__*/jsxRuntime.jsx("p", {
10946
- className: "text-xs font-semibold opacity-40 uppercase tracking-wider",
10947
- children: effectiveMcpConfig.transport === "streamable_http" ? "Server Configuration" : "Authentication"
10948
- })
10949
- }), formFields.map(function (field) {
10950
- return /*#__PURE__*/jsxRuntime.jsxs("div", {
10951
- className: "flex flex-col gap-2",
10952
- children: [/*#__PURE__*/jsxRuntime.jsx(DashReact.FormLabel, {
10953
- label: field.displayName,
10954
- required: field.required
10955
- }), field.instructions && /*#__PURE__*/jsxRuntime.jsx("p", {
10956
- className: "text-sm opacity-50",
10957
- children: field.instructions
10958
- }), /*#__PURE__*/jsxRuntime.jsx(DashReact.InputText, {
10959
- type: field.secret ? "password" : "text",
10960
- value: credentialData[field.key] || "",
10961
- onChange: function onChange(value) {
10962
- return handleCredentialChange(field.key, value);
10963
- },
10964
- placeholder: "Enter ".concat(field.displayName.toLowerCase())
10965
- }), formErrors[field.key] && /*#__PURE__*/jsxRuntime.jsx("p", {
10966
- className: "text-sm text-red-400",
10967
- children: formErrors[field.key]
10968
- })]
10969
- }, field.key);
10970
- })]
10971
- }), testResult && /*#__PURE__*/jsxRuntime.jsxs("div", {
10972
- 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"),
11185
+ className: "flex-shrink-0 flex flex-row items-center px-6 py-4 border-t border-white/10",
10973
11186
  children: [/*#__PURE__*/jsxRuntime.jsxs("div", {
10974
- className: "flex items-center gap-2",
10975
- children: [/*#__PURE__*/jsxRuntime.jsx(DashReact.FontAwesomeIcon, {
10976
- icon: testResult.success ? "circle-check" : "circle-exclamation"
10977
- }), /*#__PURE__*/jsxRuntime.jsx("span", {
10978
- children: testResult.message
11187
+ className: "flex flex-row gap-2",
11188
+ children: [wizardStep === 0 && /*#__PURE__*/jsxRuntime.jsx(DashReact.Button, {
11189
+ title: "Cancel",
11190
+ onClick: handleBack,
11191
+ size: "sm"
11192
+ }), wizardStep > 0 && /*#__PURE__*/jsxRuntime.jsx(DashReact.Button, {
11193
+ title: "Back",
11194
+ onClick: function onClick() {
11195
+ return setWizardStep(wizardStep - 1);
11196
+ },
11197
+ size: "sm"
10979
11198
  })]
10980
- }), testResult.success && ((_testResult$tools = testResult.tools) === null || _testResult$tools === void 0 ? void 0 : _testResult$tools.length) > 0 && /*#__PURE__*/jsxRuntime.jsx("div", {
10981
- className: "mt-2 ml-6 space-y-1",
10982
- children: testResult.tools.map(function (tool) {
10983
- return /*#__PURE__*/jsxRuntime.jsxs("div", {
10984
- className: "text-xs",
10985
- children: [/*#__PURE__*/jsxRuntime.jsx("span", {
10986
- className: "font-mono",
10987
- children: tool.name
10988
- }), tool.description && /*#__PURE__*/jsxRuntime.jsxs("span", {
10989
- className: "opacity-60 ml-2",
10990
- children: ["- ", tool.description]
10991
- })]
10992
- }, tool.name);
11199
+ }), /*#__PURE__*/jsxRuntime.jsx("div", {
11200
+ className: "flex-1 text-center",
11201
+ children: /*#__PURE__*/jsxRuntime.jsxs("span", {
11202
+ className: "text-xs opacity-40",
11203
+ children: ["Step ", wizardStep + 1, " of ", totalSteps]
10993
11204
  })
10994
- })]
10995
- }), /*#__PURE__*/jsxRuntime.jsxs("div", {
10996
- className: "flex gap-3 justify-end pt-4 border-t border-white/10",
10997
- children: [/*#__PURE__*/jsxRuntime.jsx(DashReact.Button, {
10998
- title: "Cancel",
10999
- onClick: handleBack,
11000
- size: "sm"
11001
- }), /*#__PURE__*/jsxRuntime.jsx(DashReact.Button, {
11002
- title: isTesting ? "Testing..." : "Test Connection",
11003
- onClick: handleTestConnection,
11004
- size: "sm"
11005
- }), /*#__PURE__*/jsxRuntime.jsx(DashReact.Button, {
11006
- title: "Save MCP Server",
11007
- onClick: handleSaveProvider,
11008
- size: "sm"
11205
+ }), /*#__PURE__*/jsxRuntime.jsxs("div", {
11206
+ className: "flex flex-row gap-2",
11207
+ children: [currentStepType === "configure" && /*#__PURE__*/jsxRuntime.jsx(DashReact.Button, {
11208
+ title: "Next",
11209
+ onClick: function onClick() {
11210
+ return handleWizardStepChange(wizardStep + 1);
11211
+ },
11212
+ size: "sm"
11213
+ }), currentStepType === "authorize" && /*#__PURE__*/jsxRuntime.jsx(DashReact.Button, {
11214
+ title: "Next",
11215
+ onClick: function onClick() {
11216
+ return handleWizardStepChange(wizardStep + 1);
11217
+ },
11218
+ disabled: !(authResult !== null && authResult !== void 0 && authResult.success),
11219
+ size: "sm"
11220
+ }), currentStepType === "testTools" && /*#__PURE__*/jsxRuntime.jsx(DashReact.Button, {
11221
+ title: "Save MCP Server",
11222
+ onClick: handleSaveProvider,
11223
+ size: "sm"
11224
+ })]
11009
11225
  })]
11010
11226
  })]
11011
11227
  })
@@ -11562,7 +11778,7 @@ var LayoutBuilder = function LayoutBuilder(_ref) {
11562
11778
  });
11563
11779
  }
11564
11780
  }
11565
- function handleMcpProviderSave(providerName, providerType, mcpCredentials, mcpConfig) {
11781
+ function handleMcpProviderSave(providerName, providerType, mcpCredentials, mcpConfig, allowedTools) {
11566
11782
  var _dashboardContext$cre2;
11567
11783
  var appId = dashboardContext === null || dashboardContext === void 0 || (_dashboardContext$cre2 = dashboardContext.credentials) === null || _dashboardContext$cre2 === void 0 ? void 0 : _dashboardContext$cre2.appId;
11568
11784
  if (dashboardContext !== null && dashboardContext !== void 0 && dashboardContext.dashApi && appId) {
@@ -11570,7 +11786,8 @@ var LayoutBuilder = function LayoutBuilder(_ref) {
11570
11786
  providerType: providerType,
11571
11787
  credentials: mcpCredentials,
11572
11788
  providerClass: "mcp",
11573
- mcpConfig: mcpConfig
11789
+ mcpConfig: mcpConfig,
11790
+ allowedTools: allowedTools
11574
11791
  }, function () {
11575
11792
  handleSelectProvider(mcpPickerWidgetId, mcpPickerProviderType, providerName);
11576
11793
  setIsMcpPickerOpen(false);
@@ -11905,7 +12122,8 @@ var LayoutBuilder = function LayoutBuilder(_ref) {
11905
12122
  }), /*#__PURE__*/jsxRuntime.jsx(McpServerPicker, {
11906
12123
  isOpen: isMcpPickerOpen,
11907
12124
  setIsOpen: setIsMcpPickerOpen,
11908
- onSave: handleMcpProviderSave
12125
+ onSave: handleMcpProviderSave,
12126
+ autoSelectId: mcpPickerProviderType
11909
12127
  })]
11910
12128
  })]
11911
12129
  }, "layout-builder")