mirror of
https://github.com/infiniflow/ragflow.git
synced 2025-12-08 20:42:30 +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)
22 lines
532 B
TypeScript
22 lines
532 B
TypeScript
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,
|
|
};
|
|
}
|