import { Star, Download, Terminal, ChevronRight } from "lucide-react"; import { Badge } from "./ui/badge"; import { Button } from "./ui/button"; import { Card, CardContent, CardHeader } from "./ui/card"; import type { MCPServer } from "../types/server"; import { Link, NavLink } from "react-router"; import { useState } from "react"; import { motion, AnimatePresence } from "motion/react"; function getGooseInstallLink(server: MCPServer): string { const parts = server.command.split(" "); const baseCmd = parts[0]; // npx or uvx const args = parts.slice(1); // remaining arguments const queryParams = [ `cmd=${encodeURIComponent(baseCmd)}`, ...args.map((arg) => `arg=${encodeURIComponent(arg)}`), `id=${encodeURIComponent(server.id)}`, `name=${encodeURIComponent(server.name)}`, `description=${encodeURIComponent(server.description)}`, ...server.environmentVariables .filter((env) => env.required) .map( (env) => `env=${encodeURIComponent(`${env.name}=${env.description}`)}` ), ].join("&"); return `goose://extension?${queryParams}`; } export function ServerCard({ server }: { server: MCPServer }) { const [isCommandVisible, setIsCommandVisible] = useState(false); return (
{server.name}

{server.description}

{isCommandVisible && ( goose session --with-extension "{server.command}" )}
{server.githubStars} on Github
); }