Feat: Test MCP server #3221 (#8757)

### What problem does this PR solve?

Feat: Test MCP server #3221

### Type of change


- [x] New Feature (non-breaking change which adds functionality)
This commit is contained in:
balibabu
2025-07-10 09:33:29 +08:00
committed by GitHub
parent cf0a1366af
commit aae9fbb9de
7 changed files with 158 additions and 20 deletions

View File

@ -1,5 +1,6 @@
import message from '@/components/ui/message';
import { IMcpServerListResponse } from '@/interfaces/database/mcp';
import { IMcpServerListResponse, IMCPTool } from '@/interfaces/database/mcp';
import { ITestMcpRequestBody } from '@/interfaces/request/mcp';
import i18n from '@/locales/config';
import mcpServerService from '@/services/mcp-server-service';
import { useMutation, useQuery, useQueryClient } from '@tanstack/react-query';
@ -164,12 +165,12 @@ export const useTestMcpServer = () => {
data,
isPending: loading,
mutateAsync,
} = useMutation({
} = useMutation<IMCPTool[], Error, ITestMcpRequestBody>({
mutationKey: [McpApiAction.TestMcpServer],
mutationFn: async (params: Record<string, any>) => {
const { data = {} } = await mcpServerService.test(params);
mutationFn: async (params) => {
const { data } = await mcpServerService.test(params);
return data;
return data?.data || [];
},
});