/* Copyright 2026 Marimo. All rights reserved. */ import { Loader2, PlugIcon, RefreshCwIcon } from "lucide-react"; import { API } from "@/core/network/api"; import { cn } from "@/utils/cn"; import { Button } from "../ui/button"; import { Popover, PopoverContent, PopoverTrigger } from "../ui/popover"; import { Tooltip } from "../ui/tooltip"; import { toast } from "../ui/use-toast"; import { useMCPStatus } from "./hooks"; /** * MCP Status indicator component * Shows a small icon with status color and a popover with detailed information */ export const MCPStatusIndicator: React.FC = () => { const { data: status, refetch, isFetching } = useMCPStatus(); const handleRefresh = async () => { try { await API.post("/ai/mcp/refresh", {}); toast({ title: "MCP refreshed", description: "MCP server configuration has been refreshed", }); refetch(); } catch (error) { toast({ title: "Refresh failed", description: error instanceof Error ? error.message : "Failed to refresh MCP", variant: "danger", }); } }; const servers = status?.servers || {}; const hasServers = Object.keys(servers).length > 0; return (

MCP Server Status

{status && (
{hasServers && (
Overall:
)} {status.error && (
{status.error}
)} {hasServers && (
Servers:
{Object.entries(servers).map(([name, serverStatus]) => (
{name}
))}
)} {!hasServers && (
No MCP servers configured.
Configure under{" "} Settings > AI > MCP
)}
)}
); }; export const McpStatusText: React.FC<{ status: | "ok" | "partial" | "error" | "failed" | "disconnected" | "pending" | "connected"; }> = ({ status }) => { return ( {status} ); };