@trops/dash-core 0.1.52 → 0.1.53
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 +617 -272
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +618 -271
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -9545,6 +9545,157 @@ function headerTemplateToRows(headerTemplate, nextRowId) {
|
|
|
9545
9545
|
});
|
|
9546
9546
|
}
|
|
9547
9547
|
|
|
9548
|
+
/**
|
|
9549
|
+
* Serialize the current form state into a standard MCP JSON config string.
|
|
9550
|
+
*
|
|
9551
|
+
* Output format:
|
|
9552
|
+
* {
|
|
9553
|
+
* "mcpServers": {
|
|
9554
|
+
* "<name>": { "command": ..., "args": [...], "env": {...} }
|
|
9555
|
+
* }
|
|
9556
|
+
* }
|
|
9557
|
+
*
|
|
9558
|
+
* @param {string} name - The provider name
|
|
9559
|
+
* @param {string} transport - "stdio" or "streamable_http"
|
|
9560
|
+
* @param {object} fields - { command, args, envMappingRows, url, headerRows, credentialData }
|
|
9561
|
+
* @returns {string} Formatted JSON string
|
|
9562
|
+
*/
|
|
9563
|
+
function formStateToMcpJson(name, transport, fields) {
|
|
9564
|
+
var _fields$command = fields.command,
|
|
9565
|
+
command = _fields$command === void 0 ? "" : _fields$command,
|
|
9566
|
+
_fields$args = fields.args,
|
|
9567
|
+
args = _fields$args === void 0 ? "" : _fields$args,
|
|
9568
|
+
_fields$envMappingRow = fields.envMappingRows,
|
|
9569
|
+
envMappingRows = _fields$envMappingRow === void 0 ? [] : _fields$envMappingRow,
|
|
9570
|
+
_fields$url = fields.url,
|
|
9571
|
+
url = _fields$url === void 0 ? "" : _fields$url,
|
|
9572
|
+
_fields$headerRows = fields.headerRows,
|
|
9573
|
+
headerRows = _fields$headerRows === void 0 ? [] : _fields$headerRows,
|
|
9574
|
+
_fields$credentialDat = fields.credentialData,
|
|
9575
|
+
credentialData = _fields$credentialDat === void 0 ? {} : _fields$credentialDat;
|
|
9576
|
+
var serverConfig;
|
|
9577
|
+
if (transport === "stdio") {
|
|
9578
|
+
var argsArray = args.trim().split(/\s+/).filter(Boolean);
|
|
9579
|
+
var env = {};
|
|
9580
|
+
envMappingRows.forEach(function (row) {
|
|
9581
|
+
var envVar = row.envVar.trim();
|
|
9582
|
+
var credField = row.credField.trim();
|
|
9583
|
+
if (envVar) {
|
|
9584
|
+
env[envVar] = credentialData[credField] || "";
|
|
9585
|
+
}
|
|
9586
|
+
});
|
|
9587
|
+
serverConfig = {
|
|
9588
|
+
command: command.trim()
|
|
9589
|
+
};
|
|
9590
|
+
if (argsArray.length > 0) serverConfig.args = argsArray;
|
|
9591
|
+
if (Object.keys(env).length > 0) serverConfig.env = env;
|
|
9592
|
+
} else {
|
|
9593
|
+
// streamable_http
|
|
9594
|
+
serverConfig = {
|
|
9595
|
+
url: url.trim()
|
|
9596
|
+
};
|
|
9597
|
+
var headers = {};
|
|
9598
|
+
headerRows.forEach(function (row) {
|
|
9599
|
+
var hName = row.headerName.trim();
|
|
9600
|
+
var hValue = row.headerValue.trim();
|
|
9601
|
+
if (hName && hValue) {
|
|
9602
|
+
headers[hName] = hValue;
|
|
9603
|
+
}
|
|
9604
|
+
});
|
|
9605
|
+
if (Object.keys(headers).length > 0) serverConfig.headers = headers;
|
|
9606
|
+
}
|
|
9607
|
+
return JSON.stringify({
|
|
9608
|
+
mcpServers: _defineProperty({}, name || "server-name", serverConfig)
|
|
9609
|
+
}, null, 2);
|
|
9610
|
+
}
|
|
9611
|
+
|
|
9612
|
+
/**
|
|
9613
|
+
* Parse a standard MCP JSON config string back into form state.
|
|
9614
|
+
*
|
|
9615
|
+
* Accepts:
|
|
9616
|
+
* - { "mcpServers": { "name": { ... } } }
|
|
9617
|
+
* - Bare server config: { "command": ..., "args": [...] }
|
|
9618
|
+
*
|
|
9619
|
+
* @param {string} jsonString - The JSON to parse
|
|
9620
|
+
* @param {Function} nextRowId - Function that returns a unique row ID
|
|
9621
|
+
* @returns {{ providerName, transport, command, args, envMappingRows, url, headerRows, credentialData, error }}
|
|
9622
|
+
*/
|
|
9623
|
+
function mcpJsonToFormState(jsonString, nextRowId) {
|
|
9624
|
+
var parsed;
|
|
9625
|
+
try {
|
|
9626
|
+
parsed = JSON.parse(jsonString);
|
|
9627
|
+
} catch (e) {
|
|
9628
|
+
return {
|
|
9629
|
+
error: "Invalid JSON: ".concat(e.message)
|
|
9630
|
+
};
|
|
9631
|
+
}
|
|
9632
|
+
var providerName = "";
|
|
9633
|
+
var serverConfig;
|
|
9634
|
+
if (parsed.mcpServers && _typeof(parsed.mcpServers) === "object") {
|
|
9635
|
+
var entries = Object.entries(parsed.mcpServers);
|
|
9636
|
+
if (entries.length === 0) {
|
|
9637
|
+
return {
|
|
9638
|
+
error: "No server found in mcpServers"
|
|
9639
|
+
};
|
|
9640
|
+
}
|
|
9641
|
+
var _entries$ = _slicedToArray(entries[0], 2);
|
|
9642
|
+
providerName = _entries$[0];
|
|
9643
|
+
serverConfig = _entries$[1];
|
|
9644
|
+
} else if (parsed.command || parsed.url) {
|
|
9645
|
+
serverConfig = parsed;
|
|
9646
|
+
} else {
|
|
9647
|
+
return {
|
|
9648
|
+
error: "Unrecognized format: expected mcpServers object or bare server config"
|
|
9649
|
+
};
|
|
9650
|
+
}
|
|
9651
|
+
var isHttp = !!serverConfig.url;
|
|
9652
|
+
var transport = isHttp ? "streamable_http" : "stdio";
|
|
9653
|
+
var result = {
|
|
9654
|
+
providerName: providerName,
|
|
9655
|
+
transport: transport,
|
|
9656
|
+
command: "",
|
|
9657
|
+
args: "",
|
|
9658
|
+
envMappingRows: [],
|
|
9659
|
+
url: "",
|
|
9660
|
+
headerRows: [],
|
|
9661
|
+
credentialData: {},
|
|
9662
|
+
error: null
|
|
9663
|
+
};
|
|
9664
|
+
if (transport === "stdio") {
|
|
9665
|
+
result.command = serverConfig.command || "";
|
|
9666
|
+
result.args = (serverConfig.args || []).join(" ");
|
|
9667
|
+
if (serverConfig.env && _typeof(serverConfig.env) === "object") {
|
|
9668
|
+
Object.entries(serverConfig.env).forEach(function (_ref5) {
|
|
9669
|
+
var _ref6 = _slicedToArray(_ref5, 2),
|
|
9670
|
+
envVar = _ref6[0],
|
|
9671
|
+
value = _ref6[1];
|
|
9672
|
+
result.envMappingRows.push({
|
|
9673
|
+
id: nextRowId(),
|
|
9674
|
+
envVar: envVar,
|
|
9675
|
+
credField: envVar
|
|
9676
|
+
});
|
|
9677
|
+
result.credentialData[envVar] = value || "";
|
|
9678
|
+
});
|
|
9679
|
+
}
|
|
9680
|
+
} else {
|
|
9681
|
+
result.url = serverConfig.url || "";
|
|
9682
|
+
var headers = serverConfig.headers || serverConfig.headerTemplate || {};
|
|
9683
|
+
if (_typeof(headers) === "object") {
|
|
9684
|
+
Object.entries(headers).forEach(function (_ref7) {
|
|
9685
|
+
var _ref8 = _slicedToArray(_ref7, 2),
|
|
9686
|
+
headerName = _ref8[0],
|
|
9687
|
+
headerValue = _ref8[1];
|
|
9688
|
+
result.headerRows.push({
|
|
9689
|
+
id: nextRowId(),
|
|
9690
|
+
headerName: headerName,
|
|
9691
|
+
headerValue: headerValue
|
|
9692
|
+
});
|
|
9693
|
+
});
|
|
9694
|
+
}
|
|
9695
|
+
}
|
|
9696
|
+
return result;
|
|
9697
|
+
}
|
|
9698
|
+
|
|
9548
9699
|
function ownKeys$p(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
9549
9700
|
function _objectSpread$p(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$p(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$p(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
9550
9701
|
var AdvancedMcpConfig = function AdvancedMcpConfig(_ref) {
|
|
@@ -26234,29 +26385,57 @@ function buildMcpConfig(transport, _ref) {
|
|
|
26234
26385
|
*
|
|
26235
26386
|
* Form for configuring a custom MCP server (not from the catalog).
|
|
26236
26387
|
* Supports stdio and streamable_http transports with dynamic field derivation.
|
|
26388
|
+
* Used for both creating new and editing existing MCP providers.
|
|
26237
26389
|
*
|
|
26238
26390
|
* @param {Function} onSave - (providerName, providerType, credentials, mcpConfig) => void
|
|
26239
|
-
* @param {Function} onBack - Called when the user wants to return
|
|
26391
|
+
* @param {Function} onBack - Called when the user wants to return
|
|
26392
|
+
* @param {boolean} isEditMode - Whether we're editing an existing provider
|
|
26393
|
+
* @param {string} initialName - Pre-populated provider name (edit mode)
|
|
26394
|
+
* @param {string} initialTransport - Pre-populated transport type (edit mode)
|
|
26395
|
+
* @param {string} initialCommand - Pre-populated command (edit mode)
|
|
26396
|
+
* @param {string} initialArgs - Pre-populated args string (edit mode)
|
|
26397
|
+
* @param {Array} initialEnvMappingRows - Pre-populated env mapping rows (edit mode)
|
|
26398
|
+
* @param {string} initialUrl - Pre-populated URL (edit mode)
|
|
26399
|
+
* @param {Array} initialHeaderRows - Pre-populated header rows (edit mode)
|
|
26400
|
+
* @param {object} initialCredentials - Pre-populated credential values (edit mode)
|
|
26240
26401
|
*/
|
|
26241
26402
|
var CustomMcpServerForm = function CustomMcpServerForm(_ref2) {
|
|
26242
26403
|
var _testResult$tools;
|
|
26243
26404
|
var onSave = _ref2.onSave,
|
|
26244
|
-
onBack = _ref2.onBack
|
|
26405
|
+
onBack = _ref2.onBack,
|
|
26406
|
+
_ref2$isEditMode = _ref2.isEditMode,
|
|
26407
|
+
isEditMode = _ref2$isEditMode === void 0 ? false : _ref2$isEditMode,
|
|
26408
|
+
_ref2$initialName = _ref2.initialName,
|
|
26409
|
+
initialName = _ref2$initialName === void 0 ? "" : _ref2$initialName,
|
|
26410
|
+
_ref2$initialTranspor = _ref2.initialTransport,
|
|
26411
|
+
initialTransport = _ref2$initialTranspor === void 0 ? "stdio" : _ref2$initialTranspor,
|
|
26412
|
+
_ref2$initialCommand = _ref2.initialCommand,
|
|
26413
|
+
initialCommand = _ref2$initialCommand === void 0 ? "" : _ref2$initialCommand,
|
|
26414
|
+
_ref2$initialArgs = _ref2.initialArgs,
|
|
26415
|
+
initialArgs = _ref2$initialArgs === void 0 ? "" : _ref2$initialArgs,
|
|
26416
|
+
_ref2$initialEnvMappi = _ref2.initialEnvMappingRows,
|
|
26417
|
+
initialEnvMappingRows = _ref2$initialEnvMappi === void 0 ? [] : _ref2$initialEnvMappi,
|
|
26418
|
+
_ref2$initialUrl = _ref2.initialUrl,
|
|
26419
|
+
initialUrl = _ref2$initialUrl === void 0 ? "" : _ref2$initialUrl,
|
|
26420
|
+
_ref2$initialHeaderRo = _ref2.initialHeaderRows,
|
|
26421
|
+
initialHeaderRows = _ref2$initialHeaderRo === void 0 ? [] : _ref2$initialHeaderRo,
|
|
26422
|
+
_ref2$initialCredenti = _ref2.initialCredentials,
|
|
26423
|
+
initialCredentials = _ref2$initialCredenti === void 0 ? {} : _ref2$initialCredenti;
|
|
26245
26424
|
var appContext = React.useContext(AppContext);
|
|
26246
26425
|
var dashApi = appContext === null || appContext === void 0 ? void 0 : appContext.dashApi;
|
|
26247
26426
|
|
|
26248
26427
|
// Transport selection
|
|
26249
|
-
var _useState = React.useState(
|
|
26428
|
+
var _useState = React.useState(initialTransport),
|
|
26250
26429
|
_useState2 = _slicedToArray(_useState, 2),
|
|
26251
26430
|
transport = _useState2[0],
|
|
26252
26431
|
setTransport = _useState2[1];
|
|
26253
26432
|
|
|
26254
26433
|
// Common
|
|
26255
|
-
var _useState3 = React.useState(
|
|
26434
|
+
var _useState3 = React.useState(initialName),
|
|
26256
26435
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
26257
26436
|
providerName = _useState4[0],
|
|
26258
26437
|
setProviderName = _useState4[1];
|
|
26259
|
-
var _useState5 = React.useState(
|
|
26438
|
+
var _useState5 = React.useState(initialCredentials),
|
|
26260
26439
|
_useState6 = _slicedToArray(_useState5, 2),
|
|
26261
26440
|
credentialData = _useState6[0],
|
|
26262
26441
|
setCredentialData = _useState6[1];
|
|
@@ -26274,34 +26453,51 @@ var CustomMcpServerForm = function CustomMcpServerForm(_ref2) {
|
|
|
26274
26453
|
setTestResult = _useState10[1];
|
|
26275
26454
|
|
|
26276
26455
|
// stdio fields
|
|
26277
|
-
var _useState11 = React.useState(
|
|
26456
|
+
var _useState11 = React.useState(initialCommand),
|
|
26278
26457
|
_useState12 = _slicedToArray(_useState11, 2),
|
|
26279
26458
|
command = _useState12[0],
|
|
26280
26459
|
setCommand = _useState12[1];
|
|
26281
|
-
var _useState13 = React.useState(
|
|
26460
|
+
var _useState13 = React.useState(initialArgs),
|
|
26282
26461
|
_useState14 = _slicedToArray(_useState13, 2),
|
|
26283
26462
|
args = _useState14[0],
|
|
26284
26463
|
setArgs = _useState14[1];
|
|
26285
|
-
var _useState15 = React.useState(
|
|
26464
|
+
var _useState15 = React.useState(initialEnvMappingRows),
|
|
26286
26465
|
_useState16 = _slicedToArray(_useState15, 2),
|
|
26287
26466
|
envMappingRows = _useState16[0],
|
|
26288
26467
|
setEnvMappingRows = _useState16[1];
|
|
26289
26468
|
|
|
26290
26469
|
// HTTP fields
|
|
26291
|
-
var _useState17 = React.useState(
|
|
26470
|
+
var _useState17 = React.useState(initialUrl),
|
|
26292
26471
|
_useState18 = _slicedToArray(_useState17, 2),
|
|
26293
26472
|
url = _useState18[0],
|
|
26294
26473
|
setUrl = _useState18[1];
|
|
26295
|
-
var _useState19 = React.useState(
|
|
26474
|
+
var _useState19 = React.useState(initialHeaderRows),
|
|
26296
26475
|
_useState20 = _slicedToArray(_useState19, 2),
|
|
26297
26476
|
headerRows = _useState20[0],
|
|
26298
26477
|
setHeaderRows = _useState20[1];
|
|
26299
26478
|
|
|
26479
|
+
// JSON editor state
|
|
26480
|
+
var _useState21 = React.useState("form"),
|
|
26481
|
+
_useState22 = _slicedToArray(_useState21, 2),
|
|
26482
|
+
viewMode = _useState22[0],
|
|
26483
|
+
setViewMode = _useState22[1]; // "form" | "json"
|
|
26484
|
+
var _useState23 = React.useState(""),
|
|
26485
|
+
_useState24 = _slicedToArray(_useState23, 2),
|
|
26486
|
+
jsonText = _useState24[0],
|
|
26487
|
+
setJsonText = _useState24[1];
|
|
26488
|
+
var _useState25 = React.useState(null),
|
|
26489
|
+
_useState26 = _slicedToArray(_useState25, 2),
|
|
26490
|
+
jsonError = _useState26[0],
|
|
26491
|
+
setJsonError = _useState26[1];
|
|
26492
|
+
|
|
26300
26493
|
// Clear credential data when transport changes (derived fields change entirely)
|
|
26494
|
+
// Only in create mode — in edit mode the initial transport is set correctly
|
|
26301
26495
|
React.useEffect(function () {
|
|
26302
|
-
|
|
26303
|
-
|
|
26304
|
-
|
|
26496
|
+
if (!isEditMode) {
|
|
26497
|
+
setCredentialData({});
|
|
26498
|
+
setTestResult(null);
|
|
26499
|
+
}
|
|
26500
|
+
}, [transport, isEditMode]);
|
|
26305
26501
|
|
|
26306
26502
|
// Build mcpConfig from current state
|
|
26307
26503
|
var mcpConfig = React.useMemo(function () {
|
|
@@ -26383,6 +26579,38 @@ var CustomMcpServerForm = function CustomMcpServerForm(_ref2) {
|
|
|
26383
26579
|
}
|
|
26384
26580
|
};
|
|
26385
26581
|
|
|
26582
|
+
// --- JSON toggle handlers ---
|
|
26583
|
+
var handleSwitchToJson = function handleSwitchToJson() {
|
|
26584
|
+
var json = formStateToMcpJson(providerName, transport, {
|
|
26585
|
+
command: command,
|
|
26586
|
+
args: args,
|
|
26587
|
+
envMappingRows: envMappingRows,
|
|
26588
|
+
url: url,
|
|
26589
|
+
headerRows: headerRows,
|
|
26590
|
+
credentialData: credentialData
|
|
26591
|
+
});
|
|
26592
|
+
setJsonText(json);
|
|
26593
|
+
setJsonError(null);
|
|
26594
|
+
setViewMode("json");
|
|
26595
|
+
};
|
|
26596
|
+
var handleSwitchToForm = function handleSwitchToForm() {
|
|
26597
|
+
var result = mcpJsonToFormState(jsonText, nextRowId);
|
|
26598
|
+
if (result.error) {
|
|
26599
|
+
setJsonError(result.error);
|
|
26600
|
+
return;
|
|
26601
|
+
}
|
|
26602
|
+
setProviderName(result.providerName || providerName);
|
|
26603
|
+
setTransport(result.transport);
|
|
26604
|
+
setCommand(result.command);
|
|
26605
|
+
setArgs(result.args);
|
|
26606
|
+
setEnvMappingRows(result.envMappingRows);
|
|
26607
|
+
setUrl(result.url);
|
|
26608
|
+
setHeaderRows(result.headerRows);
|
|
26609
|
+
setCredentialData(result.credentialData);
|
|
26610
|
+
setJsonError(null);
|
|
26611
|
+
setViewMode("form");
|
|
26612
|
+
};
|
|
26613
|
+
|
|
26386
26614
|
// --- validation ---
|
|
26387
26615
|
var validateForm = function validateForm() {
|
|
26388
26616
|
var errors = {};
|
|
@@ -26442,6 +26670,28 @@ var CustomMcpServerForm = function CustomMcpServerForm(_ref2) {
|
|
|
26442
26670
|
|
|
26443
26671
|
// --- save ---
|
|
26444
26672
|
var handleSave = function handleSave() {
|
|
26673
|
+
// If in JSON mode, parse JSON first to update form state
|
|
26674
|
+
if (viewMode === "json") {
|
|
26675
|
+
var result = mcpJsonToFormState(jsonText, nextRowId);
|
|
26676
|
+
if (result.error) {
|
|
26677
|
+
setJsonError(result.error);
|
|
26678
|
+
return;
|
|
26679
|
+
}
|
|
26680
|
+
var name = (result.providerName || providerName || "").trim();
|
|
26681
|
+
if (!name) {
|
|
26682
|
+
setJsonError("Provider name is required");
|
|
26683
|
+
return;
|
|
26684
|
+
}
|
|
26685
|
+
var config = buildMcpConfig(result.transport, {
|
|
26686
|
+
command: result.command,
|
|
26687
|
+
args: result.args,
|
|
26688
|
+
envMappingRows: result.envMappingRows,
|
|
26689
|
+
url: result.url,
|
|
26690
|
+
headerRows: result.headerRows
|
|
26691
|
+
});
|
|
26692
|
+
onSave(name, "custom", result.credentialData, config);
|
|
26693
|
+
return;
|
|
26694
|
+
}
|
|
26445
26695
|
if (!validateForm()) return;
|
|
26446
26696
|
onSave(providerName.trim(), "custom", credentialData, mcpConfig);
|
|
26447
26697
|
};
|
|
@@ -26460,58 +26710,11 @@ var CustomMcpServerForm = function CustomMcpServerForm(_ref2) {
|
|
|
26460
26710
|
})
|
|
26461
26711
|
}), /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
26462
26712
|
children: [/*#__PURE__*/jsxRuntime.jsx(DashReact.SubHeading3, {
|
|
26463
|
-
title: "Configure Custom MCP Server",
|
|
26713
|
+
title: isEditMode ? "Edit MCP Server" : "Configure Custom MCP Server",
|
|
26464
26714
|
padding: false
|
|
26465
26715
|
}), /*#__PURE__*/jsxRuntime.jsx("p", {
|
|
26466
26716
|
className: "text-sm opacity-50 mt-1",
|
|
26467
|
-
children: "Define a custom MCP server connection"
|
|
26468
|
-
})]
|
|
26469
|
-
})]
|
|
26470
|
-
}), /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
26471
|
-
className: "space-y-2",
|
|
26472
|
-
children: [/*#__PURE__*/jsxRuntime.jsx("p", {
|
|
26473
|
-
className: "text-xs font-semibold opacity-40 uppercase tracking-wider",
|
|
26474
|
-
children: "Transport Type"
|
|
26475
|
-
}), /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
26476
|
-
className: "grid grid-cols-2 gap-3",
|
|
26477
|
-
children: [/*#__PURE__*/jsxRuntime.jsxs(DashReact.Card2, {
|
|
26478
|
-
hover: true,
|
|
26479
|
-
selected: transport === "stdio",
|
|
26480
|
-
onClick: function onClick() {
|
|
26481
|
-
return setTransport("stdio");
|
|
26482
|
-
},
|
|
26483
|
-
className: "text-left",
|
|
26484
|
-
children: [/*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
26485
|
-
className: "flex items-center gap-2 mb-1",
|
|
26486
|
-
children: [/*#__PURE__*/jsxRuntime.jsx(DashReact.Icon2, {
|
|
26487
|
-
icon: "terminal"
|
|
26488
|
-
}), /*#__PURE__*/jsxRuntime.jsx("span", {
|
|
26489
|
-
className: "font-semibold text-sm",
|
|
26490
|
-
children: "Local Process (stdio)"
|
|
26491
|
-
})]
|
|
26492
|
-
}), /*#__PURE__*/jsxRuntime.jsx("p", {
|
|
26493
|
-
className: "text-xs opacity-50",
|
|
26494
|
-
children: "Spawn a local command as a child process"
|
|
26495
|
-
})]
|
|
26496
|
-
}), /*#__PURE__*/jsxRuntime.jsxs(DashReact.Card2, {
|
|
26497
|
-
hover: true,
|
|
26498
|
-
selected: transport === "streamable_http",
|
|
26499
|
-
onClick: function onClick() {
|
|
26500
|
-
return setTransport("streamable_http");
|
|
26501
|
-
},
|
|
26502
|
-
className: "text-left",
|
|
26503
|
-
children: [/*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
26504
|
-
className: "flex items-center gap-2 mb-1",
|
|
26505
|
-
children: [/*#__PURE__*/jsxRuntime.jsx(DashReact.Icon2, {
|
|
26506
|
-
icon: "globe"
|
|
26507
|
-
}), /*#__PURE__*/jsxRuntime.jsx("span", {
|
|
26508
|
-
className: "font-semibold text-sm",
|
|
26509
|
-
children: "Remote Server (HTTP)"
|
|
26510
|
-
})]
|
|
26511
|
-
}), /*#__PURE__*/jsxRuntime.jsx("p", {
|
|
26512
|
-
className: "text-xs opacity-50",
|
|
26513
|
-
children: "Connect to a remote MCP server via HTTP"
|
|
26514
|
-
})]
|
|
26717
|
+
children: isEditMode ? "Modify this MCP server configuration" : "Define a custom MCP server connection"
|
|
26515
26718
|
})]
|
|
26516
26719
|
})]
|
|
26517
26720
|
}), /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
@@ -26539,231 +26742,315 @@ var CustomMcpServerForm = function CustomMcpServerForm(_ref2) {
|
|
|
26539
26742
|
className: "text-sm text-red-400",
|
|
26540
26743
|
children: formErrors.providerName
|
|
26541
26744
|
})]
|
|
26542
|
-
}),
|
|
26543
|
-
className: "
|
|
26544
|
-
children: [/*#__PURE__*/jsxRuntime.jsx("
|
|
26545
|
-
|
|
26546
|
-
|
|
26745
|
+
}), /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
26746
|
+
className: "flex items-center gap-1",
|
|
26747
|
+
children: [/*#__PURE__*/jsxRuntime.jsx("button", {
|
|
26748
|
+
onClick: function onClick() {
|
|
26749
|
+
if (viewMode === "json") handleSwitchToForm();
|
|
26750
|
+
},
|
|
26751
|
+
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"),
|
|
26752
|
+
children: "Form"
|
|
26753
|
+
}), /*#__PURE__*/jsxRuntime.jsx("button", {
|
|
26754
|
+
onClick: function onClick() {
|
|
26755
|
+
if (viewMode === "form") handleSwitchToJson();
|
|
26756
|
+
},
|
|
26757
|
+
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"),
|
|
26758
|
+
children: "JSON"
|
|
26759
|
+
})]
|
|
26760
|
+
}), jsonError && /*#__PURE__*/jsxRuntime.jsx("p", {
|
|
26761
|
+
className: "text-sm text-red-400",
|
|
26762
|
+
children: jsonError
|
|
26763
|
+
}), viewMode === "json" && /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
26764
|
+
className: "space-y-2",
|
|
26765
|
+
children: [/*#__PURE__*/jsxRuntime.jsx("p", {
|
|
26766
|
+
className: "text-xs font-semibold opacity-40 uppercase tracking-wider",
|
|
26767
|
+
children: "MCP Server Configuration (JSON)"
|
|
26768
|
+
}), /*#__PURE__*/jsxRuntime.jsx("p", {
|
|
26769
|
+
className: "text-sm opacity-50",
|
|
26770
|
+
children: "Paste a standard MCP config JSON (compatible with Claude Desktop, Cursor, etc.)"
|
|
26771
|
+
}), /*#__PURE__*/jsxRuntime.jsx(DashReact.CodeEditorInline, {
|
|
26772
|
+
code: jsonText,
|
|
26773
|
+
setCode: function setCode(val) {
|
|
26774
|
+
setJsonText(val);
|
|
26775
|
+
setJsonError(null);
|
|
26776
|
+
},
|
|
26777
|
+
language: "json",
|
|
26778
|
+
placeholder: '{\n "mcpServers": {\n "server-name": {\n "command": "npx",\n "args": ["-y", "package-name"],\n "env": {\n "API_KEY": "your-key"\n }\n }\n }\n}'
|
|
26779
|
+
})]
|
|
26780
|
+
}), viewMode === "form" && /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
26781
|
+
children: [/*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
26782
|
+
className: "space-y-2",
|
|
26783
|
+
children: [/*#__PURE__*/jsxRuntime.jsx("p", {
|
|
26547
26784
|
className: "text-xs font-semibold opacity-40 uppercase tracking-wider",
|
|
26548
|
-
children: "
|
|
26549
|
-
})
|
|
26550
|
-
|
|
26551
|
-
|
|
26552
|
-
|
|
26553
|
-
|
|
26554
|
-
|
|
26555
|
-
|
|
26556
|
-
|
|
26557
|
-
|
|
26558
|
-
|
|
26559
|
-
|
|
26560
|
-
|
|
26561
|
-
|
|
26562
|
-
|
|
26563
|
-
|
|
26564
|
-
|
|
26565
|
-
|
|
26566
|
-
return next;
|
|
26567
|
-
});
|
|
26568
|
-
}
|
|
26569
|
-
},
|
|
26570
|
-
placeholder: "e.g., npx"
|
|
26571
|
-
}), formErrors.command && /*#__PURE__*/jsxRuntime.jsx("p", {
|
|
26572
|
-
className: "text-sm text-red-400",
|
|
26573
|
-
children: formErrors.command
|
|
26574
|
-
})]
|
|
26575
|
-
}), /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
26576
|
-
className: "flex flex-col gap-2",
|
|
26577
|
-
children: [/*#__PURE__*/jsxRuntime.jsx(DashReact.FormLabel, {
|
|
26578
|
-
label: "Arguments"
|
|
26579
|
-
}), /*#__PURE__*/jsxRuntime.jsx("p", {
|
|
26580
|
-
className: "text-sm opacity-50",
|
|
26581
|
-
children: "Space-separated arguments passed to the command"
|
|
26582
|
-
}), /*#__PURE__*/jsxRuntime.jsx(DashReact.InputText, {
|
|
26583
|
-
value: args,
|
|
26584
|
-
onChange: setArgs,
|
|
26585
|
-
placeholder: "e.g., -y @modelcontextprotocol/server-github"
|
|
26586
|
-
})]
|
|
26587
|
-
}), /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
26588
|
-
className: "space-y-3",
|
|
26589
|
-
children: [/*#__PURE__*/jsxRuntime.jsx("div", {
|
|
26590
|
-
className: "flex items-center justify-between",
|
|
26591
|
-
children: /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
26592
|
-
children: [/*#__PURE__*/jsxRuntime.jsx(DashReact.FormLabel, {
|
|
26593
|
-
label: "Environment Variable Mapping"
|
|
26785
|
+
children: "Transport Type"
|
|
26786
|
+
}), /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
26787
|
+
className: "grid grid-cols-2 gap-3",
|
|
26788
|
+
children: [/*#__PURE__*/jsxRuntime.jsxs(DashReact.Card2, {
|
|
26789
|
+
hover: true,
|
|
26790
|
+
selected: transport === "stdio",
|
|
26791
|
+
onClick: function onClick() {
|
|
26792
|
+
return setTransport("stdio");
|
|
26793
|
+
},
|
|
26794
|
+
className: "text-left",
|
|
26795
|
+
children: [/*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
26796
|
+
className: "flex items-center gap-2 mb-1",
|
|
26797
|
+
children: [/*#__PURE__*/jsxRuntime.jsx(DashReact.Icon2, {
|
|
26798
|
+
icon: "terminal"
|
|
26799
|
+
}), /*#__PURE__*/jsxRuntime.jsx("span", {
|
|
26800
|
+
className: "font-semibold text-sm",
|
|
26801
|
+
children: "Local Process (stdio)"
|
|
26802
|
+
})]
|
|
26594
26803
|
}), /*#__PURE__*/jsxRuntime.jsx("p", {
|
|
26595
|
-
className: "text-
|
|
26596
|
-
children: "
|
|
26804
|
+
className: "text-xs opacity-50",
|
|
26805
|
+
children: "Spawn a local command as a child process"
|
|
26597
26806
|
})]
|
|
26807
|
+
}), /*#__PURE__*/jsxRuntime.jsxs(DashReact.Card2, {
|
|
26808
|
+
hover: true,
|
|
26809
|
+
selected: transport === "streamable_http",
|
|
26810
|
+
onClick: function onClick() {
|
|
26811
|
+
return setTransport("streamable_http");
|
|
26812
|
+
},
|
|
26813
|
+
className: "text-left",
|
|
26814
|
+
children: [/*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
26815
|
+
className: "flex items-center gap-2 mb-1",
|
|
26816
|
+
children: [/*#__PURE__*/jsxRuntime.jsx(DashReact.Icon2, {
|
|
26817
|
+
icon: "globe"
|
|
26818
|
+
}), /*#__PURE__*/jsxRuntime.jsx("span", {
|
|
26819
|
+
className: "font-semibold text-sm",
|
|
26820
|
+
children: "Remote Server (HTTP)"
|
|
26821
|
+
})]
|
|
26822
|
+
}), /*#__PURE__*/jsxRuntime.jsx("p", {
|
|
26823
|
+
className: "text-xs opacity-50",
|
|
26824
|
+
children: "Connect to a remote MCP server via HTTP"
|
|
26825
|
+
})]
|
|
26826
|
+
})]
|
|
26827
|
+
})]
|
|
26828
|
+
}), transport === "stdio" && /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
26829
|
+
className: "space-y-4",
|
|
26830
|
+
children: [/*#__PURE__*/jsxRuntime.jsx("div", {
|
|
26831
|
+
className: "border-t border-white/10 pt-4",
|
|
26832
|
+
children: /*#__PURE__*/jsxRuntime.jsx("p", {
|
|
26833
|
+
className: "text-xs font-semibold opacity-40 uppercase tracking-wider",
|
|
26834
|
+
children: "Process Configuration"
|
|
26598
26835
|
})
|
|
26599
|
-
}),
|
|
26600
|
-
|
|
26601
|
-
|
|
26602
|
-
|
|
26603
|
-
|
|
26604
|
-
|
|
26605
|
-
|
|
26606
|
-
|
|
26607
|
-
|
|
26836
|
+
}), /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
26837
|
+
className: "flex flex-col gap-2",
|
|
26838
|
+
children: [/*#__PURE__*/jsxRuntime.jsx(DashReact.FormLabel, {
|
|
26839
|
+
label: "Command",
|
|
26840
|
+
required: true
|
|
26841
|
+
}), /*#__PURE__*/jsxRuntime.jsx("p", {
|
|
26842
|
+
className: "text-sm opacity-50",
|
|
26843
|
+
children: "The executable to run (e.g., npx, node, python)"
|
|
26844
|
+
}), /*#__PURE__*/jsxRuntime.jsx(DashReact.InputText, {
|
|
26845
|
+
value: command,
|
|
26846
|
+
onChange: function onChange(value) {
|
|
26847
|
+
setCommand(value);
|
|
26848
|
+
if (formErrors.command && value !== null && value !== void 0 && value.trim()) {
|
|
26849
|
+
setFormErrors(function (prev) {
|
|
26850
|
+
var next = _objectSpread$5({}, prev);
|
|
26851
|
+
delete next.command;
|
|
26852
|
+
return next;
|
|
26853
|
+
});
|
|
26854
|
+
}
|
|
26855
|
+
},
|
|
26856
|
+
placeholder: "e.g., npx"
|
|
26857
|
+
}), formErrors.command && /*#__PURE__*/jsxRuntime.jsx("p", {
|
|
26858
|
+
className: "text-sm text-red-400",
|
|
26859
|
+
children: formErrors.command
|
|
26860
|
+
})]
|
|
26861
|
+
}), /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
26862
|
+
className: "flex flex-col gap-2",
|
|
26863
|
+
children: [/*#__PURE__*/jsxRuntime.jsx(DashReact.FormLabel, {
|
|
26864
|
+
label: "Arguments"
|
|
26865
|
+
}), /*#__PURE__*/jsxRuntime.jsx("p", {
|
|
26866
|
+
className: "text-sm opacity-50",
|
|
26867
|
+
children: "Space-separated arguments passed to the command"
|
|
26868
|
+
}), /*#__PURE__*/jsxRuntime.jsx(DashReact.InputText, {
|
|
26869
|
+
value: args,
|
|
26870
|
+
onChange: setArgs,
|
|
26871
|
+
placeholder: "e.g., -y @modelcontextprotocol/server-github"
|
|
26872
|
+
})]
|
|
26873
|
+
}), /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
26874
|
+
className: "space-y-3",
|
|
26875
|
+
children: [/*#__PURE__*/jsxRuntime.jsx("div", {
|
|
26876
|
+
className: "flex items-center justify-between",
|
|
26877
|
+
children: /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
26878
|
+
children: [/*#__PURE__*/jsxRuntime.jsx(DashReact.FormLabel, {
|
|
26879
|
+
label: "Environment Variable Mapping"
|
|
26880
|
+
}), /*#__PURE__*/jsxRuntime.jsx("p", {
|
|
26881
|
+
className: "text-sm opacity-50 mt-1",
|
|
26882
|
+
children: "Map environment variables to credential fields"
|
|
26883
|
+
})]
|
|
26884
|
+
})
|
|
26885
|
+
}), envMappingRows.map(function (row) {
|
|
26886
|
+
return /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
26887
|
+
className: "flex items-center gap-2",
|
|
26888
|
+
children: [/*#__PURE__*/jsxRuntime.jsx("div", {
|
|
26889
|
+
className: "flex-1",
|
|
26890
|
+
children: /*#__PURE__*/jsxRuntime.jsx(DashReact.InputText, {
|
|
26891
|
+
value: row.envVar,
|
|
26892
|
+
onChange: function onChange(value) {
|
|
26893
|
+
return updateEnvRow(row.id, "envVar", value);
|
|
26894
|
+
},
|
|
26895
|
+
placeholder: "ENV_VAR_NAME"
|
|
26896
|
+
})
|
|
26897
|
+
}), /*#__PURE__*/jsxRuntime.jsx("span", {
|
|
26898
|
+
className: "opacity-30 text-sm shrink-0",
|
|
26899
|
+
children: "\u2192"
|
|
26900
|
+
}), /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
26901
|
+
className: "flex-1",
|
|
26902
|
+
children: /*#__PURE__*/jsxRuntime.jsx(DashReact.InputText, {
|
|
26903
|
+
value: row.credField,
|
|
26904
|
+
onChange: function onChange(value) {
|
|
26905
|
+
return updateEnvRow(row.id, "credField", value);
|
|
26906
|
+
},
|
|
26907
|
+
placeholder: "credentialField"
|
|
26908
|
+
})
|
|
26909
|
+
}), /*#__PURE__*/jsxRuntime.jsx("button", {
|
|
26910
|
+
onClick: function onClick() {
|
|
26911
|
+
return removeEnvRow(row.id);
|
|
26608
26912
|
},
|
|
26609
|
-
|
|
26610
|
-
|
|
26913
|
+
className: "text-gray-500 hover:text-red-400 transition-colors shrink-0",
|
|
26914
|
+
children: /*#__PURE__*/jsxRuntime.jsx(DashReact.FontAwesomeIcon, {
|
|
26915
|
+
icon: "times",
|
|
26916
|
+
className: "text-sm"
|
|
26917
|
+
})
|
|
26918
|
+
})]
|
|
26919
|
+
}, row.id);
|
|
26920
|
+
}), /*#__PURE__*/jsxRuntime.jsxs("button", {
|
|
26921
|
+
onClick: addEnvRow,
|
|
26922
|
+
className: "text-sm text-blue-400 hover:text-blue-300 transition-colors flex items-center gap-1",
|
|
26923
|
+
children: [/*#__PURE__*/jsxRuntime.jsx(DashReact.FontAwesomeIcon, {
|
|
26924
|
+
icon: "plus",
|
|
26925
|
+
className: "text-xs"
|
|
26611
26926
|
}), /*#__PURE__*/jsxRuntime.jsx("span", {
|
|
26612
|
-
|
|
26613
|
-
children: "\u2192"
|
|
26614
|
-
}), /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
26615
|
-
className: "flex-1",
|
|
26616
|
-
children: /*#__PURE__*/jsxRuntime.jsx(DashReact.InputText, {
|
|
26617
|
-
value: row.credField,
|
|
26618
|
-
onChange: function onChange(value) {
|
|
26619
|
-
return updateEnvRow(row.id, "credField", value);
|
|
26620
|
-
},
|
|
26621
|
-
placeholder: "credentialField"
|
|
26622
|
-
})
|
|
26623
|
-
}), /*#__PURE__*/jsxRuntime.jsx("button", {
|
|
26624
|
-
onClick: function onClick() {
|
|
26625
|
-
return removeEnvRow(row.id);
|
|
26626
|
-
},
|
|
26627
|
-
className: "text-gray-500 hover:text-red-400 transition-colors shrink-0",
|
|
26628
|
-
children: /*#__PURE__*/jsxRuntime.jsx(DashReact.FontAwesomeIcon, {
|
|
26629
|
-
icon: "times",
|
|
26630
|
-
className: "text-sm"
|
|
26631
|
-
})
|
|
26927
|
+
children: "Add Environment Variable"
|
|
26632
26928
|
})]
|
|
26633
|
-
}, row.id);
|
|
26634
|
-
}), /*#__PURE__*/jsxRuntime.jsxs("button", {
|
|
26635
|
-
onClick: addEnvRow,
|
|
26636
|
-
className: "text-sm text-blue-400 hover:text-blue-300 transition-colors flex items-center gap-1",
|
|
26637
|
-
children: [/*#__PURE__*/jsxRuntime.jsx(DashReact.FontAwesomeIcon, {
|
|
26638
|
-
icon: "plus",
|
|
26639
|
-
className: "text-xs"
|
|
26640
|
-
}), /*#__PURE__*/jsxRuntime.jsx("span", {
|
|
26641
|
-
children: "Add Environment Variable"
|
|
26642
26929
|
})]
|
|
26643
26930
|
})]
|
|
26644
|
-
})
|
|
26645
|
-
|
|
26646
|
-
|
|
26647
|
-
|
|
26648
|
-
|
|
26649
|
-
|
|
26650
|
-
|
|
26651
|
-
|
|
26652
|
-
})
|
|
26653
|
-
|
|
26654
|
-
className: "flex flex-col gap-2",
|
|
26655
|
-
children: [/*#__PURE__*/jsxRuntime.jsx(DashReact.FormLabel, {
|
|
26656
|
-
label: "Server URL",
|
|
26657
|
-
required: true
|
|
26658
|
-
}), /*#__PURE__*/jsxRuntime.jsxs("p", {
|
|
26659
|
-
className: "text-sm opacity-50",
|
|
26660
|
-
children: ["Use", " ", /*#__PURE__*/jsxRuntime.jsx("code", {
|
|
26661
|
-
className: "text-xs bg-white/10 px-1 py-0.5 rounded",
|
|
26662
|
-
children: "{{fieldName}}"
|
|
26663
|
-
}), " ", "for values provided as credentials"]
|
|
26664
|
-
}), /*#__PURE__*/jsxRuntime.jsx(DashReact.InputText, {
|
|
26665
|
-
value: url,
|
|
26666
|
-
onChange: function onChange(value) {
|
|
26667
|
-
setUrl(value);
|
|
26668
|
-
if (formErrors.url && value !== null && value !== void 0 && value.trim()) {
|
|
26669
|
-
setFormErrors(function (prev) {
|
|
26670
|
-
var next = _objectSpread$5({}, prev);
|
|
26671
|
-
delete next.url;
|
|
26672
|
-
return next;
|
|
26673
|
-
});
|
|
26674
|
-
}
|
|
26675
|
-
},
|
|
26676
|
-
placeholder: "e.g., https://mcp.example.com/sse"
|
|
26677
|
-
}), formErrors.url && /*#__PURE__*/jsxRuntime.jsx("p", {
|
|
26678
|
-
className: "text-sm text-red-400",
|
|
26679
|
-
children: formErrors.url
|
|
26680
|
-
})]
|
|
26681
|
-
}), /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
26682
|
-
className: "space-y-3",
|
|
26683
|
-
children: [/*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
26931
|
+
}), transport === "streamable_http" && /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
26932
|
+
className: "space-y-4",
|
|
26933
|
+
children: [/*#__PURE__*/jsxRuntime.jsx("div", {
|
|
26934
|
+
className: "border-t border-white/10 pt-4",
|
|
26935
|
+
children: /*#__PURE__*/jsxRuntime.jsx("p", {
|
|
26936
|
+
className: "text-xs font-semibold opacity-40 uppercase tracking-wider",
|
|
26937
|
+
children: "Server Configuration"
|
|
26938
|
+
})
|
|
26939
|
+
}), /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
26940
|
+
className: "flex flex-col gap-2",
|
|
26684
26941
|
children: [/*#__PURE__*/jsxRuntime.jsx(DashReact.FormLabel, {
|
|
26685
|
-
label: "
|
|
26942
|
+
label: "Server URL",
|
|
26943
|
+
required: true
|
|
26686
26944
|
}), /*#__PURE__*/jsxRuntime.jsxs("p", {
|
|
26687
|
-
className: "text-sm opacity-50
|
|
26945
|
+
className: "text-sm opacity-50",
|
|
26688
26946
|
children: ["Use", " ", /*#__PURE__*/jsxRuntime.jsx("code", {
|
|
26689
26947
|
className: "text-xs bg-white/10 px-1 py-0.5 rounded",
|
|
26690
26948
|
children: "{{fieldName}}"
|
|
26691
|
-
}), " ", "
|
|
26949
|
+
}), " ", "for values provided as credentials"]
|
|
26950
|
+
}), /*#__PURE__*/jsxRuntime.jsx(DashReact.InputText, {
|
|
26951
|
+
value: url,
|
|
26952
|
+
onChange: function onChange(value) {
|
|
26953
|
+
setUrl(value);
|
|
26954
|
+
if (formErrors.url && value !== null && value !== void 0 && value.trim()) {
|
|
26955
|
+
setFormErrors(function (prev) {
|
|
26956
|
+
var next = _objectSpread$5({}, prev);
|
|
26957
|
+
delete next.url;
|
|
26958
|
+
return next;
|
|
26959
|
+
});
|
|
26960
|
+
}
|
|
26961
|
+
},
|
|
26962
|
+
placeholder: "e.g., https://mcp.example.com/sse"
|
|
26963
|
+
}), formErrors.url && /*#__PURE__*/jsxRuntime.jsx("p", {
|
|
26964
|
+
className: "text-sm text-red-400",
|
|
26965
|
+
children: formErrors.url
|
|
26692
26966
|
})]
|
|
26693
|
-
}),
|
|
26694
|
-
|
|
26695
|
-
|
|
26696
|
-
children: [/*#__PURE__*/jsxRuntime.jsx(
|
|
26697
|
-
|
|
26698
|
-
|
|
26699
|
-
|
|
26700
|
-
|
|
26701
|
-
|
|
26967
|
+
}), /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
26968
|
+
className: "space-y-3",
|
|
26969
|
+
children: [/*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
26970
|
+
children: [/*#__PURE__*/jsxRuntime.jsx(DashReact.FormLabel, {
|
|
26971
|
+
label: "Request Headers"
|
|
26972
|
+
}), /*#__PURE__*/jsxRuntime.jsxs("p", {
|
|
26973
|
+
className: "text-sm opacity-50 mt-1",
|
|
26974
|
+
children: ["Use", " ", /*#__PURE__*/jsxRuntime.jsx("code", {
|
|
26975
|
+
className: "text-xs bg-white/10 px-1 py-0.5 rounded",
|
|
26976
|
+
children: "{{fieldName}}"
|
|
26977
|
+
}), " ", "in values for credential placeholders"]
|
|
26978
|
+
})]
|
|
26979
|
+
}), headerRows.map(function (row) {
|
|
26980
|
+
return /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
26981
|
+
className: "flex items-center gap-2",
|
|
26982
|
+
children: [/*#__PURE__*/jsxRuntime.jsx("div", {
|
|
26983
|
+
className: "flex-1",
|
|
26984
|
+
children: /*#__PURE__*/jsxRuntime.jsx(DashReact.InputText, {
|
|
26985
|
+
value: row.headerName,
|
|
26986
|
+
onChange: function onChange(value) {
|
|
26987
|
+
return updateHeaderRow(row.id, "headerName", value);
|
|
26988
|
+
},
|
|
26989
|
+
placeholder: "Header-Name"
|
|
26990
|
+
})
|
|
26991
|
+
}), /*#__PURE__*/jsxRuntime.jsx("span", {
|
|
26992
|
+
className: "opacity-30 text-sm shrink-0",
|
|
26993
|
+
children: ":"
|
|
26994
|
+
}), /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
26995
|
+
className: "flex-1",
|
|
26996
|
+
children: /*#__PURE__*/jsxRuntime.jsx(DashReact.InputText, {
|
|
26997
|
+
value: row.headerValue,
|
|
26998
|
+
onChange: function onChange(value) {
|
|
26999
|
+
return updateHeaderRow(row.id, "headerValue", value);
|
|
27000
|
+
},
|
|
27001
|
+
placeholder: "Bearer {{apiKey}}"
|
|
27002
|
+
})
|
|
27003
|
+
}), /*#__PURE__*/jsxRuntime.jsx("button", {
|
|
27004
|
+
onClick: function onClick() {
|
|
27005
|
+
return removeHeaderRow(row.id);
|
|
26702
27006
|
},
|
|
26703
|
-
|
|
26704
|
-
|
|
27007
|
+
className: "text-gray-500 hover:text-red-400 transition-colors shrink-0",
|
|
27008
|
+
children: /*#__PURE__*/jsxRuntime.jsx(DashReact.FontAwesomeIcon, {
|
|
27009
|
+
icon: "times",
|
|
27010
|
+
className: "text-sm"
|
|
27011
|
+
})
|
|
27012
|
+
})]
|
|
27013
|
+
}, row.id);
|
|
27014
|
+
}), /*#__PURE__*/jsxRuntime.jsxs("button", {
|
|
27015
|
+
onClick: addHeaderRow,
|
|
27016
|
+
className: "text-sm text-blue-400 hover:text-blue-300 transition-colors flex items-center gap-1",
|
|
27017
|
+
children: [/*#__PURE__*/jsxRuntime.jsx(DashReact.FontAwesomeIcon, {
|
|
27018
|
+
icon: "plus",
|
|
27019
|
+
className: "text-xs"
|
|
26705
27020
|
}), /*#__PURE__*/jsxRuntime.jsx("span", {
|
|
26706
|
-
|
|
26707
|
-
children: ":"
|
|
26708
|
-
}), /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
26709
|
-
className: "flex-1",
|
|
26710
|
-
children: /*#__PURE__*/jsxRuntime.jsx(DashReact.InputText, {
|
|
26711
|
-
value: row.headerValue,
|
|
26712
|
-
onChange: function onChange(value) {
|
|
26713
|
-
return updateHeaderRow(row.id, "headerValue", value);
|
|
26714
|
-
},
|
|
26715
|
-
placeholder: "Bearer {{apiKey}}"
|
|
26716
|
-
})
|
|
26717
|
-
}), /*#__PURE__*/jsxRuntime.jsx("button", {
|
|
26718
|
-
onClick: function onClick() {
|
|
26719
|
-
return removeHeaderRow(row.id);
|
|
26720
|
-
},
|
|
26721
|
-
className: "text-gray-500 hover:text-red-400 transition-colors shrink-0",
|
|
26722
|
-
children: /*#__PURE__*/jsxRuntime.jsx(DashReact.FontAwesomeIcon, {
|
|
26723
|
-
icon: "times",
|
|
26724
|
-
className: "text-sm"
|
|
26725
|
-
})
|
|
27021
|
+
children: "Add Header"
|
|
26726
27022
|
})]
|
|
26727
|
-
}, row.id);
|
|
26728
|
-
}), /*#__PURE__*/jsxRuntime.jsxs("button", {
|
|
26729
|
-
onClick: addHeaderRow,
|
|
26730
|
-
className: "text-sm text-blue-400 hover:text-blue-300 transition-colors flex items-center gap-1",
|
|
26731
|
-
children: [/*#__PURE__*/jsxRuntime.jsx(DashReact.FontAwesomeIcon, {
|
|
26732
|
-
icon: "plus",
|
|
26733
|
-
className: "text-xs"
|
|
26734
|
-
}), /*#__PURE__*/jsxRuntime.jsx("span", {
|
|
26735
|
-
children: "Add Header"
|
|
26736
27023
|
})]
|
|
26737
27024
|
})]
|
|
26738
|
-
})
|
|
26739
|
-
|
|
26740
|
-
|
|
26741
|
-
|
|
26742
|
-
|
|
26743
|
-
|
|
26744
|
-
|
|
26745
|
-
|
|
26746
|
-
|
|
26747
|
-
children: "Values for the fields referenced in your configuration above"
|
|
26748
|
-
})]
|
|
26749
|
-
}), formFields.map(function (field) {
|
|
26750
|
-
return /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
26751
|
-
className: "flex flex-col gap-2",
|
|
26752
|
-
children: [/*#__PURE__*/jsxRuntime.jsx(DashReact.FormLabel, {
|
|
26753
|
-
label: field.displayName,
|
|
26754
|
-
required: field.required
|
|
26755
|
-
}), /*#__PURE__*/jsxRuntime.jsx(DashReact.InputText, {
|
|
26756
|
-
type: field.secret ? "password" : "text",
|
|
26757
|
-
value: credentialData[field.key] || "",
|
|
26758
|
-
onChange: function onChange(value) {
|
|
26759
|
-
return handleCredentialChange(field.key, value);
|
|
26760
|
-
},
|
|
26761
|
-
placeholder: "Enter ".concat(field.displayName.toLowerCase())
|
|
26762
|
-
}), formErrors[field.key] && /*#__PURE__*/jsxRuntime.jsx("p", {
|
|
26763
|
-
className: "text-sm text-red-400",
|
|
26764
|
-
children: formErrors[field.key]
|
|
27025
|
+
}), formFields.length > 0 && /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
27026
|
+
children: [/*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
27027
|
+
className: "border-t border-white/10 pt-4",
|
|
27028
|
+
children: [/*#__PURE__*/jsxRuntime.jsx("p", {
|
|
27029
|
+
className: "text-xs font-semibold opacity-40 uppercase tracking-wider",
|
|
27030
|
+
children: "Credentials"
|
|
27031
|
+
}), /*#__PURE__*/jsxRuntime.jsx("p", {
|
|
27032
|
+
className: "text-sm opacity-50 mt-1",
|
|
27033
|
+
children: "Values for the fields referenced in your configuration above"
|
|
26765
27034
|
})]
|
|
26766
|
-
}, field
|
|
27035
|
+
}), formFields.map(function (field) {
|
|
27036
|
+
return /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
27037
|
+
className: "flex flex-col gap-2",
|
|
27038
|
+
children: [/*#__PURE__*/jsxRuntime.jsx(DashReact.FormLabel, {
|
|
27039
|
+
label: field.displayName,
|
|
27040
|
+
required: field.required
|
|
27041
|
+
}), /*#__PURE__*/jsxRuntime.jsx(DashReact.InputText, {
|
|
27042
|
+
type: field.secret ? "password" : "text",
|
|
27043
|
+
value: credentialData[field.key] || "",
|
|
27044
|
+
onChange: function onChange(value) {
|
|
27045
|
+
return handleCredentialChange(field.key, value);
|
|
27046
|
+
},
|
|
27047
|
+
placeholder: "Enter ".concat(field.displayName.toLowerCase())
|
|
27048
|
+
}), formErrors[field.key] && /*#__PURE__*/jsxRuntime.jsx("p", {
|
|
27049
|
+
className: "text-sm text-red-400",
|
|
27050
|
+
children: formErrors[field.key]
|
|
27051
|
+
})]
|
|
27052
|
+
}, field.key);
|
|
27053
|
+
})]
|
|
26767
27054
|
})]
|
|
26768
27055
|
}), testResult && /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
26769
27056
|
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"),
|
|
@@ -26801,7 +27088,7 @@ var CustomMcpServerForm = function CustomMcpServerForm(_ref2) {
|
|
|
26801
27088
|
onClick: handleTestConnection,
|
|
26802
27089
|
size: "sm"
|
|
26803
27090
|
}), /*#__PURE__*/jsxRuntime.jsx(DashReact.Button, {
|
|
26804
|
-
title: "Save MCP Server",
|
|
27091
|
+
title: isEditMode ? "Save Changes" : "Save MCP Server",
|
|
26805
27092
|
onClick: handleSave,
|
|
26806
27093
|
size: "sm"
|
|
26807
27094
|
})]
|
|
@@ -27369,6 +27656,16 @@ var ProvidersSection = function ProvidersSection(_ref) {
|
|
|
27369
27656
|
_useState14 = _slicedToArray(_useState13, 2),
|
|
27370
27657
|
isAddingMcp = _useState14[0],
|
|
27371
27658
|
setIsAddingMcp = _useState14[1];
|
|
27659
|
+
var _useState15 = React.useState(false),
|
|
27660
|
+
_useState16 = _slicedToArray(_useState15, 2),
|
|
27661
|
+
isEditingMcp = _useState16[0],
|
|
27662
|
+
setIsEditingMcp = _useState16[1];
|
|
27663
|
+
|
|
27664
|
+
// Row ID counter for env/header rows in MCP edit mode
|
|
27665
|
+
var nextRowIdRef = React.useRef(0);
|
|
27666
|
+
var nextRowId = function nextRowId() {
|
|
27667
|
+
return "prov_row_".concat(++nextRowIdRef.current);
|
|
27668
|
+
};
|
|
27372
27669
|
var providerEntries = Object.entries(providers);
|
|
27373
27670
|
var appId = credentials === null || credentials === void 0 ? void 0 : credentials.appId;
|
|
27374
27671
|
|
|
@@ -27389,6 +27686,7 @@ var ProvidersSection = function ProvidersSection(_ref) {
|
|
|
27389
27686
|
setFormCredentials({});
|
|
27390
27687
|
setIsCreating(false);
|
|
27391
27688
|
setIsEditing(false);
|
|
27689
|
+
setIsEditingMcp(false);
|
|
27392
27690
|
}
|
|
27393
27691
|
function handleSave() {
|
|
27394
27692
|
if (!formName.trim() || !dashApi || !appId) return;
|
|
@@ -27411,11 +27709,17 @@ var ProvidersSection = function ProvidersSection(_ref) {
|
|
|
27411
27709
|
}
|
|
27412
27710
|
function handleStartEdit(name, provider) {
|
|
27413
27711
|
setSelectedName(name);
|
|
27414
|
-
setFormName(name);
|
|
27415
|
-
setFormType(provider.type || "");
|
|
27416
|
-
setFormCredentials(provider.credentials || {});
|
|
27417
|
-
setIsEditing(true);
|
|
27418
27712
|
setIsCreating(false);
|
|
27713
|
+
if (provider.providerClass === "mcp") {
|
|
27714
|
+
setIsEditingMcp(true);
|
|
27715
|
+
setIsEditing(false);
|
|
27716
|
+
} else {
|
|
27717
|
+
setFormName(name);
|
|
27718
|
+
setFormType(provider.type || "");
|
|
27719
|
+
setFormCredentials(provider.credentials || {});
|
|
27720
|
+
setIsEditing(true);
|
|
27721
|
+
setIsEditingMcp(false);
|
|
27722
|
+
}
|
|
27419
27723
|
}
|
|
27420
27724
|
function handleSaveEdit() {
|
|
27421
27725
|
if (!formName.trim() || !dashApi || !appId) return;
|
|
@@ -27475,6 +27779,30 @@ var ProvidersSection = function ProvidersSection(_ref) {
|
|
|
27475
27779
|
});
|
|
27476
27780
|
}
|
|
27477
27781
|
|
|
27782
|
+
// Handle MCP provider editing via CustomMcpServerForm
|
|
27783
|
+
function handleMcpEditSave(providerName, providerType, mcpCredentials, mcpConfig) {
|
|
27784
|
+
if (!dashApi || !appId) return;
|
|
27785
|
+
var originalName = selectedName;
|
|
27786
|
+
|
|
27787
|
+
// Delete old if name changed
|
|
27788
|
+
if (originalName && originalName !== providerName) {
|
|
27789
|
+
dashApi.deleteProvider(appId, originalName, function () {}, function () {});
|
|
27790
|
+
}
|
|
27791
|
+
dashApi.saveProvider(appId, providerName, {
|
|
27792
|
+
providerType: providerType,
|
|
27793
|
+
credentials: mcpCredentials,
|
|
27794
|
+
providerClass: "mcp",
|
|
27795
|
+
mcpConfig: mcpConfig
|
|
27796
|
+
}, function () {
|
|
27797
|
+
setSelectedName(providerName);
|
|
27798
|
+
setIsEditingMcp(false);
|
|
27799
|
+
resetForm();
|
|
27800
|
+
refreshProviders && refreshProviders();
|
|
27801
|
+
}, function (e, err) {
|
|
27802
|
+
return (void 0);
|
|
27803
|
+
});
|
|
27804
|
+
}
|
|
27805
|
+
|
|
27478
27806
|
// Respond to external create trigger from header
|
|
27479
27807
|
var prevCreateRequested = React.useRef(false);
|
|
27480
27808
|
React.useEffect(function () {
|
|
@@ -27593,6 +27921,23 @@ var ProvidersSection = function ProvidersSection(_ref) {
|
|
|
27593
27921
|
setIsCreating(false);
|
|
27594
27922
|
}
|
|
27595
27923
|
});
|
|
27924
|
+
} else if (isEditingMcp && selectedName && selectedProvider) {
|
|
27925
|
+
var mc = selectedProvider.mcpConfig || {};
|
|
27926
|
+
detailContent = /*#__PURE__*/jsxRuntime.jsx(CustomMcpServerForm, {
|
|
27927
|
+
isEditMode: true,
|
|
27928
|
+
initialName: selectedName,
|
|
27929
|
+
initialTransport: mc.transport || "stdio",
|
|
27930
|
+
initialCommand: mc.command || "",
|
|
27931
|
+
initialArgs: (mc.args || []).join(" "),
|
|
27932
|
+
initialEnvMappingRows: envMappingToRows(mc.envMapping, nextRowId),
|
|
27933
|
+
initialUrl: mc.url || "",
|
|
27934
|
+
initialHeaderRows: headerTemplateToRows(mc.headerTemplate, nextRowId),
|
|
27935
|
+
initialCredentials: selectedProvider.credentials || {},
|
|
27936
|
+
onSave: handleMcpEditSave,
|
|
27937
|
+
onBack: function onBack() {
|
|
27938
|
+
return setIsEditingMcp(false);
|
|
27939
|
+
}
|
|
27940
|
+
});
|
|
27596
27941
|
} else if (selectedName && selectedProvider) {
|
|
27597
27942
|
detailContent = /*#__PURE__*/jsxRuntime.jsx(ProviderDetail, {
|
|
27598
27943
|
providerName: selectedName,
|
|
@@ -33594,6 +33939,7 @@ exports.deriveFormFields = deriveFormFields;
|
|
|
33594
33939
|
exports.envMappingToRows = envMappingToRows;
|
|
33595
33940
|
exports.evaluateBundle = evaluateBundle;
|
|
33596
33941
|
exports.extractWidgetConfigs = extractWidgetConfigs;
|
|
33942
|
+
exports.formStateToMcpJson = formStateToMcpJson;
|
|
33597
33943
|
exports.formatFieldName = formatFieldName;
|
|
33598
33944
|
exports.generateCustomTheme = generateCustomTheme;
|
|
33599
33945
|
exports.generateHarmonyTheme = generateHarmonyTheme;
|
|
@@ -33629,6 +33975,7 @@ exports.isWidgetResolvable = isWidgetResolvable;
|
|
|
33629
33975
|
exports.isWorkspace = isWorkspace;
|
|
33630
33976
|
exports.layoutItemHasWorkspaceAsChild = layoutItemHasWorkspaceAsChild;
|
|
33631
33977
|
exports.loadWidgetBundle = loadWidgetBundle;
|
|
33978
|
+
exports.mcpJsonToFormState = mcpJsonToFormState;
|
|
33632
33979
|
exports.numChildrenForLayout = numChildrenForLayout;
|
|
33633
33980
|
exports.removeItemFromLayout = removeItemFromLayout;
|
|
33634
33981
|
exports.renderComponent = renderComponent;
|