mirror of
https://github.com/infiniflow/ragflow.git
synced 2025-12-20 04:39:00 +08:00
### What problem does this PR solve? Feat: Import and export MCP Server #3221 ### Type of change - [x] New Feature (non-breaking change which adds functionality)
This commit is contained in:
21
web/src/pages/profile-setting/mcp/use-export-mcp.ts
Normal file
21
web/src/pages/profile-setting/mcp/use-export-mcp.ts
Normal file
@ -0,0 +1,21 @@
|
||||
import { useExportMcpServer } from '@/hooks/use-mcp-request';
|
||||
import { downloadJsonFile } from '@/utils/file-util';
|
||||
import { useCallback } from 'react';
|
||||
|
||||
export function useExportMcp() {
|
||||
const { exportMcpServer } = useExportMcpServer();
|
||||
|
||||
const handleExportMcpJson = useCallback(
|
||||
(ids: string[]) => async () => {
|
||||
const data = await exportMcpServer(ids);
|
||||
if (data.code === 0) {
|
||||
downloadJsonFile(data.data, `mcp.json`);
|
||||
}
|
||||
},
|
||||
[exportMcpServer],
|
||||
);
|
||||
|
||||
return {
|
||||
handleExportMcpJson,
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user