diff --git a/ui/src/views/application/component/McpServersDialog.vue b/ui/src/views/application/component/McpServersDialog.vue index 1f7dec2e4..a5aeac4ec 100644 --- a/ui/src/views/application/component/McpServersDialog.vue +++ b/ui/src/views/application/component/McpServersDialog.vue @@ -17,7 +17,7 @@ @submit.prevent > - + {{ $t('views.applicationWorkflow.nodes.mcpNode.reference') }} @@ -100,17 +100,8 @@ import { computed, inject, onMounted, ref, watch } from 'vue' import { loadSharedApi } from '@/utils/dynamics-api/shared-api.ts' import { useRoute } from 'vue-router' -const getApplicationDetail = inject('getApplicationDetail') as any -const applicationDetail = getApplicationDetail() const emit = defineEmits(['refresh']) -const route = useRoute() -const apiType = computed(() => { - if (route.path.includes('resource-management')) { - return 'systemManage' - } else { - return 'workspace' - } -}) + const paramFormRef = ref() const mcpServerJson = `{ @@ -143,32 +134,20 @@ watch(dialogVisible, (bool) => { } }) -function getMcpToolSelectOptions() { - const obj = - apiType.value === 'systemManage' - ? { - scope: 'WORKSPACE', - tool_type: 'MCP', - workspace_id: applicationDetail.value?.workspace_id, - } - : { - scope: 'WORKSPACE', - tool_type: 'MCP', - } - - loadSharedApi({ type: 'tool', systemType: apiType.value }) - .getAllToolList(obj, loading) - .then((res: any) => { - mcpToolSelectOptions.value = [...res.data.shared_tools, ...res.data.tools].filter( - (item: any) => item.is_active, - ) - }) +function mcpSourceChange() { + if (form.value.mcp_source === 'referencing') { + form.value.mcp_servers = '' + } else { + form.value.mcp_tool_id = '' + } } -const open = (data: any) => { + +const open = (data: any, selectOptions: any) => { form.value = { ...form.value, ...data } form.value.mcp_source = data.mcp_source || 'referencing' dialogVisible.value = true + mcpToolSelectOptions.value = selectOptions || [] } const submit = () => { @@ -180,10 +159,6 @@ const submit = () => { }) } -onMounted(() => { - getMcpToolSelectOptions() -}) - defineExpose({ open }) diff --git a/ui/src/workflow/nodes/ai-chat-node/index.vue b/ui/src/workflow/nodes/ai-chat-node/index.vue index bc2dd1ff6..b92a5d154 100644 --- a/ui/src/workflow/nodes/ai-chat-node/index.vue +++ b/ui/src/workflow/nodes/ai-chat-node/index.vue @@ -114,6 +114,7 @@ /> +
MCP
@@ -129,6 +130,24 @@
+
+
+
+ + +
+ {{ relatedObject(mcpToolSelectOptions, chat_data.mcp_tool_id, 'id')?.name || $t('common.custom') + ' MCP' }} +
+
+ + + +
+
+
{{ $t('views.applicationWorkflow.nodes.mcpNode.tool') }}
@@ -144,6 +163,22 @@
+
+ +