diff --git a/backend/app/service/mcp_server.go b/backend/app/service/mcp_server.go index 155f6ed59..c6e64981f 100644 --- a/backend/app/service/mcp_server.go +++ b/backend/app/service/mcp_server.go @@ -118,8 +118,12 @@ func (m McpServerService) Update(req request.McpServerUpdate) error { if err := files.NewFileOp().SaveFile(dockerComposePath, mcpServer.DockerCompose, 0644); err != nil { return err } - startMcp(mcpServer) - return syncMcpServerContainerStatus(mcpServer) + mcpServer.Status = constant.RuntimeStarting + if err := mcpServerRepo.Save(mcpServer); err != nil { + return err + } + go startMcp(mcpServer) + return nil } func (m McpServerService) Create(create request.McpServerCreate) error { @@ -150,7 +154,7 @@ func (m McpServerService) Create(create request.McpServerCreate) error { ContainerName: create.ContainerName, Port: create.Port, Command: create.Command, - Status: constant.RuntimeNormal, + Status: constant.RuntimeStarting, BaseURL: create.BaseURL, SsePath: create.SsePath, Dir: mcpDir, @@ -175,9 +179,9 @@ func (m McpServerService) Create(create request.McpServerCreate) error { if err := mcpServerRepo.Create(mcpServer); err != nil { return err } - startMcp(mcpServer) addProxy(mcpServer) - return syncMcpServerContainerStatus(mcpServer) + go startMcp(mcpServer) + return nil } func (m McpServerService) Delete(id uint) error { @@ -584,6 +588,7 @@ func startMcp(mcpServer *model.McpServer) { mcpServer.Status = constant.RuntimeRunning mcpServer.Message = "" } + _ = syncMcpServerContainerStatus(mcpServer) } func syncMcpServerContainerStatus(mcpServer *model.McpServer) error { diff --git a/backend/constant/common.go b/backend/constant/common.go index 687c22998..bd2d458c6 100644 --- a/backend/constant/common.go +++ b/backend/constant/common.go @@ -35,6 +35,7 @@ var WebUrlMap = map[string]struct{}{ "/ai": {}, "/ai/model": {}, "/ai/gpu": {}, + "/ai/mcp": {}, "/containers": {}, "/containers/container": {}, diff --git a/frontend/src/lang/modules/en.ts b/frontend/src/lang/modules/en.ts index ab49f1e5a..75c0cedfd 100644 --- a/frontend/src/lang/modules/en.ts +++ b/frontend/src/lang/modules/en.ts @@ -2543,8 +2543,8 @@ const message = { env: 'Environments', noenv: 'None', net: 'Network connections', - laddr: 'Source address/port', - raddr: 'Destination address/port', + laddr: 'Local address/port', + raddr: 'Remote address/port', stopProcess: 'End', viewDetails: 'Details', stopProcessWarn: 'Are you sure you want to end this process (PID:{0})?', diff --git a/frontend/src/lang/modules/tw.ts b/frontend/src/lang/modules/tw.ts index f391c7197..5d83b1a9d 100644 --- a/frontend/src/lang/modules/tw.ts +++ b/frontend/src/lang/modules/tw.ts @@ -2380,8 +2380,8 @@ const message = { env: '環境變數', noenv: '無', net: '網路連線', - laddr: '源地址/埠', - raddr: '目標地址/埠', + laddr: '本地地址/埠', + raddr: '远程地址/埠', stopProcess: '結束', viewDetails: '查看詳情', stopProcessWarn: '是否確定結束此行程 (PID:{0})?', diff --git a/frontend/src/lang/modules/zh.ts b/frontend/src/lang/modules/zh.ts index 642683ff2..20ce76a31 100644 --- a/frontend/src/lang/modules/zh.ts +++ b/frontend/src/lang/modules/zh.ts @@ -2382,8 +2382,8 @@ const message = { env: '环境变量', noenv: '无', net: '网络连接', - laddr: '源地址/端口', - raddr: '目标地址/端口', + laddr: '本地地址/端口', + raddr: '远程地址/端口', stopProcess: '结束', viewDetails: '查看详情', stopProcessWarn: '是否确定结束此进程 (PID:{0})?', diff --git a/frontend/src/views/ai/mcp/server/config/index.vue b/frontend/src/views/ai/mcp/server/config/index.vue new file mode 100644 index 000000000..b4c48215a --- /dev/null +++ b/frontend/src/views/ai/mcp/server/config/index.vue @@ -0,0 +1,51 @@ + + + diff --git a/frontend/src/views/ai/mcp/server/index.vue b/frontend/src/views/ai/mcp/server/index.vue index 2163c89fc..87c1f26b1 100644 --- a/frontend/src/views/ai/mcp/server/index.vue +++ b/frontend/src/views/ai/mcp/server/index.vue @@ -18,7 +18,7 @@ :label="$t('commons.table.name')" fix prop="name" - min-width="120px" + width="200px" show-overflow-tooltip > - - - - + - + @@ -107,6 +103,7 @@ import { GlobalStore } from '@/store'; import i18n from '@/lang'; import { MsgError, MsgSuccess } from '@/utils/message'; import BindDomain from './bind/index.vue'; +import Config from './config/index.vue'; const globalStore = GlobalStore(); const loading = ref(false); @@ -114,6 +111,7 @@ const createRef = ref(); const opRef = ref(); const composeLogRef = ref(); const bindDomainRef = ref(); +const configRef = ref(); const items = ref([]); const paginationConfig = reactive({ cacheSizeKey: 'mcp-server-page-size', @@ -126,6 +124,12 @@ const mobile = computed(() => { }); const buttons = [ + { + label: i18n.global.t('menu.config'), + click: (row: AI.McpServer) => { + openConfig(row); + }, + }, { label: i18n.global.t('commons.button.edit'), click: (row: AI.McpServer) => { @@ -241,6 +245,10 @@ const openDomain = () => { bindDomainRef.value.acceptParams(); }; +const openConfig = (row: AI.McpServer) => { + configRef.value.acceptParams(row); +}; + onMounted(() => { search(); }); diff --git a/frontend/src/views/ai/mcp/server/operate/index.vue b/frontend/src/views/ai/mcp/server/operate/index.vue index c674421d5..f78c7a824 100644 --- a/frontend/src/views/ai/mcp/server/operate/index.vue +++ b/frontend/src/views/ai/mcp/server/operate/index.vue @@ -65,7 +65,7 @@ - +