import type { StdioClientTransport } from "@modelcontextprotocol/sdk/client/stdio.js"; import type { SSEClientTransport } from "@modelcontextprotocol/sdk/client/sse.js"; import type { StreamableHTTPClientTransport } from "@modelcontextprotocol/sdk/client/streamableHttp.js"; import type { TextContent, ImageContent } from "../sdk/ai/index.js"; import type { UiStreamMode } from "./ui-stream-types.js"; export type Transport = StdioClientTransport | SSEClientTransport | StreamableHTTPClientTransport; export type ImportKind = "cursor" | "claude-code" | "claude-desktop" | "codex" | "windsurf" | "vscode"; export interface McpTool { name: string; title?: string; description?: string; inputSchema?: unknown; _meta?: Record; } export interface McpResource { uri: string; name: string; description?: string; mimeType?: string; _meta?: Record; } export interface UiResourceMeta { csp?: UiResourceCsp; permissions?: UiResourcePermissions; domain?: string; prefersBorder?: boolean; } export interface UiResourceContent { uri: string; html: string; mimeType?: string; meta: UiResourceMeta; } export interface UiProxyRequestBody { token: string; params: TParams; } export interface UiProxyResult> { ok: boolean; result?: T; error?: string; } export interface UiResourceCsp { connectDomains?: string[]; scriptDomains?: string[]; styleDomains?: string[]; fontDomains?: string[]; imgDomains?: string[]; mediaDomains?: string[]; frameDomains?: string[]; workerDomains?: string[]; baseUriDomains?: string[]; } export interface UiResourcePermissions { camera?: {}; microphone?: {}; geolocation?: {}; clipboardWrite?: {}; } export interface UiToolInfo { id?: string | number; tool: { name: string; description?: string; inputSchema?: unknown; }; } export interface UiHostContext { toolInfo?: UiToolInfo; theme?: "light" | "dark"; styles?: Record; displayMode?: UiDisplayMode; availableDisplayModes?: UiDisplayMode[]; containerDimensions?: { width?: number; maxWidth?: number; height?: number; maxHeight?: number; }; [key: string]: unknown; } export type UiDisplayMode = "inline" | "fullscreen" | "pip"; export { UI_STREAM_HOST_CONTEXT_KEY, UI_STREAM_REQUEST_META_KEY, UI_STREAM_RESULT_PATCH_METHOD, SERVER_STREAM_RESULT_PATCH_METHOD, UI_STREAM_STRUCTURED_CONTENT_KEY, uiStreamModeSchema, visualizationStreamPhaseSchema, visualizationStreamFrameTypeSchema, visualizationStreamStatusSchema, uiStreamHostContextSchema, visualizationStreamEnvelopeSchema, uiStreamCallToolResultSchema, uiStreamResultPatchNotificationSchema, serverStreamResultPatchNotificationSchema, getUiStreamHostContext, getVisualizationStreamEnvelope, type UiStreamMode, type VisualizationStreamPhase, type VisualizationStreamFrameType, type VisualizationStreamStatus, type UiStreamHostContext, type VisualizationStreamEnvelope, type UiStreamCallToolResult, type UiStreamResultPatchNotification, type ServerStreamResultPatchNotification, type UiStreamSummary, } from "./ui-stream-types.js"; export interface UiMessageParams { role?: string; content?: unknown[]; type?: "prompt" | "notify" | "intent" | "message"; message?: string; prompt?: string; intent?: string; params?: Record; [key: string]: unknown; } /** * Extract prompt text from either legacy MCP UI message shapes or native AppBridge user messages. */ export declare function extractUiPromptText(params: UiMessageParams): string | undefined; /** * Structured UI handoff recovered from a canonical prompt envelope. */ export interface UiPromptHandoff { intent: string; params: Record; raw: string; } /** * Parse a canonical named UI handoff encoded as `intent\n{json}`. */ export declare function parseUiPromptHandoff(prompt: string): UiPromptHandoff | undefined; /** * Accumulated messages from a UI session. * Collected during the session and available when it ends. */ export interface UiSessionMessages { prompts: string[]; notifications: string[]; intents: Array<{ intent: string; params?: Record; }>; } export interface UiModelContextParams { content?: unknown[]; structuredContent?: Record; [key: string]: unknown; } export interface UiOpenLinkResult { isError?: boolean; [key: string]: unknown; } export interface UiDisplayModeRequest { mode?: UiDisplayMode; } export interface UiDisplayModeResult { mode: UiDisplayMode; [key: string]: unknown; } export interface McpContent { type: "text" | "image" | "audio" | "resource" | "resource_link"; text?: string; /** * Hosted image reference. MCP servers that upload screenshots to storage * return `url` instead of inline base64 `data`. */ url?: string; data?: string; mimeType?: string; resource?: { uri: string; text?: string; blob?: string; }; uri?: string; name?: string; description?: string; } export type ContentBlock = TextContent | ImageContent; export interface OAuthConfig { /** OAuth grant type (defaults to authorization_code) */ grantType?: "authorization_code" | "client_credentials"; /** Pre-registered client ID (optional, dynamic registration used if not provided) */ clientId?: string; /** Client secret for confidential clients */ clientSecret?: string; /** Requested OAuth scopes */ scope?: string; /** * Custom redirect URI for OAuth callback. * If not provided, defaults to http://localhost:{port}/callback * When set, the callback server will bind to the port specified in the URI * and accept callbacks on the specified path. */ redirectUri?: string; } export interface ServerEntry { command?: string; args?: string[]; env?: Record; cwd?: string; url?: string; headers?: Record; /** * Authentication type: * - 'oauth' - Use OAuth 2.1 (auto-discovers endpoints, supports dynamic client registration) * - 'bearer' - Use static Bearer token * - false - Disable authentication * If not specified and url is present, OAuth will be auto-detected */ auth?: "oauth" | "bearer" | false; bearerToken?: string; bearerTokenEnv?: string; /** * OAuth configuration (optional). * If not provided, the SDK will attempt dynamic client registration. * Set to false to explicitly disable OAuth for this server. */ oauth?: OAuthConfig | false; lifecycle?: "keep-alive" | "lazy" | "eager"; idleTimeout?: number; exposeResources?: boolean; directTools?: boolean | string[]; excludeTools?: string[]; debug?: boolean; } export interface McpSettings { toolPrefix?: "server" | "none" | "short"; idleTimeout?: number; directTools?: boolean; disableProxyTool?: boolean; autoAuth?: boolean; sampling?: boolean; samplingAutoApprove?: boolean; /** * Message returned in tool results when a server needs (re-)authentication. * "${server}" is substituted with the server name. Defaults to a TUI * instruction when unset. */ authRequiredMessage?: string; } export interface McpConfig { mcpServers: Record; imports?: ImportKind[]; settings?: McpSettings; } export type ServerDefinition = ServerEntry; export interface ToolMetadata { name: string; originalName: string; description: string; resourceUri?: string; uiResourceUri?: string; inputSchema?: unknown; uiStreamMode?: UiStreamMode; } export interface DirectToolSpec { serverName: string; originalName: string; prefixedName: string; description: string; inputSchema?: unknown; resourceUri?: string; uiResourceUri?: string; uiStreamMode?: UiStreamMode; } export interface ServerProvenance { path: string; kind: "user" | "project" | "import"; importKind?: string; } export interface McpPanelCallbacks { reconnect: (serverName: string) => Promise; getConnectionStatus: (serverName: string) => "connected" | "idle" | "failed" | "needs-auth"; refreshCacheAfterReconnect: (serverName: string) => import("./metadata-cache.js").ServerCacheEntry | null; } export interface McpPanelResult { changes: Map; cancelled: boolean; } /** * Get server prefix based on tool prefix mode. */ export declare function getServerPrefix(serverName: string, mode: "server" | "none" | "short"): string; /** * Format a tool name with server prefix. */ export declare function formatToolName(toolName: string, serverName: string, prefix: "server" | "none" | "short"): string; export declare function isToolExcluded(toolName: string, serverName: string, prefix: "server" | "none" | "short", excludeTools?: unknown): boolean; //# sourceMappingURL=types.d.ts.map