/** * Pure logic for the MCP footer status (no pi imports, so the tests run standalone). * * pi's built-in MCP support has no public connection-state API, so the state is inferred: * - configured: enabled servers from ~/.pi/agent/mcp.json, the trusted project's * .pi/mcp.json (project entries replace global ones of the same name), plus servers * extensions registered with pi.registerMcpServer() (mcp.json wins on name clashes). * - connected: the server has at least one registered tool in namespace mcp__ * whose exposure is not "hidden". Tools register when a server connects; a disabled * server's tools are re-registered as hidden. * Limits: a dropped connection keeps its tools registered until the next call reconnects it, * and a server that offers zero tools never counts as connected. */ /** Only `enabled` is read; other mcp.json fields (url, command, ...) pass through untyped. */ export interface ServerConfig { enabled?: boolean; url?: string; command?: string; } export interface ToolLike { exposure: string; namespace?: { name: string; }; } /** Same rule as pi's mcpNamespace(): "-" and "_" are equivalent in server names. */ export declare function mcpNamespace(server: string): string; /** The mcpServers object of an mcp.json text, or {} when missing or invalid. */ export declare function parseMcpServers(text: string | undefined): Record; /** * Names of enabled servers, in precedence order: global < project (replaces by namespace), * then registered servers whose namespace no config file defines. */ export declare function enabledServers(global: Record, project: Record, registered: Array<{ name: string; config: ServerConfig; }>): string[]; /** Servers among `servers` that have at least one non-hidden registered tool. */ export declare function connectedServers(servers: string[], tools: ToolLike[]): string[]; export type StatusLevel = "ok" | "partial" | "down"; export interface McpStatus { connected: number; enabled: number; level: StatusLevel; /** Enabled servers that are not connected yet. */ pending: string[]; } /** Undefined when no server is enabled (the footer segment is hidden). */ export declare function summarize(enabled: string[], connected: string[]): McpStatus | undefined; export declare function formatStatus(s: McpStatus): string;