mirror of
https://github.com/1Panel-dev/1Panel.git
synced 2025-12-27 09:49:28 +08:00
feat: import mcp server support env (#8344)
Some checks are pending
SonarCloud Scan / SonarCloud (push) Waiting to run
Some checks are pending
SonarCloud Scan / SonarCloud (push) Waiting to run
This commit is contained in:
parent
170bd22062
commit
8196c11010
2 changed files with 16 additions and 1 deletions
|
|
@ -59,7 +59,7 @@ const onConfirm = async () => {
|
|||
mcpServerConfig.value = Object.entries(data.mcpServers).map(([name, config]: any) => ({
|
||||
name,
|
||||
command: [config.command, ...config.args].join(' '),
|
||||
environments: data.env ? Object.entries(data.env).map(([key, value]) => ({ key, value })) : [],
|
||||
environments: config.env ? Object.entries(config.env).map(([key, value]) => ({ key, value })) : [],
|
||||
ssePath: '/' + name,
|
||||
containerName: name,
|
||||
}));
|
||||
|
|
|
|||
|
|
@ -165,8 +165,10 @@ const rules = ref({
|
|||
key: [Rules.requiredInput],
|
||||
value: [Rules.requiredInput],
|
||||
});
|
||||
const hasWebsite = ref(false);
|
||||
|
||||
const acceptParams = async (params: AI.McpServer) => {
|
||||
hasWebsite.value = false;
|
||||
mode.value = params.id ? 'edit' : 'create';
|
||||
if (mode.value == 'edit') {
|
||||
mcpServer.value = params;
|
||||
|
|
@ -191,6 +193,7 @@ const acceptParams = async (params: AI.McpServer) => {
|
|||
mcpServer.value.protocol = parts[0];
|
||||
mcpServer.value.url = parts[1];
|
||||
mcpServer.value.baseUrl = res.data.connUrl;
|
||||
hasWebsite.value = true;
|
||||
}
|
||||
} catch (error) {
|
||||
MsgError(error);
|
||||
|
|
@ -244,6 +247,18 @@ const submit = async (formEl: FormInstance | undefined) => {
|
|||
if (!valid) {
|
||||
return;
|
||||
}
|
||||
let request = true;
|
||||
if (!hasWebsite.value) {
|
||||
await ElMessageBox.confirm(i18n.global.t('app.installWarn'), i18n.global.t('app.checkTitle'), {
|
||||
confirmButtonText: i18n.global.t('commons.button.confirm'),
|
||||
cancelButtonText: i18n.global.t('commons.button.cancel'),
|
||||
}).catch(() => {
|
||||
request = false;
|
||||
});
|
||||
}
|
||||
if (!request) {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
loading.value = true;
|
||||
mcpServer.value.baseUrl = mcpServer.value.protocol + mcpServer.value.url;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue