@trops/dash-core 0.1.70 → 0.1.72

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