UNPKG

mcp-web-ui

Version:

Ultra-lightweight vanilla JavaScript framework for MCP servers - Zero dependencies, perfect security, 2-3KB bundle size

66 lines 2.05 kB
/** * ResourceManager - Configuration-driven resource loading * Replaces hardcoded CSS/JS loading in UIServer with flexible, schema-driven approach * Now supports CSS living with MCP servers instead of in framework */ import { UIServerConfig } from './UIServerConfig.js'; import { UISchema } from '../types/index.js'; export interface LoadedResources { css: string[]; javascript: string[]; inlineCSS: string; preloadLinks: string[]; } export declare class ResourceManager { private config; private projectRoot; private staticBasePath; constructor(config: UIServerConfig, projectRoot: string, staticBasePath?: string); /** * Determine which resources to load based on UI schema * This replaces hardcoded resource loading */ getRequiredResources(schema: UISchema): LoadedResources; /** * Schema-driven theme CSS loading from MCP server * Simple: always load styles.css if MCP CSS directory is configured * Uses configurable static base path for gateway proxy compatibility */ private getThemeCSS; /** * Dynamic JavaScript loading based on schema requirements */ private getRequiredJavaScript; /** * Generate inline CSS for runtime customization */ private generateInlineCSS; /** * Check if schema matches theme conditions */ private matchesThemeConditions; /** * Generate component-specific CSS */ private getComponentCSS; /** * Generate preload links for performance */ private generatePreloadLinks; /** * Bundle JavaScript files for single request */ bundleJavaScript(schema: UISchema): Promise<string>; /** * Get all CSS content for bundling from MCP server directories */ bundleCSS(schema: UISchema): Promise<string>; /** * Validate that all required resources exist */ validateResources(schema: UISchema): { valid: boolean; missing: string[]; }; } //# sourceMappingURL=ResourceManager.d.ts.map