@trops/dash-core 0.1.65 → 0.1.66

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
@@ -26514,94 +26514,105 @@ var ProviderDetail = function ProviderDetail(_ref) {
26514
26514
  text: isMcp ? "MCP Server" : "API Credentials"
26515
26515
  })]
26516
26516
  })]
26517
- }), isMcp && provider.mcpConfig && /*#__PURE__*/jsxs("div", {
26518
- className: "space-y-4",
26519
- children: [/*#__PURE__*/jsxs("div", {
26520
- className: "border-t border-white/10 pt-4",
26521
- children: [/*#__PURE__*/jsx("p", {
26522
- className: "text-xs font-semibold opacity-40 uppercase tracking-wider mb-3",
26523
- children: "MCP Server Configuration"
26524
- }), /*#__PURE__*/jsxs("div", {
26525
- className: "space-y-2 text-sm",
26526
- children: [/*#__PURE__*/jsxs("div", {
26527
- className: "flex gap-2",
26528
- children: [/*#__PURE__*/jsx("span", {
26529
- className: "opacity-50 w-20",
26530
- children: "Transport:"
26531
- }), /*#__PURE__*/jsx("span", {
26532
- children: provider.mcpConfig.transport === "streamable_http" ? "Streamable HTTP" : "stdio"
26533
- })]
26534
- }), provider.mcpConfig.transport === "streamable_http" ? /*#__PURE__*/jsxs("div", {
26535
- className: "flex gap-2",
26536
- children: [/*#__PURE__*/jsx("span", {
26537
- className: "opacity-50 w-20",
26538
- children: "Endpoint:"
26539
- }), /*#__PURE__*/jsx("span", {
26540
- className: "text-xs opacity-70",
26541
- children: "Remote hosted server"
26542
- })]
26543
- }) : /*#__PURE__*/jsxs(Fragment, {
26517
+ }), isMcp && provider.mcpConfig && /*#__PURE__*/jsxs(Fragment, {
26518
+ children: [/*#__PURE__*/jsx("div", {
26519
+ className: "space-y-4",
26520
+ children: /*#__PURE__*/jsxs("div", {
26521
+ className: "border-t border-white/10 pt-4",
26522
+ children: [/*#__PURE__*/jsx("p", {
26523
+ className: "text-xs font-semibold opacity-40 uppercase tracking-wider mb-3",
26524
+ children: "Server Configuration"
26525
+ }), /*#__PURE__*/jsxs("div", {
26526
+ className: "space-y-2 text-sm",
26544
26527
  children: [/*#__PURE__*/jsxs("div", {
26545
26528
  className: "flex gap-2",
26546
26529
  children: [/*#__PURE__*/jsx("span", {
26547
26530
  className: "opacity-50 w-20",
26548
- children: "Command:"
26549
- }), /*#__PURE__*/jsxs("code", {
26550
- className: "text-xs bg-white/5 px-2 py-0.5 rounded",
26551
- children: [provider.mcpConfig.command, " ", (provider.mcpConfig.args || []).join(" ")]
26531
+ children: "Transport:"
26532
+ }), /*#__PURE__*/jsx("span", {
26533
+ children: provider.mcpConfig.transport === "streamable_http" ? "Streamable HTTP" : "stdio"
26552
26534
  })]
26553
- }), provider.mcpConfig.envMapping && Object.keys(provider.mcpConfig.envMapping).length > 0 && /*#__PURE__*/jsxs("div", {
26535
+ }), provider.mcpConfig.transport === "streamable_http" ? /*#__PURE__*/jsxs("div", {
26554
26536
  className: "flex gap-2",
26555
26537
  children: [/*#__PURE__*/jsx("span", {
26556
26538
  className: "opacity-50 w-20",
26557
- children: "Env Vars:"
26539
+ children: "Endpoint:"
26558
26540
  }), /*#__PURE__*/jsx("span", {
26559
- className: "text-xs",
26560
- children: Object.keys(provider.mcpConfig.envMapping).join(", ")
26541
+ className: "text-xs opacity-70",
26542
+ children: "Remote hosted server"
26543
+ })]
26544
+ }) : /*#__PURE__*/jsxs(Fragment, {
26545
+ children: [/*#__PURE__*/jsxs("div", {
26546
+ className: "flex gap-2",
26547
+ children: [/*#__PURE__*/jsx("span", {
26548
+ className: "opacity-50 w-20",
26549
+ children: "Command:"
26550
+ }), /*#__PURE__*/jsxs("code", {
26551
+ className: "text-xs bg-white/5 px-2 py-0.5 rounded",
26552
+ children: [provider.mcpConfig.command, " ", (provider.mcpConfig.args || []).join(" ")]
26553
+ })]
26554
+ }), provider.mcpConfig.envMapping && Object.keys(provider.mcpConfig.envMapping).length > 0 && /*#__PURE__*/jsxs("div", {
26555
+ className: "flex gap-2",
26556
+ children: [/*#__PURE__*/jsx("span", {
26557
+ className: "opacity-50 w-20",
26558
+ children: "Env Vars:"
26559
+ }), /*#__PURE__*/jsx("span", {
26560
+ className: "text-xs",
26561
+ children: Object.keys(provider.mcpConfig.envMapping).join(", ")
26562
+ })]
26561
26563
  })]
26562
26564
  })]
26563
26565
  })]
26564
- })]
26565
- }), authResult && /*#__PURE__*/jsx("div", {
26566
- 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"),
26567
- children: /*#__PURE__*/jsxs("div", {
26568
- className: "flex items-center gap-2",
26569
- children: [/*#__PURE__*/jsx(FontAwesomeIcon, {
26570
- icon: authResult.success ? "circle-check" : "circle-exclamation"
26571
- }), /*#__PURE__*/jsx("span", {
26572
- children: authResult.message
26573
- })]
26574
- })
26575
- }), testResult && /*#__PURE__*/jsx("div", {
26576
- 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"),
26577
- children: /*#__PURE__*/jsxs("div", {
26578
- className: "flex items-center gap-2",
26579
- children: [/*#__PURE__*/jsx(FontAwesomeIcon, {
26580
- icon: testResult.success ? "circle-check" : "circle-exclamation"
26581
- }), /*#__PURE__*/jsx("span", {
26582
- children: testResult.message
26583
- })]
26584
26566
  })
26585
- }), (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, {
26586
- tools: testResult.tools,
26587
- selectedTools: selectedTools,
26588
- onSelectionChange: setSelectedTools
26589
- }), !testResult && (provider === null || provider === void 0 ? void 0 : provider.allowedTools) && provider.allowedTools.length > 0 && /*#__PURE__*/jsxs("div", {
26590
- className: "space-y-2",
26591
- children: [/*#__PURE__*/jsx("p", {
26592
- className: "text-xs font-semibold opacity-40 uppercase tracking-wider",
26593
- children: "Allowed Tools"
26594
- }), /*#__PURE__*/jsx("div", {
26595
- className: "flex flex-wrap gap-1",
26596
- children: provider.allowedTools.map(function (tool) {
26597
- return /*#__PURE__*/jsx("span", {
26598
- className: "text-xs font-mono px-2 py-0.5 rounded bg-white/5 opacity-70",
26599
- children: tool
26600
- }, tool);
26567
+ }), /*#__PURE__*/jsxs("div", {
26568
+ className: "space-y-4",
26569
+ children: [/*#__PURE__*/jsx("div", {
26570
+ className: "border-t border-white/10 pt-4",
26571
+ children: /*#__PURE__*/jsx("p", {
26572
+ className: "text-xs font-semibold opacity-40 uppercase tracking-wider mb-3",
26573
+ children: "Connection & Tools"
26601
26574
  })
26602
- }), /*#__PURE__*/jsxs("p", {
26603
- className: "text-xs opacity-40",
26604
- children: [provider.allowedTools.length, " tool", provider.allowedTools.length !== 1 ? "s" : "", " allowed \u2014 test connection to modify"]
26575
+ }), authResult && /*#__PURE__*/jsx("div", {
26576
+ 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"),
26577
+ children: /*#__PURE__*/jsxs("div", {
26578
+ className: "flex items-center gap-2",
26579
+ children: [/*#__PURE__*/jsx(FontAwesomeIcon, {
26580
+ icon: authResult.success ? "circle-check" : "circle-exclamation"
26581
+ }), /*#__PURE__*/jsx("span", {
26582
+ children: authResult.message
26583
+ })]
26584
+ })
26585
+ }), testResult && /*#__PURE__*/jsx("div", {
26586
+ 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"),
26587
+ children: /*#__PURE__*/jsxs("div", {
26588
+ className: "flex items-center gap-2",
26589
+ children: [/*#__PURE__*/jsx(FontAwesomeIcon, {
26590
+ icon: testResult.success ? "circle-check" : "circle-exclamation"
26591
+ }), /*#__PURE__*/jsx("span", {
26592
+ children: testResult.message
26593
+ })]
26594
+ })
26595
+ }), (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, {
26596
+ tools: testResult.tools,
26597
+ selectedTools: selectedTools,
26598
+ onSelectionChange: setSelectedTools
26599
+ }), !testResult && (provider === null || provider === void 0 ? void 0 : provider.allowedTools) && provider.allowedTools.length > 0 && /*#__PURE__*/jsxs("div", {
26600
+ className: "space-y-2",
26601
+ children: [/*#__PURE__*/jsx("div", {
26602
+ className: "flex flex-wrap gap-1",
26603
+ children: provider.allowedTools.map(function (tool) {
26604
+ return /*#__PURE__*/jsx("span", {
26605
+ className: "text-xs font-mono px-2 py-0.5 rounded bg-white/5 opacity-70",
26606
+ children: tool
26607
+ }, tool);
26608
+ })
26609
+ }), /*#__PURE__*/jsxs("p", {
26610
+ className: "text-xs opacity-40",
26611
+ children: [provider.allowedTools.length, " tool", provider.allowedTools.length !== 1 ? "s" : "", " allowed \u2014 test connection to modify"]
26612
+ })]
26613
+ }), !testResult && (!(provider !== null && provider !== void 0 && provider.allowedTools) || provider.allowedTools.length === 0) && /*#__PURE__*/jsx("p", {
26614
+ className: "text-sm opacity-40",
26615
+ children: "No tools configured \u2014 use Test Connection to discover available tools."
26605
26616
  })]
26606
26617
  })]
26607
26618
  })]
@@ -26798,19 +26809,25 @@ var CustomMcpServerForm = function CustomMcpServerForm(_ref2) {
26798
26809
  selectedTools = _useState22[0],
26799
26810
  setSelectedTools = _useState22[1];
26800
26811
 
26801
- // JSON editor state
26802
- var _useState23 = useState("form"),
26812
+ // Wizard step state
26813
+ var _useState23 = useState(0),
26803
26814
  _useState24 = _slicedToArray(_useState23, 2),
26804
- viewMode = _useState24[0],
26805
- setViewMode = _useState24[1]; // "form" | "json"
26806
- var _useState25 = useState(""),
26815
+ wizardStep = _useState24[0],
26816
+ setWizardStep = _useState24[1];
26817
+
26818
+ // JSON editor state
26819
+ var _useState25 = useState("form"),
26807
26820
  _useState26 = _slicedToArray(_useState25, 2),
26808
- jsonText = _useState26[0],
26809
- setJsonText = _useState26[1];
26810
- var _useState27 = useState(null),
26821
+ viewMode = _useState26[0],
26822
+ setViewMode = _useState26[1]; // "form" | "json"
26823
+ var _useState27 = useState(""),
26811
26824
  _useState28 = _slicedToArray(_useState27, 2),
26812
- jsonError = _useState28[0],
26813
- setJsonError = _useState28[1];
26825
+ jsonText = _useState28[0],
26826
+ setJsonText = _useState28[1];
26827
+ var _useState29 = useState(null),
26828
+ _useState30 = _slicedToArray(_useState29, 2),
26829
+ jsonError = _useState30[0],
26830
+ setJsonError = _useState30[1];
26814
26831
 
26815
26832
  // Clear credential data when transport changes (derived fields change entirely)
26816
26833
  // Only in create mode — in edit mode the initial transport is set correctly
@@ -26821,6 +26838,23 @@ var CustomMcpServerForm = function CustomMcpServerForm(_ref2) {
26821
26838
  }
26822
26839
  }, [transport, isEditMode]);
26823
26840
 
26841
+ // Wizard step navigation with validation gates
26842
+ var handleWizardStepChange = function handleWizardStepChange(newStep) {
26843
+ if (newStep < wizardStep) {
26844
+ setWizardStep(newStep);
26845
+ return;
26846
+ }
26847
+ // Step 0→1: validate form (skip validation in JSON mode, handled on save)
26848
+ if (wizardStep === 0 && newStep >= 1) {
26849
+ if (viewMode === "form" && !validateForm()) return;
26850
+ }
26851
+ // Step 1→2: require test success OR edit mode with existing tools
26852
+ if (wizardStep === 1 && newStep >= 2) {
26853
+ if (!(testResult !== null && testResult !== void 0 && testResult.success) && !(isEditMode && initialAllowedTools)) return;
26854
+ }
26855
+ setWizardStep(newStep);
26856
+ };
26857
+
26824
26858
  // Build mcpConfig from current state
26825
26859
  var mcpConfig = useMemo(function () {
26826
26860
  return buildMcpConfig(transport, {
@@ -26832,6 +26866,16 @@ var CustomMcpServerForm = function CustomMcpServerForm(_ref2) {
26832
26866
  });
26833
26867
  }, [transport, command, args, envMappingRows, url, headerRows]);
26834
26868
 
26869
+ // Invalidate test result when config changes after a test
26870
+ var mcpConfigRef = useRef(mcpConfig);
26871
+ useEffect(function () {
26872
+ if (mcpConfigRef.current !== mcpConfig && testResult) {
26873
+ setTestResult(null);
26874
+ setSelectedTools(initialAllowedTools);
26875
+ }
26876
+ mcpConfigRef.current = mcpConfig;
26877
+ }, [mcpConfig, testResult, initialAllowedTools]);
26878
+
26835
26879
  // Derive credential fields from the live mcpConfig
26836
26880
  var formFields = useMemo(function () {
26837
26881
  return deriveFormFields(mcpConfig, initialCredentialSchema);
@@ -27032,414 +27076,487 @@ var CustomMcpServerForm = function CustomMcpServerForm(_ref2) {
27032
27076
  return /*#__PURE__*/jsxs("div", {
27033
27077
  className: "flex flex-col flex-1 min-h-0",
27034
27078
  children: [/*#__PURE__*/jsxs("div", {
27035
- className: "flex-1 min-h-0 overflow-y-auto p-6 space-y-5",
27036
- children: [/*#__PURE__*/jsxs("div", {
27037
- className: "flex items-center gap-3",
27038
- children: [/*#__PURE__*/jsx("button", {
27039
- onClick: onBack,
27040
- className: "text-gray-400 hover:text-gray-200 transition-colors",
27041
- children: /*#__PURE__*/jsx(FontAwesomeIcon, {
27042
- icon: "arrow-left",
27043
- className: "text-lg"
27044
- })
27045
- }), /*#__PURE__*/jsxs("div", {
27046
- children: [/*#__PURE__*/jsx(SubHeading3, {
27047
- title: isEditMode ? "Edit MCP Server" : "Configure Custom MCP Server",
27048
- padding: false
27049
- }), /*#__PURE__*/jsx("p", {
27050
- className: "text-sm opacity-50 mt-1",
27051
- children: isEditMode ? "Modify this MCP server configuration" : "Define a custom MCP server connection"
27052
- })]
27053
- })]
27054
- }), /*#__PURE__*/jsxs("div", {
27055
- className: "flex flex-col gap-2",
27056
- children: [/*#__PURE__*/jsx(FormLabel, {
27057
- label: "Provider Name",
27058
- required: true
27059
- }), /*#__PURE__*/jsx("p", {
27060
- className: "text-sm opacity-50",
27061
- children: "A name to identify this MCP server (e.g., \"My Custom Server\")"
27062
- }), /*#__PURE__*/jsx(InputText, {
27063
- value: providerName,
27064
- onChange: function onChange(value) {
27065
- setProviderName(value);
27066
- if (formErrors.providerName && value !== null && value !== void 0 && value.trim()) {
27067
- setFormErrors(function (prev) {
27068
- var next = _objectSpread$5({}, prev);
27069
- delete next.providerName;
27070
- return next;
27071
- });
27072
- }
27073
- },
27074
- placeholder: "Enter provider name"
27075
- }), formErrors.providerName && /*#__PURE__*/jsx("p", {
27076
- className: "text-sm text-red-400",
27077
- children: formErrors.providerName
27078
- })]
27079
+ className: "flex items-center gap-3 px-6 pt-6 pb-2",
27080
+ children: [/*#__PURE__*/jsx("button", {
27081
+ onClick: onBack,
27082
+ className: "text-gray-400 hover:text-gray-200 transition-colors",
27083
+ children: /*#__PURE__*/jsx(FontAwesomeIcon, {
27084
+ icon: "arrow-left",
27085
+ className: "text-lg"
27086
+ })
27079
27087
  }), /*#__PURE__*/jsxs("div", {
27080
- className: "flex items-center gap-1",
27081
- children: [/*#__PURE__*/jsx("button", {
27082
- onClick: function onClick() {
27083
- if (viewMode === "json") handleSwitchToForm();
27084
- },
27085
- className: "px-3 py-1 text-xs font-medium rounded-l transition-colors ".concat(viewMode === "form" ? "bg-white/10 text-white" : "text-white/50 hover:text-white/70"),
27086
- children: "Form"
27087
- }), /*#__PURE__*/jsx("button", {
27088
- onClick: function onClick() {
27089
- if (viewMode === "form") handleSwitchToJson();
27090
- },
27091
- className: "px-3 py-1 text-xs font-medium rounded-r transition-colors ".concat(viewMode === "json" ? "bg-white/10 text-white" : "text-white/50 hover:text-white/70"),
27092
- children: "JSON"
27093
- })]
27094
- }), jsonError && /*#__PURE__*/jsx("p", {
27095
- className: "text-sm text-red-400",
27096
- children: jsonError
27097
- }), viewMode === "json" && /*#__PURE__*/jsxs("div", {
27098
- className: "space-y-2",
27099
- children: [/*#__PURE__*/jsx("p", {
27100
- className: "text-xs font-semibold opacity-40 uppercase tracking-wider",
27101
- children: "MCP Server Configuration (JSON)"
27088
+ children: [/*#__PURE__*/jsx(SubHeading3, {
27089
+ title: isEditMode ? "Edit MCP Server" : "Configure Custom MCP Server",
27090
+ padding: false
27102
27091
  }), /*#__PURE__*/jsx("p", {
27103
- className: "text-sm opacity-50",
27104
- children: "Paste a standard MCP config JSON (compatible with Claude Desktop, Cursor, etc.)"
27105
- }), /*#__PURE__*/jsx(CodeEditorInline, {
27106
- code: jsonText,
27107
- setCode: function setCode(val) {
27108
- setJsonText(val);
27109
- setJsonError(null);
27110
- },
27111
- language: "json",
27112
- placeholder: '{\n "type": "stdio",\n "command": "npx",\n "args": ["-y", "package-name"],\n "env": {\n "API_KEY": "${API_KEY}"\n }\n}'
27092
+ className: "text-sm opacity-50 mt-1",
27093
+ children: isEditMode ? "Modify this MCP server configuration" : "Define a custom MCP server connection"
27113
27094
  })]
27114
- }), viewMode === "form" && /*#__PURE__*/jsxs(Fragment, {
27115
- children: [/*#__PURE__*/jsxs("div", {
27116
- className: "space-y-2",
27117
- children: [/*#__PURE__*/jsx("p", {
27118
- className: "text-xs font-semibold opacity-40 uppercase tracking-wider",
27119
- children: "Transport Type"
27120
- }), /*#__PURE__*/jsxs("div", {
27121
- className: "grid grid-cols-2 gap-3",
27122
- children: [/*#__PURE__*/jsxs(Card2, {
27123
- hover: true,
27124
- selected: transport === "stdio",
27125
- onClick: function onClick() {
27126
- return setTransport("stdio");
27127
- },
27128
- className: "text-left",
27129
- children: [/*#__PURE__*/jsxs("div", {
27130
- className: "flex items-center gap-2 mb-1",
27131
- children: [/*#__PURE__*/jsx(Icon2, {
27132
- icon: "terminal"
27133
- }), /*#__PURE__*/jsx("span", {
27134
- className: "font-semibold text-sm",
27135
- children: "Local Process (stdio)"
27136
- })]
27095
+ })]
27096
+ }), /*#__PURE__*/jsx("div", {
27097
+ className: "flex-1 min-h-0 flex flex-col",
27098
+ children: /*#__PURE__*/jsxs(Stepper, {
27099
+ activeStep: wizardStep,
27100
+ onStepChange: handleWizardStepChange,
27101
+ showNavigation: false,
27102
+ className: "flex-1 min-h-0 flex flex-col",
27103
+ children: [/*#__PURE__*/jsx(Stepper.Step, {
27104
+ label: "Configure",
27105
+ description: "Server & credentials",
27106
+ children: /*#__PURE__*/jsxs("div", {
27107
+ className: "flex-1 min-h-0 overflow-y-auto px-6 pb-4 space-y-5",
27108
+ children: [/*#__PURE__*/jsxs("div", {
27109
+ className: "flex flex-col gap-2",
27110
+ children: [/*#__PURE__*/jsx(FormLabel, {
27111
+ label: "Provider Name",
27112
+ required: true
27137
27113
  }), /*#__PURE__*/jsx("p", {
27138
- className: "text-xs opacity-50",
27139
- children: "Spawn a local command as a child process"
27114
+ className: "text-sm opacity-50",
27115
+ children: "A name to identify this MCP server (e.g., \"My Custom Server\")"
27116
+ }), /*#__PURE__*/jsx(InputText, {
27117
+ value: providerName,
27118
+ onChange: function onChange(value) {
27119
+ setProviderName(value);
27120
+ if (formErrors.providerName && value !== null && value !== void 0 && value.trim()) {
27121
+ setFormErrors(function (prev) {
27122
+ var next = _objectSpread$5({}, prev);
27123
+ delete next.providerName;
27124
+ return next;
27125
+ });
27126
+ }
27127
+ },
27128
+ placeholder: "Enter provider name"
27129
+ }), formErrors.providerName && /*#__PURE__*/jsx("p", {
27130
+ className: "text-sm text-red-400",
27131
+ children: formErrors.providerName
27140
27132
  })]
27141
- }), /*#__PURE__*/jsxs(Card2, {
27142
- hover: true,
27143
- selected: transport === "streamable_http",
27144
- onClick: function onClick() {
27145
- return setTransport("streamable_http");
27146
- },
27147
- className: "text-left",
27148
- children: [/*#__PURE__*/jsxs("div", {
27149
- className: "flex items-center gap-2 mb-1",
27150
- children: [/*#__PURE__*/jsx(Icon2, {
27151
- icon: "globe"
27152
- }), /*#__PURE__*/jsx("span", {
27153
- className: "font-semibold text-sm",
27154
- children: "Remote Server (HTTP)"
27155
- })]
27156
- }), /*#__PURE__*/jsx("p", {
27157
- className: "text-xs opacity-50",
27158
- children: "Connect to a remote MCP server via HTTP"
27133
+ }), /*#__PURE__*/jsxs("div", {
27134
+ className: "flex items-center gap-1",
27135
+ children: [/*#__PURE__*/jsx("button", {
27136
+ onClick: function onClick() {
27137
+ if (viewMode === "json") handleSwitchToForm();
27138
+ },
27139
+ className: "px-3 py-1 text-xs font-medium rounded-l transition-colors ".concat(viewMode === "form" ? "bg-white/10 text-white" : "text-white/50 hover:text-white/70"),
27140
+ children: "Form"
27141
+ }), /*#__PURE__*/jsx("button", {
27142
+ onClick: function onClick() {
27143
+ if (viewMode === "form") handleSwitchToJson();
27144
+ },
27145
+ className: "px-3 py-1 text-xs font-medium rounded-r transition-colors ".concat(viewMode === "json" ? "bg-white/10 text-white" : "text-white/50 hover:text-white/70"),
27146
+ children: "JSON"
27159
27147
  })]
27160
- })]
27161
- })]
27162
- }), transport === "stdio" && /*#__PURE__*/jsxs("div", {
27163
- className: "space-y-4",
27164
- children: [/*#__PURE__*/jsx("div", {
27165
- className: "border-t border-white/10 pt-4",
27166
- children: /*#__PURE__*/jsx("p", {
27167
- className: "text-xs font-semibold opacity-40 uppercase tracking-wider",
27168
- children: "Process Configuration"
27169
- })
27170
- }), /*#__PURE__*/jsxs("div", {
27171
- className: "flex flex-col gap-2",
27172
- children: [/*#__PURE__*/jsx(FormLabel, {
27173
- label: "Command",
27174
- required: true
27175
- }), /*#__PURE__*/jsx("p", {
27176
- className: "text-sm opacity-50",
27177
- children: "The executable to run (e.g., npx, node, python)"
27178
- }), /*#__PURE__*/jsx(InputText, {
27179
- value: command,
27180
- onChange: function onChange(value) {
27181
- setCommand(value);
27182
- if (formErrors.command && value !== null && value !== void 0 && value.trim()) {
27183
- setFormErrors(function (prev) {
27184
- var next = _objectSpread$5({}, prev);
27185
- delete next.command;
27186
- return next;
27187
- });
27188
- }
27189
- },
27190
- placeholder: "e.g., npx"
27191
- }), formErrors.command && /*#__PURE__*/jsx("p", {
27148
+ }), jsonError && /*#__PURE__*/jsx("p", {
27192
27149
  className: "text-sm text-red-400",
27193
- children: formErrors.command
27194
- })]
27195
- }), /*#__PURE__*/jsxs("div", {
27196
- className: "flex flex-col gap-2",
27197
- children: [/*#__PURE__*/jsx(FormLabel, {
27198
- label: "Arguments"
27199
- }), /*#__PURE__*/jsx("p", {
27200
- className: "text-sm opacity-50",
27201
- children: "Space-separated arguments passed to the command"
27202
- }), /*#__PURE__*/jsx(InputText, {
27203
- value: args,
27204
- onChange: setArgs,
27205
- placeholder: "e.g., -y @modelcontextprotocol/server-github"
27206
- })]
27207
- }), /*#__PURE__*/jsxs("div", {
27208
- className: "space-y-3",
27209
- children: [/*#__PURE__*/jsx("div", {
27210
- className: "flex items-center justify-between",
27211
- children: /*#__PURE__*/jsxs("div", {
27212
- children: [/*#__PURE__*/jsx(FormLabel, {
27213
- label: "Environment Variable Mapping"
27214
- }), /*#__PURE__*/jsx("p", {
27215
- className: "text-sm opacity-50 mt-1",
27216
- children: "Map environment variables to credential fields"
27150
+ children: jsonError
27151
+ }), viewMode === "json" && /*#__PURE__*/jsxs("div", {
27152
+ className: "space-y-2",
27153
+ children: [/*#__PURE__*/jsx("p", {
27154
+ className: "text-xs font-semibold opacity-40 uppercase tracking-wider",
27155
+ children: "MCP Server Configuration (JSON)"
27156
+ }), /*#__PURE__*/jsx("p", {
27157
+ className: "text-sm opacity-50",
27158
+ children: "Paste a standard MCP config JSON (compatible with Claude Desktop, Cursor, etc.)"
27159
+ }), /*#__PURE__*/jsx(CodeEditorInline, {
27160
+ code: jsonText,
27161
+ setCode: function setCode(val) {
27162
+ setJsonText(val);
27163
+ setJsonError(null);
27164
+ },
27165
+ language: "json",
27166
+ placeholder: '{\n "type": "stdio",\n "command": "npx",\n "args": ["-y", "package-name"],\n "env": {\n "API_KEY": "${API_KEY}"\n }\n}'
27167
+ })]
27168
+ }), viewMode === "form" && /*#__PURE__*/jsxs(Fragment, {
27169
+ children: [/*#__PURE__*/jsxs("div", {
27170
+ className: "space-y-2",
27171
+ children: [/*#__PURE__*/jsx("p", {
27172
+ className: "text-xs font-semibold opacity-40 uppercase tracking-wider",
27173
+ children: "Transport Type"
27174
+ }), /*#__PURE__*/jsxs("div", {
27175
+ className: "grid grid-cols-2 gap-3",
27176
+ children: [/*#__PURE__*/jsxs(Card2, {
27177
+ hover: true,
27178
+ selected: transport === "stdio",
27179
+ onClick: function onClick() {
27180
+ return setTransport("stdio");
27181
+ },
27182
+ className: "text-left",
27183
+ children: [/*#__PURE__*/jsxs("div", {
27184
+ className: "flex items-center gap-2 mb-1",
27185
+ children: [/*#__PURE__*/jsx(Icon2, {
27186
+ icon: "terminal"
27187
+ }), /*#__PURE__*/jsx("span", {
27188
+ className: "font-semibold text-sm",
27189
+ children: "Local Process (stdio)"
27190
+ })]
27191
+ }), /*#__PURE__*/jsx("p", {
27192
+ className: "text-xs opacity-50",
27193
+ children: "Spawn a local command as a child process"
27194
+ })]
27195
+ }), /*#__PURE__*/jsxs(Card2, {
27196
+ hover: true,
27197
+ selected: transport === "streamable_http",
27198
+ onClick: function onClick() {
27199
+ return setTransport("streamable_http");
27200
+ },
27201
+ className: "text-left",
27202
+ children: [/*#__PURE__*/jsxs("div", {
27203
+ className: "flex items-center gap-2 mb-1",
27204
+ children: [/*#__PURE__*/jsx(Icon2, {
27205
+ icon: "globe"
27206
+ }), /*#__PURE__*/jsx("span", {
27207
+ className: "font-semibold text-sm",
27208
+ children: "Remote Server (HTTP)"
27209
+ })]
27210
+ }), /*#__PURE__*/jsx("p", {
27211
+ className: "text-xs opacity-50",
27212
+ children: "Connect to a remote MCP server via HTTP"
27213
+ })]
27214
+ })]
27217
27215
  })]
27218
- })
27219
- }), envMappingRows.map(function (row) {
27220
- return /*#__PURE__*/jsxs("div", {
27221
- className: "flex items-center gap-2",
27216
+ }), transport === "stdio" && /*#__PURE__*/jsxs("div", {
27217
+ className: "space-y-4",
27222
27218
  children: [/*#__PURE__*/jsx("div", {
27223
- className: "flex-1",
27224
- children: /*#__PURE__*/jsx(InputText, {
27225
- value: row.envVar,
27226
- onChange: function onChange(value) {
27227
- return updateEnvRow(row.id, "envVar", value);
27228
- },
27229
- placeholder: "ENV_VAR_NAME"
27219
+ className: "border-t border-white/10 pt-4",
27220
+ children: /*#__PURE__*/jsx("p", {
27221
+ className: "text-xs font-semibold opacity-40 uppercase tracking-wider",
27222
+ children: "Process Configuration"
27230
27223
  })
27231
- }), /*#__PURE__*/jsx("span", {
27232
- className: "opacity-30 text-sm shrink-0",
27233
- children: "\u2192"
27234
- }), /*#__PURE__*/jsx("div", {
27235
- className: "flex-1",
27236
- children: /*#__PURE__*/jsx(InputText, {
27237
- value: row.credField,
27224
+ }), /*#__PURE__*/jsxs("div", {
27225
+ className: "flex flex-col gap-2",
27226
+ children: [/*#__PURE__*/jsx(FormLabel, {
27227
+ label: "Command",
27228
+ required: true
27229
+ }), /*#__PURE__*/jsx("p", {
27230
+ className: "text-sm opacity-50",
27231
+ children: "The executable to run (e.g., npx, node, python)"
27232
+ }), /*#__PURE__*/jsx(InputText, {
27233
+ value: command,
27238
27234
  onChange: function onChange(value) {
27239
- return updateEnvRow(row.id, "credField", value);
27235
+ setCommand(value);
27236
+ if (formErrors.command && value !== null && value !== void 0 && value.trim()) {
27237
+ setFormErrors(function (prev) {
27238
+ var next = _objectSpread$5({}, prev);
27239
+ delete next.command;
27240
+ return next;
27241
+ });
27242
+ }
27240
27243
  },
27241
- placeholder: "credentialField"
27242
- })
27243
- }), /*#__PURE__*/jsx("button", {
27244
- onClick: function onClick() {
27245
- return removeEnvRow(row.id);
27246
- },
27247
- className: "text-gray-500 hover:text-red-400 transition-colors shrink-0",
27248
- children: /*#__PURE__*/jsx(FontAwesomeIcon, {
27249
- icon: "times",
27250
- className: "text-sm"
27251
- })
27252
- })]
27253
- }, row.id);
27254
- }), /*#__PURE__*/jsxs("button", {
27255
- onClick: addEnvRow,
27256
- className: "text-sm text-blue-400 hover:text-blue-300 transition-colors flex items-center gap-1",
27257
- children: [/*#__PURE__*/jsx(FontAwesomeIcon, {
27258
- icon: "plus",
27259
- className: "text-xs"
27260
- }), /*#__PURE__*/jsx("span", {
27261
- children: "Add Environment Variable"
27262
- })]
27263
- })]
27264
- })]
27265
- }), transport === "streamable_http" && /*#__PURE__*/jsxs("div", {
27266
- className: "space-y-4",
27267
- children: [/*#__PURE__*/jsx("div", {
27268
- className: "border-t border-white/10 pt-4",
27269
- children: /*#__PURE__*/jsx("p", {
27270
- className: "text-xs font-semibold opacity-40 uppercase tracking-wider",
27271
- children: "Server Configuration"
27272
- })
27273
- }), /*#__PURE__*/jsxs("div", {
27274
- className: "flex flex-col gap-2",
27275
- children: [/*#__PURE__*/jsx(FormLabel, {
27276
- label: "Server URL",
27277
- required: true
27278
- }), /*#__PURE__*/jsxs("p", {
27279
- className: "text-sm opacity-50",
27280
- children: ["Use", " ", /*#__PURE__*/jsx("code", {
27281
- className: "text-xs bg-white/10 px-1 py-0.5 rounded",
27282
- children: "{{fieldName}}"
27283
- }), " ", "for values provided as credentials"]
27284
- }), /*#__PURE__*/jsx(InputText, {
27285
- value: url,
27286
- onChange: function onChange(value) {
27287
- setUrl(value);
27288
- if (formErrors.url && value !== null && value !== void 0 && value.trim()) {
27289
- setFormErrors(function (prev) {
27290
- var next = _objectSpread$5({}, prev);
27291
- delete next.url;
27292
- return next;
27293
- });
27294
- }
27295
- },
27296
- placeholder: "e.g., https://mcp.example.com/sse"
27297
- }), formErrors.url && /*#__PURE__*/jsx("p", {
27298
- className: "text-sm text-red-400",
27299
- children: formErrors.url
27300
- })]
27301
- }), /*#__PURE__*/jsxs("div", {
27302
- className: "space-y-3",
27303
- children: [/*#__PURE__*/jsxs("div", {
27304
- children: [/*#__PURE__*/jsx(FormLabel, {
27305
- label: "Request Headers"
27306
- }), /*#__PURE__*/jsxs("p", {
27307
- className: "text-sm opacity-50 mt-1",
27308
- children: ["Use", " ", /*#__PURE__*/jsx("code", {
27309
- className: "text-xs bg-white/10 px-1 py-0.5 rounded",
27310
- children: "{{fieldName}}"
27311
- }), " ", "in values for credential placeholders"]
27312
- })]
27313
- }), headerRows.map(function (row) {
27314
- return /*#__PURE__*/jsxs("div", {
27315
- className: "flex items-center gap-2",
27244
+ placeholder: "e.g., npx"
27245
+ }), formErrors.command && /*#__PURE__*/jsx("p", {
27246
+ className: "text-sm text-red-400",
27247
+ children: formErrors.command
27248
+ })]
27249
+ }), /*#__PURE__*/jsxs("div", {
27250
+ className: "flex flex-col gap-2",
27251
+ children: [/*#__PURE__*/jsx(FormLabel, {
27252
+ label: "Arguments"
27253
+ }), /*#__PURE__*/jsx("p", {
27254
+ className: "text-sm opacity-50",
27255
+ children: "Space-separated arguments passed to the command"
27256
+ }), /*#__PURE__*/jsx(InputText, {
27257
+ value: args,
27258
+ onChange: setArgs,
27259
+ placeholder: "e.g., -y @modelcontextprotocol/server-github"
27260
+ })]
27261
+ }), /*#__PURE__*/jsxs("div", {
27262
+ className: "space-y-3",
27263
+ children: [/*#__PURE__*/jsx("div", {
27264
+ className: "flex items-center justify-between",
27265
+ children: /*#__PURE__*/jsxs("div", {
27266
+ children: [/*#__PURE__*/jsx(FormLabel, {
27267
+ label: "Environment Variable Mapping"
27268
+ }), /*#__PURE__*/jsx("p", {
27269
+ className: "text-sm opacity-50 mt-1",
27270
+ children: "Map environment variables to credential fields"
27271
+ })]
27272
+ })
27273
+ }), envMappingRows.map(function (row) {
27274
+ return /*#__PURE__*/jsxs("div", {
27275
+ className: "flex items-center gap-2",
27276
+ children: [/*#__PURE__*/jsx("div", {
27277
+ className: "flex-1",
27278
+ children: /*#__PURE__*/jsx(InputText, {
27279
+ value: row.envVar,
27280
+ onChange: function onChange(value) {
27281
+ return updateEnvRow(row.id, "envVar", value);
27282
+ },
27283
+ placeholder: "ENV_VAR_NAME"
27284
+ })
27285
+ }), /*#__PURE__*/jsx("span", {
27286
+ className: "opacity-30 text-sm shrink-0",
27287
+ children: "\u2192"
27288
+ }), /*#__PURE__*/jsx("div", {
27289
+ className: "flex-1",
27290
+ children: /*#__PURE__*/jsx(InputText, {
27291
+ value: row.credField,
27292
+ onChange: function onChange(value) {
27293
+ return updateEnvRow(row.id, "credField", value);
27294
+ },
27295
+ placeholder: "credentialField"
27296
+ })
27297
+ }), /*#__PURE__*/jsx("button", {
27298
+ onClick: function onClick() {
27299
+ return removeEnvRow(row.id);
27300
+ },
27301
+ className: "text-gray-500 hover:text-red-400 transition-colors shrink-0",
27302
+ children: /*#__PURE__*/jsx(FontAwesomeIcon, {
27303
+ icon: "times",
27304
+ className: "text-sm"
27305
+ })
27306
+ })]
27307
+ }, row.id);
27308
+ }), /*#__PURE__*/jsxs("button", {
27309
+ onClick: addEnvRow,
27310
+ className: "text-sm text-blue-400 hover:text-blue-300 transition-colors flex items-center gap-1",
27311
+ children: [/*#__PURE__*/jsx(FontAwesomeIcon, {
27312
+ icon: "plus",
27313
+ className: "text-xs"
27314
+ }), /*#__PURE__*/jsx("span", {
27315
+ children: "Add Environment Variable"
27316
+ })]
27317
+ })]
27318
+ })]
27319
+ }), transport === "streamable_http" && /*#__PURE__*/jsxs("div", {
27320
+ className: "space-y-4",
27316
27321
  children: [/*#__PURE__*/jsx("div", {
27317
- className: "flex-1",
27318
- children: /*#__PURE__*/jsx(InputText, {
27319
- value: row.headerName,
27320
- onChange: function onChange(value) {
27321
- return updateHeaderRow(row.id, "headerName", value);
27322
- },
27323
- placeholder: "Header-Name"
27322
+ className: "border-t border-white/10 pt-4",
27323
+ children: /*#__PURE__*/jsx("p", {
27324
+ className: "text-xs font-semibold opacity-40 uppercase tracking-wider",
27325
+ children: "Server Configuration"
27324
27326
  })
27325
- }), /*#__PURE__*/jsx("span", {
27326
- className: "opacity-30 text-sm shrink-0",
27327
- children: ":"
27328
- }), /*#__PURE__*/jsx("div", {
27329
- className: "flex-1",
27330
- children: /*#__PURE__*/jsx(InputText, {
27331
- value: row.headerValue,
27327
+ }), /*#__PURE__*/jsxs("div", {
27328
+ className: "flex flex-col gap-2",
27329
+ children: [/*#__PURE__*/jsx(FormLabel, {
27330
+ label: "Server URL",
27331
+ required: true
27332
+ }), /*#__PURE__*/jsxs("p", {
27333
+ className: "text-sm opacity-50",
27334
+ children: ["Use", " ", /*#__PURE__*/jsx("code", {
27335
+ className: "text-xs bg-white/10 px-1 py-0.5 rounded",
27336
+ children: "{{fieldName}}"
27337
+ }), " ", "for values provided as credentials"]
27338
+ }), /*#__PURE__*/jsx(InputText, {
27339
+ value: url,
27332
27340
  onChange: function onChange(value) {
27333
- return updateHeaderRow(row.id, "headerValue", value);
27341
+ setUrl(value);
27342
+ if (formErrors.url && value !== null && value !== void 0 && value.trim()) {
27343
+ setFormErrors(function (prev) {
27344
+ var next = _objectSpread$5({}, prev);
27345
+ delete next.url;
27346
+ return next;
27347
+ });
27348
+ }
27334
27349
  },
27335
- placeholder: "Bearer {{apiKey}}"
27336
- })
27337
- }), /*#__PURE__*/jsx("button", {
27338
- onClick: function onClick() {
27339
- return removeHeaderRow(row.id);
27340
- },
27341
- className: "text-gray-500 hover:text-red-400 transition-colors shrink-0",
27342
- children: /*#__PURE__*/jsx(FontAwesomeIcon, {
27343
- icon: "times",
27344
- className: "text-sm"
27345
- })
27350
+ placeholder: "e.g., https://mcp.example.com/sse"
27351
+ }), formErrors.url && /*#__PURE__*/jsx("p", {
27352
+ className: "text-sm text-red-400",
27353
+ children: formErrors.url
27354
+ })]
27355
+ }), /*#__PURE__*/jsxs("div", {
27356
+ className: "space-y-3",
27357
+ children: [/*#__PURE__*/jsxs("div", {
27358
+ children: [/*#__PURE__*/jsx(FormLabel, {
27359
+ label: "Request Headers"
27360
+ }), /*#__PURE__*/jsxs("p", {
27361
+ className: "text-sm opacity-50 mt-1",
27362
+ children: ["Use", " ", /*#__PURE__*/jsx("code", {
27363
+ className: "text-xs bg-white/10 px-1 py-0.5 rounded",
27364
+ children: "{{fieldName}}"
27365
+ }), " ", "in values for credential placeholders"]
27366
+ })]
27367
+ }), headerRows.map(function (row) {
27368
+ return /*#__PURE__*/jsxs("div", {
27369
+ className: "flex items-center gap-2",
27370
+ children: [/*#__PURE__*/jsx("div", {
27371
+ className: "flex-1",
27372
+ children: /*#__PURE__*/jsx(InputText, {
27373
+ value: row.headerName,
27374
+ onChange: function onChange(value) {
27375
+ return updateHeaderRow(row.id, "headerName", value);
27376
+ },
27377
+ placeholder: "Header-Name"
27378
+ })
27379
+ }), /*#__PURE__*/jsx("span", {
27380
+ className: "opacity-30 text-sm shrink-0",
27381
+ children: ":"
27382
+ }), /*#__PURE__*/jsx("div", {
27383
+ className: "flex-1",
27384
+ children: /*#__PURE__*/jsx(InputText, {
27385
+ value: row.headerValue,
27386
+ onChange: function onChange(value) {
27387
+ return updateHeaderRow(row.id, "headerValue", value);
27388
+ },
27389
+ placeholder: "Bearer {{apiKey}}"
27390
+ })
27391
+ }), /*#__PURE__*/jsx("button", {
27392
+ onClick: function onClick() {
27393
+ return removeHeaderRow(row.id);
27394
+ },
27395
+ className: "text-gray-500 hover:text-red-400 transition-colors shrink-0",
27396
+ children: /*#__PURE__*/jsx(FontAwesomeIcon, {
27397
+ icon: "times",
27398
+ className: "text-sm"
27399
+ })
27400
+ })]
27401
+ }, row.id);
27402
+ }), /*#__PURE__*/jsxs("button", {
27403
+ onClick: addHeaderRow,
27404
+ className: "text-sm text-blue-400 hover:text-blue-300 transition-colors flex items-center gap-1",
27405
+ children: [/*#__PURE__*/jsx(FontAwesomeIcon, {
27406
+ icon: "plus",
27407
+ className: "text-xs"
27408
+ }), /*#__PURE__*/jsx("span", {
27409
+ children: "Add Header"
27410
+ })]
27411
+ })]
27412
+ })]
27413
+ }), formFields.length > 0 && /*#__PURE__*/jsxs(Fragment, {
27414
+ children: [/*#__PURE__*/jsxs("div", {
27415
+ className: "border-t border-white/10 pt-4",
27416
+ children: [/*#__PURE__*/jsx("p", {
27417
+ className: "text-xs font-semibold opacity-40 uppercase tracking-wider",
27418
+ children: "Credentials"
27419
+ }), /*#__PURE__*/jsx("p", {
27420
+ className: "text-sm opacity-50 mt-1",
27421
+ children: "Values for the fields referenced in your configuration above"
27422
+ })]
27423
+ }), formFields.map(function (field) {
27424
+ return /*#__PURE__*/jsxs("div", {
27425
+ className: "flex flex-col gap-2",
27426
+ children: [/*#__PURE__*/jsx(FormLabel, {
27427
+ label: field.displayName,
27428
+ required: field.required
27429
+ }), /*#__PURE__*/jsxs("div", {
27430
+ className: "flex gap-2",
27431
+ children: [/*#__PURE__*/jsx("div", {
27432
+ className: "flex-1",
27433
+ children: /*#__PURE__*/jsx(InputText, {
27434
+ type: field.secret ? "password" : "text",
27435
+ value: credentialData[field.key] || "",
27436
+ onChange: function onChange(value) {
27437
+ return handleCredentialChange(field.key, value);
27438
+ },
27439
+ placeholder: field.type === "file" ? "Select a file..." : "Enter ".concat(field.displayName.toLowerCase())
27440
+ })
27441
+ }), field.type === "file" && /*#__PURE__*/jsx("button", {
27442
+ onClick: /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
27443
+ var filepath;
27444
+ return _regeneratorRuntime.wrap(function (_context) {
27445
+ while (1) switch (_context.prev = _context.next) {
27446
+ case 0:
27447
+ _context.next = 1;
27448
+ return window.mainApi.dialog.chooseFile(true, ["json"]);
27449
+ case 1:
27450
+ filepath = _context.sent;
27451
+ if (filepath) handleCredentialChange(field.key, filepath);
27452
+ case 2:
27453
+ case "end":
27454
+ return _context.stop();
27455
+ }
27456
+ }, _callee);
27457
+ })),
27458
+ className: "px-3 py-1.5 text-sm rounded bg-white/10 hover:bg-white/20 transition-colors",
27459
+ children: "Browse"
27460
+ })]
27461
+ }), formErrors[field.key] && /*#__PURE__*/jsx("p", {
27462
+ className: "text-sm text-red-400",
27463
+ children: formErrors[field.key]
27464
+ })]
27465
+ }, field.key);
27346
27466
  })]
27347
- }, row.id);
27348
- }), /*#__PURE__*/jsxs("button", {
27349
- onClick: addHeaderRow,
27350
- className: "text-sm text-blue-400 hover:text-blue-300 transition-colors flex items-center gap-1",
27351
- children: [/*#__PURE__*/jsx(FontAwesomeIcon, {
27352
- icon: "plus",
27353
- className: "text-xs"
27354
- }), /*#__PURE__*/jsx("span", {
27355
- children: "Add Header"
27356
27467
  })]
27357
27468
  })]
27358
- })]
27359
- }), formFields.length > 0 && /*#__PURE__*/jsxs(Fragment, {
27360
- children: [/*#__PURE__*/jsxs("div", {
27361
- className: "border-t border-white/10 pt-4",
27362
- children: [/*#__PURE__*/jsx("p", {
27363
- className: "text-xs font-semibold opacity-40 uppercase tracking-wider",
27364
- children: "Credentials"
27365
- }), /*#__PURE__*/jsx("p", {
27366
- className: "text-sm opacity-50 mt-1",
27367
- children: "Values for the fields referenced in your configuration above"
27368
- })]
27369
- }), formFields.map(function (field) {
27370
- return /*#__PURE__*/jsxs("div", {
27371
- className: "flex flex-col gap-2",
27372
- children: [/*#__PURE__*/jsx(FormLabel, {
27373
- label: field.displayName,
27374
- required: field.required
27375
- }), /*#__PURE__*/jsxs("div", {
27376
- className: "flex gap-2",
27377
- children: [/*#__PURE__*/jsx("div", {
27378
- className: "flex-1",
27379
- children: /*#__PURE__*/jsx(InputText, {
27380
- type: field.secret ? "password" : "text",
27381
- value: credentialData[field.key] || "",
27382
- onChange: function onChange(value) {
27383
- return handleCredentialChange(field.key, value);
27384
- },
27385
- placeholder: field.type === "file" ? "Select a file..." : "Enter ".concat(field.displayName.toLowerCase())
27386
- })
27387
- }), field.type === "file" && /*#__PURE__*/jsx("button", {
27388
- onClick: /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
27389
- var filepath;
27390
- return _regeneratorRuntime.wrap(function (_context) {
27391
- while (1) switch (_context.prev = _context.next) {
27392
- case 0:
27393
- _context.next = 1;
27394
- return window.mainApi.dialog.chooseFile(true, ["json"]);
27395
- case 1:
27396
- filepath = _context.sent;
27397
- if (filepath) handleCredentialChange(field.key, filepath);
27398
- case 2:
27399
- case "end":
27400
- return _context.stop();
27401
- }
27402
- }, _callee);
27403
- })),
27404
- className: "px-3 py-1.5 text-sm rounded bg-white/10 hover:bg-white/20 transition-colors",
27405
- children: "Browse"
27406
- })]
27407
- }), formErrors[field.key] && /*#__PURE__*/jsx("p", {
27408
- className: "text-sm text-red-400",
27409
- children: formErrors[field.key]
27469
+ })
27470
+ }), /*#__PURE__*/jsx(Stepper.Step, {
27471
+ label: "Test",
27472
+ description: "Verify connection",
27473
+ children: /*#__PURE__*/jsxs("div", {
27474
+ className: "flex-1 min-h-0 overflow-y-auto px-6 pb-4 space-y-5",
27475
+ children: [/*#__PURE__*/jsxs("div", {
27476
+ className: "flex flex-col items-center justify-center py-8 space-y-4",
27477
+ children: [/*#__PURE__*/jsx("p", {
27478
+ className: "text-sm opacity-60 text-center",
27479
+ children: "Test the connection to verify your configuration is correct."
27480
+ }), /*#__PURE__*/jsx(Button, {
27481
+ title: isTesting ? "Testing..." : "Test Connection",
27482
+ onClick: handleTestConnection,
27483
+ size: "md"
27410
27484
  })]
27411
- }, field.key);
27412
- })]
27485
+ }), testResult && /*#__PURE__*/jsx("div", {
27486
+ 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"),
27487
+ children: /*#__PURE__*/jsxs("div", {
27488
+ className: "flex items-center gap-2",
27489
+ children: [/*#__PURE__*/jsx(FontAwesomeIcon, {
27490
+ icon: testResult.success ? "circle-check" : "circle-exclamation"
27491
+ }), /*#__PURE__*/jsx("span", {
27492
+ children: testResult.message
27493
+ })]
27494
+ })
27495
+ })]
27496
+ })
27497
+ }), /*#__PURE__*/jsx(Stepper.Step, {
27498
+ label: "Tools",
27499
+ description: "Select allowed tools",
27500
+ children: /*#__PURE__*/jsx("div", {
27501
+ className: "flex-1 min-h-0 overflow-y-auto px-6 pb-4 space-y-5",
27502
+ children: testResult !== null && testResult !== void 0 && testResult.success && ((_testResult$tools = testResult.tools) === null || _testResult$tools === void 0 ? void 0 : _testResult$tools.length) > 0 && selectedTools ? /*#__PURE__*/jsx(ToolSelector, {
27503
+ tools: testResult.tools,
27504
+ selectedTools: selectedTools,
27505
+ onSelectionChange: setSelectedTools
27506
+ }) : /*#__PURE__*/jsx("div", {
27507
+ className: "text-center py-8 opacity-50",
27508
+ children: "No tools available. Go back and test the connection first."
27509
+ })
27510
+ })
27413
27511
  })]
27414
- }), testResult && /*#__PURE__*/jsx("div", {
27415
- 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"),
27416
- children: /*#__PURE__*/jsxs("div", {
27417
- className: "flex items-center gap-2",
27418
- children: [/*#__PURE__*/jsx(FontAwesomeIcon, {
27419
- icon: testResult.success ? "circle-check" : "circle-exclamation"
27420
- }), /*#__PURE__*/jsx("span", {
27421
- children: testResult.message
27422
- })]
27423
- })
27424
- }), (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, {
27425
- tools: testResult.tools,
27426
- selectedTools: selectedTools,
27427
- onSelectionChange: setSelectedTools
27428
- })]
27512
+ })
27429
27513
  }), /*#__PURE__*/jsxs("div", {
27430
- className: "flex-shrink-0 flex flex-row justify-end gap-2 px-6 py-4 border-t border-white/10",
27431
- children: [/*#__PURE__*/jsx(Button, {
27432
- title: "Cancel",
27433
- onClick: onBack,
27434
- size: "sm"
27435
- }), /*#__PURE__*/jsx(Button, {
27436
- title: isTesting ? "Testing..." : "Test Connection",
27437
- onClick: handleTestConnection,
27438
- size: "sm"
27439
- }), /*#__PURE__*/jsx(Button, {
27440
- title: isEditMode ? "Save Changes" : "Save MCP Server",
27441
- onClick: handleSave,
27442
- size: "sm"
27514
+ className: "flex-shrink-0 flex flex-row items-center px-6 py-4 border-t border-white/10",
27515
+ children: [/*#__PURE__*/jsxs("div", {
27516
+ className: "flex flex-row gap-2",
27517
+ children: [wizardStep === 0 && /*#__PURE__*/jsx(Button, {
27518
+ title: "Cancel",
27519
+ onClick: onBack,
27520
+ size: "sm"
27521
+ }), wizardStep > 0 && /*#__PURE__*/jsx(Button, {
27522
+ title: "Back",
27523
+ onClick: function onClick() {
27524
+ return setWizardStep(wizardStep - 1);
27525
+ },
27526
+ size: "sm"
27527
+ })]
27528
+ }), /*#__PURE__*/jsx("div", {
27529
+ className: "flex-1 text-center",
27530
+ children: /*#__PURE__*/jsxs("span", {
27531
+ className: "text-xs opacity-40",
27532
+ children: ["Step ", wizardStep + 1, " of 3"]
27533
+ })
27534
+ }), /*#__PURE__*/jsxs("div", {
27535
+ className: "flex flex-row gap-2",
27536
+ children: [wizardStep === 0 && /*#__PURE__*/jsx(Button, {
27537
+ title: "Next",
27538
+ onClick: function onClick() {
27539
+ return handleWizardStepChange(1);
27540
+ },
27541
+ size: "sm"
27542
+ }), wizardStep === 1 && /*#__PURE__*/jsxs(Fragment, {
27543
+ children: [/*#__PURE__*/jsx(Button, {
27544
+ title: isTesting ? "Testing..." : "Test Connection",
27545
+ onClick: handleTestConnection,
27546
+ size: "sm"
27547
+ }), /*#__PURE__*/jsx(Button, {
27548
+ title: "Next",
27549
+ onClick: function onClick() {
27550
+ return handleWizardStepChange(2);
27551
+ },
27552
+ disabled: !(testResult !== null && testResult !== void 0 && testResult.success) && !(isEditMode && initialAllowedTools),
27553
+ size: "sm"
27554
+ })]
27555
+ }), wizardStep === 2 && /*#__PURE__*/jsx(Button, {
27556
+ title: isEditMode ? "Save Changes" : "Save MCP Server",
27557
+ onClick: handleSave,
27558
+ size: "sm"
27559
+ })]
27443
27560
  })]
27444
27561
  })]
27445
27562
  });
@@ -27526,30 +27643,34 @@ var McpCatalogDetail = function McpCatalogDetail(_ref) {
27526
27643
  _useState20 = _slicedToArray(_useState19, 2),
27527
27644
  selectedTools = _useState20[0],
27528
27645
  setSelectedTools = _useState20[1];
27646
+ var _useState21 = useState(0),
27647
+ _useState22 = _slicedToArray(_useState21, 2),
27648
+ wizardStep = _useState22[0],
27649
+ setWizardStep = _useState22[1];
27529
27650
 
27530
27651
  // Configuration form state
27531
- var _useState21 = useState(""),
27532
- _useState22 = _slicedToArray(_useState21, 2),
27533
- providerName = _useState22[0],
27534
- setProviderName = _useState22[1];
27535
- var _useState23 = useState({}),
27652
+ var _useState23 = useState(""),
27536
27653
  _useState24 = _slicedToArray(_useState23, 2),
27537
- credentialData = _useState24[0],
27538
- setCredentialData = _useState24[1];
27654
+ providerName = _useState24[0],
27655
+ setProviderName = _useState24[1];
27539
27656
  var _useState25 = useState({}),
27540
27657
  _useState26 = _slicedToArray(_useState25, 2),
27541
- formErrors = _useState26[0],
27542
- setFormErrors = _useState26[1];
27658
+ credentialData = _useState26[0],
27659
+ setCredentialData = _useState26[1];
27660
+ var _useState27 = useState({}),
27661
+ _useState28 = _slicedToArray(_useState27, 2),
27662
+ formErrors = _useState28[0],
27663
+ setFormErrors = _useState28[1];
27543
27664
 
27544
27665
  // Advanced config row state
27545
- var _useState27 = useState([]),
27546
- _useState28 = _slicedToArray(_useState27, 2),
27547
- envMappingRows = _useState28[0],
27548
- setEnvMappingRows = _useState28[1];
27549
27666
  var _useState29 = useState([]),
27550
27667
  _useState30 = _slicedToArray(_useState29, 2),
27551
- headerRows = _useState30[0],
27552
- setHeaderRows = _useState30[1];
27668
+ envMappingRows = _useState30[0],
27669
+ setEnvMappingRows = _useState30[1];
27670
+ var _useState31 = useState([]),
27671
+ _useState32 = _slicedToArray(_useState31, 2),
27672
+ headerRows = _useState32[0],
27673
+ setHeaderRows = _useState32[1];
27553
27674
  var rowIdRef = useRef(0);
27554
27675
  var nextRowId = function nextRowId() {
27555
27676
  return "cat_".concat(++rowIdRef.current);
@@ -27590,6 +27711,24 @@ var McpCatalogDetail = function McpCatalogDetail(_ref) {
27590
27711
  });
27591
27712
  });
27592
27713
 
27714
+ // Wizard step navigation with validation gates
27715
+ var handleWizardStepChange = function handleWizardStepChange(newStep) {
27716
+ // Allow backward navigation freely
27717
+ if (newStep < wizardStep) {
27718
+ setWizardStep(newStep);
27719
+ return;
27720
+ }
27721
+ // Step 0→1: validate the configure form
27722
+ if (wizardStep === 0 && newStep >= 1) {
27723
+ if (!validateForm()) return;
27724
+ }
27725
+ // Step 1→2: require successful test
27726
+ if (wizardStep === 1 && newStep >= 2) {
27727
+ if (!(testResult !== null && testResult !== void 0 && testResult.success)) return;
27728
+ }
27729
+ setWizardStep(newStep);
27730
+ };
27731
+
27593
27732
  // Handle server selection -> show configuration form
27594
27733
  var handleSelectServer = function handleSelectServer(server) {
27595
27734
  var _server$mcpConfig, _server$mcpConfig2;
@@ -27600,6 +27739,7 @@ var McpCatalogDetail = function McpCatalogDetail(_ref) {
27600
27739
  setProviderName(server.name);
27601
27740
  setCredentialData({});
27602
27741
  setFormErrors({});
27742
+ setWizardStep(0);
27603
27743
  setEnvMappingRows(envMappingToRows((_server$mcpConfig = server.mcpConfig) === null || _server$mcpConfig === void 0 ? void 0 : _server$mcpConfig.envMapping, nextRowId));
27604
27744
  setHeaderRows(headerTemplateToRows((_server$mcpConfig2 = server.mcpConfig) === null || _server$mcpConfig2 === void 0 ? void 0 : _server$mcpConfig2.headerTemplate, nextRowId));
27605
27745
  };
@@ -27730,6 +27870,7 @@ var McpCatalogDetail = function McpCatalogDetail(_ref) {
27730
27870
  setFormErrors({});
27731
27871
  setEnvMappingRows([]);
27732
27872
  setHeaderRows([]);
27873
+ setWizardStep(0);
27733
27874
  };
27734
27875
 
27735
27876
  // Prune credential data when form fields change (advanced config removed a field)
@@ -27757,205 +27898,280 @@ var McpCatalogDetail = function McpCatalogDetail(_ref) {
27757
27898
  });
27758
27899
  }
27759
27900
 
27760
- // ── Stage 2: Configuration Form ──
27901
+ // ── Stage 2: Configuration Form (3-step Stepper) ──
27761
27902
  if (isConfiguring && selectedServer) {
27762
27903
  var _testResult$tools;
27763
27904
  return /*#__PURE__*/jsxs("div", {
27764
27905
  className: "flex flex-col flex-1 min-h-0",
27765
27906
  children: [/*#__PURE__*/jsxs("div", {
27766
- className: "flex-1 min-h-0 overflow-y-auto p-6 space-y-5",
27767
- children: [/*#__PURE__*/jsxs("div", {
27768
- className: "flex items-center gap-3",
27769
- children: [/*#__PURE__*/jsx("button", {
27770
- onClick: handleBack,
27771
- className: "text-gray-400 hover:text-gray-200 transition-colors",
27772
- children: /*#__PURE__*/jsx(FontAwesomeIcon, {
27773
- icon: "arrow-left",
27774
- className: "text-lg"
27775
- })
27776
- }), /*#__PURE__*/jsxs("div", {
27777
- children: [/*#__PURE__*/jsx(SubHeading3, {
27778
- title: "Configure ".concat(selectedServer.name),
27779
- padding: false
27780
- }), /*#__PURE__*/jsx("p", {
27781
- className: "text-sm opacity-50 mt-1",
27782
- children: selectedServer.description || "Configure the MCP server connection"
27783
- })]
27784
- })]
27785
- }), /*#__PURE__*/jsxs("div", {
27786
- className: "bg-white/5 border border-white/10 rounded-lg p-4 space-y-3",
27787
- children: [/*#__PURE__*/jsx("p", {
27788
- className: "text-xs font-semibold opacity-40 uppercase tracking-wider",
27789
- children: "MCP Server Connection"
27790
- }), /*#__PURE__*/jsxs("div", {
27791
- className: "space-y-2 text-sm",
27792
- children: [/*#__PURE__*/jsxs("div", {
27793
- className: "flex gap-2",
27794
- children: [/*#__PURE__*/jsx("span", {
27795
- className: "opacity-50 w-24 shrink-0",
27796
- children: "Transport:"
27797
- }), /*#__PURE__*/jsx(Tag, {
27798
- text: effectiveMcpConfig.transport === "streamable_http" ? "Streamable HTTP" : "stdio"
27799
- })]
27800
- }), effectiveMcpConfig.transport === "streamable_http" ? /*#__PURE__*/jsxs("div", {
27801
- className: "flex gap-2",
27802
- children: [/*#__PURE__*/jsx("span", {
27803
- className: "opacity-50 w-24 shrink-0",
27804
- children: "Endpoint:"
27805
- }), /*#__PURE__*/jsx("span", {
27806
- className: "text-xs opacity-70",
27807
- children: "Remote hosted server (URL provided below)"
27808
- })]
27809
- }) : /*#__PURE__*/jsxs(Fragment, {
27810
- children: [/*#__PURE__*/jsxs("div", {
27811
- className: "flex gap-2",
27812
- children: [/*#__PURE__*/jsx("span", {
27813
- className: "opacity-50 w-24 shrink-0",
27814
- children: "Command:"
27815
- }), /*#__PURE__*/jsxs("code", {
27816
- className: "text-xs bg-white/5 px-2 py-0.5 rounded",
27817
- children: [effectiveMcpConfig.command, " ", (effectiveMcpConfig.args || []).join(" ")]
27818
- })]
27819
- }), effectiveMcpConfig.envMapping && Object.keys(effectiveMcpConfig.envMapping).length > 0 && /*#__PURE__*/jsxs("div", {
27820
- className: "flex gap-2",
27821
- children: [/*#__PURE__*/jsx("span", {
27822
- className: "opacity-50 w-24 shrink-0",
27823
- children: "Env Vars:"
27824
- }), /*#__PURE__*/jsx("span", {
27825
- className: "text-xs opacity-70",
27826
- children: Object.keys(effectiveMcpConfig.envMapping).join(", ")
27827
- })]
27828
- })]
27829
- })]
27830
- })]
27831
- }), /*#__PURE__*/jsx(AdvancedMcpConfig, {
27832
- transport: effectiveMcpConfig.transport || "stdio",
27833
- envMappingRows: envMappingRows,
27834
- onEnvMappingRowsChange: setEnvMappingRows,
27835
- headerRows: headerRows,
27836
- onHeaderRowsChange: setHeaderRows
27907
+ className: "flex items-center gap-3 px-6 pt-6 pb-2",
27908
+ children: [/*#__PURE__*/jsx("button", {
27909
+ onClick: handleBack,
27910
+ className: "text-gray-400 hover:text-gray-200 transition-colors",
27911
+ children: /*#__PURE__*/jsx(FontAwesomeIcon, {
27912
+ icon: "arrow-left",
27913
+ className: "text-lg"
27914
+ })
27837
27915
  }), /*#__PURE__*/jsxs("div", {
27838
- className: "flex flex-col gap-2",
27839
- children: [/*#__PURE__*/jsx(FormLabel, {
27840
- label: "Provider Name",
27841
- required: true
27916
+ children: [/*#__PURE__*/jsx(SubHeading3, {
27917
+ title: "Configure ".concat(selectedServer.name),
27918
+ padding: false
27842
27919
  }), /*#__PURE__*/jsx("p", {
27843
- className: "text-sm opacity-50",
27844
- children: "A name to identify this MCP server instance (e.g., \"Algolia Production\")"
27845
- }), /*#__PURE__*/jsx(InputText, {
27846
- value: providerName,
27847
- onChange: function onChange(value) {
27848
- setProviderName(value);
27849
- if (formErrors.providerName && value !== null && value !== void 0 && value.trim()) {
27850
- setFormErrors(function (prev) {
27851
- var next = _objectSpread$4({}, prev);
27852
- delete next.providerName;
27853
- return next;
27854
- });
27855
- }
27856
- },
27857
- placeholder: "Enter provider name"
27858
- }), formErrors.providerName && /*#__PURE__*/jsx("p", {
27859
- className: "text-sm text-red-400",
27860
- children: formErrors.providerName
27920
+ className: "text-sm opacity-50 mt-1",
27921
+ children: selectedServer.description || "Configure the MCP server connection"
27861
27922
  })]
27862
- }), formFields.length > 0 && /*#__PURE__*/jsxs(Fragment, {
27863
- children: [/*#__PURE__*/jsx("div", {
27864
- className: "border-t border-white/10 pt-4",
27865
- children: /*#__PURE__*/jsx("p", {
27866
- className: "text-xs font-semibold opacity-40 uppercase tracking-wider",
27867
- children: effectiveMcpConfig.transport === "streamable_http" ? "Server Configuration" : "Authentication"
27868
- })
27869
- }), formFields.map(function (field) {
27870
- return /*#__PURE__*/jsxs("div", {
27871
- className: "flex flex-col gap-2",
27872
- children: [/*#__PURE__*/jsx(FormLabel, {
27873
- label: field.displayName,
27874
- required: field.required
27875
- }), field.instructions && /*#__PURE__*/jsx("p", {
27876
- className: "text-sm opacity-50",
27877
- children: field.instructions
27923
+ })]
27924
+ }), /*#__PURE__*/jsx("div", {
27925
+ className: "flex-1 min-h-0 flex flex-col",
27926
+ children: /*#__PURE__*/jsxs(Stepper, {
27927
+ activeStep: wizardStep,
27928
+ onStepChange: handleWizardStepChange,
27929
+ showNavigation: false,
27930
+ className: "flex-1 min-h-0 flex flex-col",
27931
+ children: [/*#__PURE__*/jsx(Stepper.Step, {
27932
+ label: "Configure",
27933
+ description: "Name & credentials",
27934
+ children: /*#__PURE__*/jsxs("div", {
27935
+ className: "flex-1 min-h-0 overflow-y-auto px-6 pb-4 space-y-5",
27936
+ children: [/*#__PURE__*/jsxs("div", {
27937
+ className: "bg-white/5 border border-white/10 rounded-lg p-4 space-y-3",
27938
+ children: [/*#__PURE__*/jsx("p", {
27939
+ className: "text-xs font-semibold opacity-40 uppercase tracking-wider",
27940
+ children: "MCP Server Connection"
27941
+ }), /*#__PURE__*/jsxs("div", {
27942
+ className: "space-y-2 text-sm",
27943
+ children: [/*#__PURE__*/jsxs("div", {
27944
+ className: "flex gap-2",
27945
+ children: [/*#__PURE__*/jsx("span", {
27946
+ className: "opacity-50 w-24 shrink-0",
27947
+ children: "Transport:"
27948
+ }), /*#__PURE__*/jsx(Tag, {
27949
+ text: effectiveMcpConfig.transport === "streamable_http" ? "Streamable HTTP" : "stdio"
27950
+ })]
27951
+ }), effectiveMcpConfig.transport === "streamable_http" ? /*#__PURE__*/jsxs("div", {
27952
+ className: "flex gap-2",
27953
+ children: [/*#__PURE__*/jsx("span", {
27954
+ className: "opacity-50 w-24 shrink-0",
27955
+ children: "Endpoint:"
27956
+ }), /*#__PURE__*/jsx("span", {
27957
+ className: "text-xs opacity-70",
27958
+ children: "Remote hosted server (URL provided below)"
27959
+ })]
27960
+ }) : /*#__PURE__*/jsxs(Fragment, {
27961
+ children: [/*#__PURE__*/jsxs("div", {
27962
+ className: "flex gap-2",
27963
+ children: [/*#__PURE__*/jsx("span", {
27964
+ className: "opacity-50 w-24 shrink-0",
27965
+ children: "Command:"
27966
+ }), /*#__PURE__*/jsxs("code", {
27967
+ className: "text-xs bg-white/5 px-2 py-0.5 rounded",
27968
+ children: [effectiveMcpConfig.command, " ", (effectiveMcpConfig.args || []).join(" ")]
27969
+ })]
27970
+ }), effectiveMcpConfig.envMapping && Object.keys(effectiveMcpConfig.envMapping).length > 0 && /*#__PURE__*/jsxs("div", {
27971
+ className: "flex gap-2",
27972
+ children: [/*#__PURE__*/jsx("span", {
27973
+ className: "opacity-50 w-24 shrink-0",
27974
+ children: "Env Vars:"
27975
+ }), /*#__PURE__*/jsx("span", {
27976
+ className: "text-xs opacity-70",
27977
+ children: Object.keys(effectiveMcpConfig.envMapping).join(", ")
27978
+ })]
27979
+ })]
27980
+ })]
27981
+ })]
27982
+ }), /*#__PURE__*/jsx(AdvancedMcpConfig, {
27983
+ transport: effectiveMcpConfig.transport || "stdio",
27984
+ envMappingRows: envMappingRows,
27985
+ onEnvMappingRowsChange: setEnvMappingRows,
27986
+ headerRows: headerRows,
27987
+ onHeaderRowsChange: setHeaderRows
27878
27988
  }), /*#__PURE__*/jsxs("div", {
27879
- className: "flex gap-2",
27989
+ className: "flex flex-col gap-2",
27990
+ children: [/*#__PURE__*/jsx(FormLabel, {
27991
+ label: "Provider Name",
27992
+ required: true
27993
+ }), /*#__PURE__*/jsx("p", {
27994
+ className: "text-sm opacity-50",
27995
+ children: "A name to identify this MCP server instance (e.g., \"Algolia Production\")"
27996
+ }), /*#__PURE__*/jsx(InputText, {
27997
+ value: providerName,
27998
+ onChange: function onChange(value) {
27999
+ setProviderName(value);
28000
+ if (formErrors.providerName && value !== null && value !== void 0 && value.trim()) {
28001
+ setFormErrors(function (prev) {
28002
+ var next = _objectSpread$4({}, prev);
28003
+ delete next.providerName;
28004
+ return next;
28005
+ });
28006
+ }
28007
+ },
28008
+ placeholder: "Enter provider name"
28009
+ }), formErrors.providerName && /*#__PURE__*/jsx("p", {
28010
+ className: "text-sm text-red-400",
28011
+ children: formErrors.providerName
28012
+ })]
28013
+ }), formFields.length > 0 && /*#__PURE__*/jsxs(Fragment, {
27880
28014
  children: [/*#__PURE__*/jsx("div", {
27881
- className: "flex-1",
27882
- children: /*#__PURE__*/jsx(InputText, {
27883
- type: field.secret ? "password" : "text",
27884
- value: credentialData[field.key] || "",
27885
- onChange: function onChange(value) {
27886
- return handleCredentialChange(field.key, value);
27887
- },
27888
- placeholder: field.type === "file" ? "Select a file..." : "Enter ".concat(field.displayName.toLowerCase())
28015
+ className: "border-t border-white/10 pt-4",
28016
+ children: /*#__PURE__*/jsx("p", {
28017
+ className: "text-xs font-semibold opacity-40 uppercase tracking-wider",
28018
+ children: effectiveMcpConfig.transport === "streamable_http" ? "Server Configuration" : "Authentication"
27889
28019
  })
27890
- }), field.type === "file" && /*#__PURE__*/jsx("button", {
27891
- onClick: /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
27892
- var filepath;
27893
- return _regeneratorRuntime.wrap(function (_context) {
27894
- while (1) switch (_context.prev = _context.next) {
27895
- case 0:
27896
- _context.next = 1;
27897
- return window.mainApi.dialog.chooseFile(true, ["json"]);
27898
- case 1:
27899
- filepath = _context.sent;
27900
- if (filepath) handleCredentialChange(field.key, filepath);
27901
- case 2:
27902
- case "end":
27903
- return _context.stop();
27904
- }
27905
- }, _callee);
27906
- })),
27907
- className: "px-3 py-1.5 text-sm rounded bg-white/10 hover:bg-white/20 transition-colors",
27908
- children: "Browse"
28020
+ }), formFields.map(function (field) {
28021
+ return /*#__PURE__*/jsxs("div", {
28022
+ className: "flex flex-col gap-2",
28023
+ children: [/*#__PURE__*/jsx(FormLabel, {
28024
+ label: field.displayName,
28025
+ required: field.required
28026
+ }), field.instructions && /*#__PURE__*/jsx("p", {
28027
+ className: "text-sm opacity-50",
28028
+ children: field.instructions
28029
+ }), /*#__PURE__*/jsxs("div", {
28030
+ className: "flex gap-2",
28031
+ children: [/*#__PURE__*/jsx("div", {
28032
+ className: "flex-1",
28033
+ children: /*#__PURE__*/jsx(InputText, {
28034
+ type: field.secret ? "password" : "text",
28035
+ value: credentialData[field.key] || "",
28036
+ onChange: function onChange(value) {
28037
+ return handleCredentialChange(field.key, value);
28038
+ },
28039
+ placeholder: field.type === "file" ? "Select a file..." : "Enter ".concat(field.displayName.toLowerCase())
28040
+ })
28041
+ }), field.type === "file" && /*#__PURE__*/jsx("button", {
28042
+ onClick: /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
28043
+ var filepath;
28044
+ return _regeneratorRuntime.wrap(function (_context) {
28045
+ while (1) switch (_context.prev = _context.next) {
28046
+ case 0:
28047
+ _context.next = 1;
28048
+ return window.mainApi.dialog.chooseFile(true, ["json"]);
28049
+ case 1:
28050
+ filepath = _context.sent;
28051
+ if (filepath) handleCredentialChange(field.key, filepath);
28052
+ case 2:
28053
+ case "end":
28054
+ return _context.stop();
28055
+ }
28056
+ }, _callee);
28057
+ })),
28058
+ className: "px-3 py-1.5 text-sm rounded bg-white/10 hover:bg-white/20 transition-colors",
28059
+ children: "Browse"
28060
+ })]
28061
+ }), formErrors[field.key] && /*#__PURE__*/jsx("p", {
28062
+ className: "text-sm text-red-400",
28063
+ children: formErrors[field.key]
28064
+ })]
28065
+ }, field.key);
27909
28066
  })]
27910
- }), formErrors[field.key] && /*#__PURE__*/jsx("p", {
27911
- className: "text-sm text-red-400",
27912
- children: formErrors[field.key]
28067
+ }), authResult && /*#__PURE__*/jsx("div", {
28068
+ 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"),
28069
+ children: /*#__PURE__*/jsxs("div", {
28070
+ className: "flex items-center gap-2",
28071
+ children: [/*#__PURE__*/jsx(FontAwesomeIcon, {
28072
+ icon: authResult.success ? "circle-check" : "circle-exclamation"
28073
+ }), /*#__PURE__*/jsx("span", {
28074
+ children: authResult.message
28075
+ })]
28076
+ })
27913
28077
  })]
27914
- }, field.key);
28078
+ })
28079
+ }), /*#__PURE__*/jsx(Stepper.Step, {
28080
+ label: "Test",
28081
+ description: "Verify connection",
28082
+ children: /*#__PURE__*/jsxs("div", {
28083
+ className: "flex-1 min-h-0 overflow-y-auto px-6 pb-4 space-y-5",
28084
+ children: [/*#__PURE__*/jsxs("div", {
28085
+ className: "flex flex-col items-center justify-center py-8 space-y-4",
28086
+ children: [/*#__PURE__*/jsx("p", {
28087
+ className: "text-sm opacity-60 text-center",
28088
+ children: "Test the connection to verify your configuration is correct."
28089
+ }), /*#__PURE__*/jsx(Button, {
28090
+ title: isTesting ? "Testing..." : "Test Connection",
28091
+ onClick: handleTestConnection,
28092
+ size: "md"
28093
+ })]
28094
+ }), testResult && /*#__PURE__*/jsx("div", {
28095
+ 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"),
28096
+ children: /*#__PURE__*/jsxs("div", {
28097
+ className: "flex items-center gap-2",
28098
+ children: [/*#__PURE__*/jsx(FontAwesomeIcon, {
28099
+ icon: testResult.success ? "circle-check" : "circle-exclamation"
28100
+ }), /*#__PURE__*/jsx("span", {
28101
+ children: testResult.message
28102
+ })]
28103
+ })
28104
+ })]
28105
+ })
28106
+ }), /*#__PURE__*/jsx(Stepper.Step, {
28107
+ label: "Tools",
28108
+ description: "Select allowed tools",
28109
+ children: /*#__PURE__*/jsx("div", {
28110
+ className: "flex-1 min-h-0 overflow-y-auto px-6 pb-4 space-y-5",
28111
+ children: testResult !== null && testResult !== void 0 && testResult.success && ((_testResult$tools = testResult.tools) === null || _testResult$tools === void 0 ? void 0 : _testResult$tools.length) > 0 && selectedTools ? /*#__PURE__*/jsx(ToolSelector, {
28112
+ tools: testResult.tools,
28113
+ selectedTools: selectedTools,
28114
+ onSelectionChange: setSelectedTools
28115
+ }) : /*#__PURE__*/jsx("div", {
28116
+ className: "text-center py-8 opacity-50",
28117
+ children: "No tools available. Go back and test the connection first."
28118
+ })
28119
+ })
27915
28120
  })]
27916
- }), authResult && /*#__PURE__*/jsx("div", {
27917
- 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"),
27918
- children: /*#__PURE__*/jsxs("div", {
27919
- className: "flex items-center gap-2",
27920
- children: [/*#__PURE__*/jsx(FontAwesomeIcon, {
27921
- icon: authResult.success ? "circle-check" : "circle-exclamation"
27922
- }), /*#__PURE__*/jsx("span", {
27923
- children: authResult.message
27924
- })]
28121
+ })
28122
+ }), /*#__PURE__*/jsxs("div", {
28123
+ className: "flex-shrink-0 flex flex-row items-center px-6 py-4 border-t border-white/10",
28124
+ children: [/*#__PURE__*/jsxs("div", {
28125
+ className: "flex flex-row gap-2",
28126
+ children: [wizardStep === 0 && /*#__PURE__*/jsx(Button, {
28127
+ title: "Cancel",
28128
+ onClick: onCancel,
28129
+ size: "sm"
28130
+ }), wizardStep > 0 && /*#__PURE__*/jsx(Button, {
28131
+ title: "Back",
28132
+ onClick: function onClick() {
28133
+ return setWizardStep(wizardStep - 1);
28134
+ },
28135
+ size: "sm"
28136
+ })]
28137
+ }), /*#__PURE__*/jsx("div", {
28138
+ className: "flex-1 text-center",
28139
+ children: /*#__PURE__*/jsxs("span", {
28140
+ className: "text-xs opacity-40",
28141
+ children: ["Step ", wizardStep + 1, " of 3"]
27925
28142
  })
27926
- }), testResult && /*#__PURE__*/jsx("div", {
27927
- 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"),
27928
- children: /*#__PURE__*/jsxs("div", {
27929
- className: "flex items-center gap-2",
27930
- children: [/*#__PURE__*/jsx(FontAwesomeIcon, {
27931
- icon: testResult.success ? "circle-check" : "circle-exclamation"
27932
- }), /*#__PURE__*/jsx("span", {
27933
- children: testResult.message
28143
+ }), /*#__PURE__*/jsxs("div", {
28144
+ className: "flex flex-row gap-2",
28145
+ children: [wizardStep === 0 && /*#__PURE__*/jsxs(Fragment, {
28146
+ children: [(selectedServer === null || selectedServer === void 0 ? void 0 : selectedServer.authCommand) && /*#__PURE__*/jsx(Button, {
28147
+ title: isAuthorizing ? "Authorizing..." : "Authorize",
28148
+ onClick: handleAuthorize,
28149
+ size: "sm"
28150
+ }), /*#__PURE__*/jsx(Button, {
28151
+ title: "Next",
28152
+ onClick: function onClick() {
28153
+ return handleWizardStepChange(1);
28154
+ },
28155
+ size: "sm"
27934
28156
  })]
27935
- })
27936
- }), (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, {
27937
- tools: testResult.tools,
27938
- selectedTools: selectedTools,
27939
- onSelectionChange: setSelectedTools
27940
- })]
27941
- }), /*#__PURE__*/jsxs("div", {
27942
- className: "flex-shrink-0 flex flex-row justify-end gap-2 px-6 py-4 border-t border-white/10",
27943
- children: [/*#__PURE__*/jsx(Button, {
27944
- title: "Cancel",
27945
- onClick: onCancel,
27946
- size: "sm"
27947
- }), (selectedServer === null || selectedServer === void 0 ? void 0 : selectedServer.authCommand) && /*#__PURE__*/jsx(Button, {
27948
- title: isAuthorizing ? "Authorizing..." : "Authorize",
27949
- onClick: handleAuthorize,
27950
- size: "sm"
27951
- }), /*#__PURE__*/jsx(Button, {
27952
- title: isTesting ? "Testing..." : "Test Connection",
27953
- onClick: handleTestConnection,
27954
- size: "sm"
27955
- }), /*#__PURE__*/jsx(Button, {
27956
- title: "Save MCP Server",
27957
- onClick: handleSaveProvider,
27958
- size: "sm"
28157
+ }), wizardStep === 1 && /*#__PURE__*/jsxs(Fragment, {
28158
+ children: [/*#__PURE__*/jsx(Button, {
28159
+ title: isTesting ? "Testing..." : "Test Connection",
28160
+ onClick: handleTestConnection,
28161
+ size: "sm"
28162
+ }), /*#__PURE__*/jsx(Button, {
28163
+ title: "Next",
28164
+ onClick: function onClick() {
28165
+ return handleWizardStepChange(2);
28166
+ },
28167
+ disabled: !(testResult !== null && testResult !== void 0 && testResult.success),
28168
+ size: "sm"
28169
+ })]
28170
+ }), wizardStep === 2 && /*#__PURE__*/jsx(Button, {
28171
+ title: "Save MCP Server",
28172
+ onClick: handleSaveProvider,
28173
+ size: "sm"
28174
+ })]
27959
28175
  })]
27960
28176
  })]
27961
28177
  });