import { AppProtocol, AppToolDefinition, AppCSPConfig, AppPermissionsConfig, AppUIResourceMeta } from './types.js'; import { ResourceContent, ResourceDefinition } from '../resources/BaseResource.js'; /** UI configuration for an MCPApp. */ export interface AppUIConfig { /** URI for this app's UI resource. Must start with "ui://". */ resourceUri: string; /** Human-readable name for the UI resource. */ resourceName: string; /** Optional description of the UI. */ resourceDescription?: string; /** CSP configuration for the iframe sandbox. */ csp?: AppCSPConfig; /** Browser permissions needed by the app. */ permissions?: AppPermissionsConfig; /** Whether the host should render a visible border. */ prefersBorder?: boolean; } /** * Base class for standalone MCP Apps (Mode A). * * Bundles UI configuration, HTML content, and associated tool definitions * into a single auto-discoverable class. Place subclasses in `src/apps/`. * * @example * ```typescript * class DashboardApp extends MCPApp { * name = "dashboard"; * ui = { * resourceUri: "ui://dashboard/view", * resourceName: "Dashboard", * }; * getContent() { return readFileSync("./dashboard.html", "utf-8"); } * tools = [{ * name: "show_dashboard", * description: "Show the dashboard", * schema: z.object({ range: z.string().describe("Time range") }), * execute: async (input) => fetchData(input.range), * }]; * } * ``` */ export declare abstract class MCPApp implements AppProtocol { /** Unique identifier for this app. */ abstract name: string; /** UI configuration (resource URI, name, CSP, permissions). */ abstract ui: AppUIConfig; /** Tools associated with this app. At least one is required. */ abstract tools: AppToolDefinition[]; /** Return the HTML content for the UI resource. */ abstract getContent(): Promise | string; /** Validates app configuration. Called by MCPServer at startup. */ validate(): void; /** Returns the MCP resource definition for this app's UI. */ get resourceDefinition(): ResourceDefinition; /** Returns the _meta.ui metadata for resource content, or undefined if none. */ get resourceMeta(): AppUIResourceMeta | undefined; /** Reads HTML content and returns it as MCP ResourceContent. */ readResource(): Promise; /** Returns the _meta.ui object for a tool definition. */ getToolMeta(toolName: string): { ui: { resourceUri: string; visibility?: Array; }; }; }