diff --git a/src/apis/paths/mcp.ts b/src/apis/paths/mcp.ts index 31ec1eb56c97ad0331a06ccb4762bd0762ecdc04..c85d839002614979b1a044cf8009b0dbd463a10b 100644 --- a/src/apis/paths/mcp.ts +++ b/src/apis/paths/mcp.ts @@ -10,6 +10,8 @@ const getMcpList = (params: { keyword?: string; page?: number; pageSize?: number; + isInstall?: boolean | null; + isActive?: boolean | null; }) => { return get<{ currentPage: number; @@ -69,13 +71,13 @@ const createOrUpdateMcpService = (params: { name: string; overview: string; description: string; - config: string; + config: object; mcpType: 'stdio' | 'sse' | 'stream'; }) => { return post<{ service_id: string; name: string; - }>(`${MCP_BASE_URL}`, params); + }>(`${MCP_BASE_URL}`, params, { 'Content-Type': 'application/json' }); }; const deleteMcpService = (id: string) => { @@ -86,6 +88,10 @@ const activeMcpService = (id: string, active: boolean) => { return post<{ serviceId: string }>(`${MCP_BASE_URL}/${id}`, { active }); }; +const installMcpService = (id: string) => { + return post<{ serviceId: string }>(`${MCP_BASE_URL}/${id}/install`); +}; + // 定义一个名为uploadMcpIcon的函数,接收两个参数serviceId和icon const uploadMcpIcon = (params: { serviceId: string; @@ -96,7 +102,7 @@ const uploadMcpIcon = (params: { formData.append('icon', params.icon); // 使用post方法向MCP_BASE_URL/${id}发送请求,请求体为{ icon: params.icon } return post<{ icon: string }>( - `${MCP_BASE_URL}`, + `${MCP_BASE_URL}/icon/${params.serviceId}`, formData, { serviceId: params.serviceId, @@ -111,5 +117,6 @@ export const mcpApi = { createOrUpdateMcpService, deleteMcpService, activeMcpService, + installMcpService, uploadMcpIcon }; diff --git a/src/assets/svgs/warning.svg b/src/assets/svgs/warning.svg new file mode 100644 index 0000000000000000000000000000000000000000..71554801a5aa7005cbc4643970ba1f70daac34a2 --- /dev/null +++ b/src/assets/svgs/warning.svg @@ -0,0 +1,8 @@ + + + Created with Pixso. + + + + + diff --git a/src/views/api/components/McpDrawer.vue b/src/views/api/components/McpDrawer.vue index a44eff4a07646c559d7f9fb9f33e564b653c460b..ccf2060d990144632b5bce666a860cb10bc8135b 100644 --- a/src/views/api/components/McpDrawer.vue +++ b/src/views/api/components/McpDrawer.vue @@ -149,7 +149,7 @@ async function onConfirm(formEl: FormInstance | undefined) { icon: form.icon, name: form.name, description: form.description, - config: form.mcpConfig, + config: JSON.parse(form.mcpConfig), mcpType: form.type, }); diff --git a/src/views/api/components/PluginCard.vue b/src/views/api/components/PluginCard.vue index 1ae57c959e5eaf588d325cc67ecb33e3cdf88cd3..a39ac2919a45ee5cfde50f62fb3757649691c2fc 100644 --- a/src/views/api/components/PluginCard.vue +++ b/src/views/api/components/PluginCard.vue @@ -54,6 +54,7 @@ const props = defineProps(); display: flex; flex-direction: column; gap: 4px; + width: 70%; &__top { min-height: 24px; @@ -66,7 +67,7 @@ const props = defineProps(); overflow: hidden; white-space: nowrap; text-overflow: ellipsis; - width: 80%; + width: 70%; font-weight: 700; } } diff --git a/src/views/api/index.vue b/src/views/api/index.vue index a566f503aadc2508f54681e7026f09bc8b64b6b6..00c3a330742b01a768634fd7d56117c52fb7301d 100644 --- a/src/views/api/index.vue +++ b/src/views/api/index.vue @@ -103,6 +103,30 @@ :lazy="true" > + handleSearchMcpList(tab.props.name)" + > + + + + + - + + {{ t('plugin_center.mcp.install_failed') }} + + + + + {{ t('plugin_center.mcp.install_success') }} + + + + + + + {{ t('plugin_center.mcp.not_installed') }} + + @@ -156,7 +205,7 @@ class="apiCenterCardId" v-if="pluginType === 'mcp'" > - ID: + ID: {{ item.serviceId }} + + {{ t('plugin_center.mcp.install') }} + + + - - - {{ $t('semantic.interface_edit') }} - - - {{ $t('semantic.interface_delete') }} - - + {{ $t('semantic.interface_edit') }} + + + + {{ $t('semantic.cancel') }} + + + + {{ $t('semantic.interface_delete') }} + @@ -285,12 +357,7 @@