/** * MCP server selector component for managing MCP server connections. * Uses pi-tui overlay pattern with navigation. */ import { Box } from '@earendil-works/pi-tui'; import type { Focusable, TUI } from '@earendil-works/pi-tui'; import type { McpServerStatus, McpSkippedServer } from '@mastra/code-sdk/mcp/types'; export interface McpSelectorOptions { /** TUI instance for rendering */ tui: TUI; /** Server statuses */ statuses: McpServerStatus[]; /** Skipped servers */ skipped: McpSkippedServer[]; /** Config file paths for display */ configPaths: { project: string; global: string; claude: string; }; /** Get current statuses (for polling during initial connect) */ getStatuses: () => { statuses: McpServerStatus[]; skipped: McpSkippedServer[]; }; /** Callback to reload all servers — should return fresh statuses/skipped */ onReloadAll: () => Promise<{ statuses: McpServerStatus[]; skipped: McpSkippedServer[]; }>; /** Callback to reconnect a single server by name — returns updated status */ onReconnectServer: (name: string) => Promise; /** Callback to run the OAuth flow for a single server by name — returns updated status */ onAuthenticateServer: (name: string) => Promise; /** Callback to cancel a pending OAuth flow for a server by name — resolves true if one was cancelled */ onCancelAuthenticateServer: (name: string) => Promise; /** * Callback to disable/enable a server by name. `global: true` applies the * change across every project instead of just this one. Rebuilds all * connections (like reload), so it returns fresh statuses/skipped. */ onSetServerDisabled: (name: string, disabled: boolean, options?: { global?: boolean; }) => Promise<{ statuses: McpServerStatus[]; skipped: McpSkippedServer[]; }>; /** Get captured stderr logs for a server */ getServerLogs: (name: string) => string[]; /** Show an info message in the chat area */ showInfo: (msg: string) => void; /** Callback when selector is dismissed */ onClose: () => void; } export declare class McpSelectorComponent extends Box implements Focusable { private listContainer; private statuses; private skipped; private selectedIndex; private getStatusesCallback; private onReloadAllCallback; private onReconnectServerCallback; private onAuthenticateServerCallback; private onCancelAuthenticateServerCallback; private onSetServerDisabledCallback; private getServerLogsCallback; private showInfoCallback; private onCloseCallback; private tui; private pollTimer; private subMenuOpen; private subMenuIndex; private subMenuActions; private _detailView; private _reloading; private _authenticating; private _cancelling; private _focused; get focused(): boolean; set focused(value: boolean); constructor(options: McpSelectorOptions); private buildUI; private getTotalItems; private updateList; /** * Whether an OAuth flow is in flight for this server. True if either the local * set (this selector instance started the flow) or the manager-owned status * flag (survives close/reopen) says so. */ private isAuthenticating; private isBusy; private startPollingIfNeeded; private stopPolling; /** Clean up resources when component is removed. */ dispose(): void; handleInput(data: string): void; private openSubMenu; private handleSubMenuInput; private executeAction; private doSetServerDisabled; private doReloadAll; private doReconnectServer; private doAuthenticateServer; private doCancelAuthentication; private showToolList; private showError; private showLogs; } //# sourceMappingURL=mcp-selector.d.ts.map