"use client"; import { useState } from "react"; import { X, Package, Star, Download, ExternalLink, CheckCircle } from "lucide-react"; import { MCPProvider } from "@/lib/types/mcp"; import { MCPRatingStars } from "./MCPRatingStars"; interface MCPDetailModalProps { mcp: MCPProvider; isOpen: boolean; onClose: () => void; onInstall: () => void; } export function MCPDetailModal({ mcp, isOpen, onClose, onInstall }: MCPDetailModalProps) { const [activeTab, setActiveTab] = useState<"about" | "capabilities" | "screenshots" | "configuration">("about"); if (!isOpen) return null; const formatDownloads = (downloads: number) => { if (downloads >= 1000000) return `${(downloads / 1000000).toFixed(1)}M`; if (downloads >= 1000) return `${(downloads / 1000).toFixed(1)}K`; return downloads.toString(); }; const getCategoryColor = (category: string) => { switch (category) { case "map": return "bg-blue-100 text-blue-800 dark:bg-blue-900 dark:text-blue-200"; case "browser": return "bg-green-100 text-green-800 dark:bg-green-900 dark:text-green-200"; case "office": return "bg-purple-100 text-purple-800 dark:bg-purple-900 dark:text-purple-200"; case "search": return "bg-orange-100 text-orange-800 dark:bg-orange-900 dark:text-orange-200"; case "database": return "bg-indigo-100 text-indigo-800 dark:bg-indigo-900 dark:text-indigo-200"; case "finance": return "bg-emerald-100 text-emerald-800 dark:bg-emerald-900 dark:text-emerald-200"; case "code": return "bg-red-100 text-red-800 dark:bg-red-900 dark:text-red-200"; case "chart": return "bg-pink-100 text-pink-800 dark:bg-pink-900 dark:text-pink-200"; case "payment": return "bg-yellow-100 text-yellow-800 dark:bg-yellow-900 dark:text-yellow-200"; default: return "bg-gray-100 text-gray-800 dark:bg-gray-900 dark:text-gray-200"; } }; return (
{/* Header */}

{mcp.name}

by {mcp.author}

{mcp.category} {mcp.installed && (
Installed
)}
{/* Stats */}
({mcp.totalRatings} reviews)
{formatDownloads(mcp.downloads)} downloads
Version {mcp.version}
{/* Tabs */}
{[ { id: "about", label: "About" }, { id: "capabilities", label: "Capabilities" }, { id: "configuration", label: "Configuration" }, { id: "screenshots", label: "Screenshots" }, ].map((tab) => ( ))}
{/* Content */}
{activeTab === "about" && (

Description

{mcp.description}

Tags

{mcp.tags.map((tag) => ( {tag} ))}
{(mcp.repository || mcp.homepage) && (

Links

{mcp.repository && ( Repository )} {mcp.homepage && ( Homepage )}
)}
)} {activeTab === "capabilities" && (

Capabilities

{(mcp.tools || mcp.capabilities || []).map((capability, index) => (
{typeof capability === 'string' ? capability : (capability as any).name || String(capability)}
))}
)} {activeTab === "configuration" && (

Installation Configuration

{mcp.config && mcp.config.length > 0 ? (
{mcp.config.map((configItem, index) => (

Configuration {index + 1}

{configItem.mcpServers && (
Command
{configItem.mcpServers.command} {configItem.mcpServers.arguments?.join(' ')}
)} {configItem.mcpServers?.env && Object.keys(configItem.mcpServers.env).length > 0 && (
Environment Variables
{Object.entries(configItem.mcpServers.env).map(([key, value]) => (
{key}={String(value)}
))}
)}
))}
) : (

No configuration available for this MCP

)}
{mcp.tools && mcp.tools.length > 0 && (

Available Tools

{mcp.tools.map((tool, index) => (

{tool.name}

{tool.description}

{tool.input_schema && (
Parameters
{Object.entries(tool.input_schema.properties || {}).map(([param, schema]) => (
{param} {typeof schema === 'object' && schema ? (schema as any).type || 'any' : 'any'} {tool.input_schema.required?.includes(param) && ( * )}
))}
)}
))}
)}
)} {activeTab === "screenshots" && (

Screenshots

{mcp.screenshotUrls && mcp.screenshotUrls.length > 0 ? (
{mcp.screenshotUrls.map((url, index) => ( {`Screenshot ))}
) : (

No screenshots available

)}
)}
{/* Footer */}
{!mcp.installed && ( )}
); }