import { Alert, AlertDescription } from "@/components/ui/alert"; import { Button } from "@/components/ui/button"; import { Input } from "@/components/ui/input"; import { TabsContent } from "@/components/ui/tabs"; import { Root } from "@modelcontextprotocol/sdk/types.js"; import { Plus, Minus, Save } from "lucide-react"; const RootsTab = ({ roots, setRoots, onRootsChange, }: { roots: Root[]; setRoots: React.Dispatch>; onRootsChange: () => void; }) => { const addRoot = () => { setRoots((currentRoots) => [...currentRoots, { uri: "file://", name: "" }]); }; const removeRoot = (index: number) => { setRoots((currentRoots) => currentRoots.filter((_, i) => i !== index)); }; const updateRoot = (index: number, field: keyof Root, value: string) => { setRoots((currentRoots) => currentRoots.map((root, i) => i === index ? { ...root, [field]: value } : root, ), ); }; const handleSave = () => { onRootsChange(); }; return (
Configure the root directories that the server can access {roots.map((root, index) => (
updateRoot(index, "uri", e.target.value)} className="flex-1" />
))}
); }; export default RootsTab;