Files
ragflow/web/src/services/mcp-server-service.ts
balibabu f683580310 Feat: Synchronize MCP data to agent #3221 (#8832)
### What problem does this PR solve?

Feat: Synchronize MCP data to agent #3221
### Type of change


- [x] New Feature (non-breaking change which adds functionality)
2025-07-15 09:37:08 +08:00

73 lines
1.4 KiB
TypeScript

import { IPaginationRequestBody } from '@/interfaces/request/base';
import api from '@/utils/api';
import registerServer from '@/utils/register-server';
import request from '@/utils/request';
const {
listMcpServer,
createMcpServer,
updateMcpServer,
deleteMcpServer,
getMcpServer,
importMcpServer,
exportMcpServer,
listMcpServerTools,
testMcpServerTool,
cacheMcpServerTool,
testMcpServer,
} = api;
const methods = {
list: {
url: listMcpServer,
method: 'post',
},
get: {
url: getMcpServer,
method: 'get',
},
create: {
url: createMcpServer,
method: 'post',
},
update: {
url: updateMcpServer,
method: 'post',
},
delete: {
url: deleteMcpServer,
method: 'post',
},
import: {
url: importMcpServer,
method: 'post',
},
export: {
url: exportMcpServer,
method: 'post',
},
listTools: {
url: listMcpServerTools,
method: 'post',
},
testTool: {
url: testMcpServerTool,
method: 'post',
},
cacheTool: {
url: cacheMcpServerTool,
method: 'post',
},
test: {
url: testMcpServer,
method: 'post',
},
} as const;
const mcpServerService = registerServer<keyof typeof methods>(methods, request);
export default mcpServerService;
export const listMcpServers = (params?: IPaginationRequestBody, body?: any) =>
request.post(api.listMcpServer, { data: body || {}, params });