import { MoreButton } from '@/components/more-button'; import { Card, CardContent } from '@/components/ui/card'; import { Checkbox } from '@/components/ui/checkbox'; import { IMcpServer } from '@/interfaces/database/mcp'; import { formatDate } from '@/utils/date'; import { isPlainObject } from 'lodash'; import { useMemo } from 'react'; import { useTranslation } from 'react-i18next'; import { McpDropdown } from './mcp-dropdown'; import { UseBulkOperateMCPReturnType } from './use-bulk-operate-mcp'; import { UseEditMcpReturnType } from './use-edit-mcp'; export type DatasetCardProps = { data: IMcpServer; } & Pick & Pick; export function McpCard({ data, selectedList, handleSelectChange, showEditModal, }: DatasetCardProps) { const { t } = useTranslation(); const toolLength = useMemo(() => { const tools = data.variables?.tools; if (isPlainObject(tools)) { return Object.keys(tools || {}).length; } return 0; }, [data.variables?.tools]); const onCheckedChange = (checked: boolean) => { if (typeof checked === 'boolean') { handleSelectChange(data.id, checked); } }; return (

{data.name}

{ e.stopPropagation(); }} />
{toolLength} {t('mcp.cachedTools')}

{formatDate(data.update_date)}

); }