mcp-use
Version:
Opinionated MCP Framework for TypeScript (@modelcontextprotocol/sdk compatible) - Build MCP Agents, Clients and Servers with support for ChatGPT Apps, Code Mode, OAuth, Notifications, Sampling, Observability and more.
26 lines • 1.8 kB
TypeScript
/**
* Development mode widget mounting with Vite HMR
*
* This module handles serving widgets from the resources/ directory in development mode
* with hot module replacement (HMR) support. It uses Vite to transform and serve
* React/TSX widget files with live reloading during development.
*/
import type { Hono as HonoType } from "hono";
import type { ServerConfig, MountWidgetsOptions, RegisterWidgetCallback } from "./widget-types.js";
/**
* Configuration for development widget mounting
*/
export type MountWidgetsDevOptions = MountWidgetsOptions;
/**
* Mounts local widget sources under the project's resources directory into a shared Vite dev server with HMR so they can be served and inspected during development.
*
* Discovers top-level `.tsx`/`.ts` widget files and folders containing `widget.tsx`, generates per-widget temporary entry and HTML files under `.mcp-use`, starts a single Vite middleware server that watches the resources directory for changes, and registers each widget via the provided callback for MCP-UI compatibility.
*
* @param app - Hono application instance to mount middleware and routes onto
* @param serverConfig - Server configuration (base URL, port, CSP, favicon, etc.) used to configure routes and Vite origin
* @param registerWidget - Callback invoked to register each discovered widget with the running server
* @param options - Optional overrides: `baseRoute` to change the mount path (default: `/mcp-use/widgets`) and `resourcesDir` to change the scanned resources directory (default: `resources`)
* @returns Nothing.
*/
export declare function mountWidgetsDev(app: HonoType, serverConfig: ServerConfig, registerWidget: RegisterWidgetCallback, options?: MountWidgetsDevOptions): Promise<void>;
//# sourceMappingURL=mount-widgets-dev.d.ts.map