UNPKG

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.

52 lines 2.04 kB
/** * Server Lifecycle Utilities * * Runtime-aware helpers for server startup, path rewriting, and CORS handling. */ import type { Hono as HonoType } from "hono"; export declare function isProductionMode(): boolean; /** * Get Deno-specific CORS headers * * @returns CORS headers object for Deno responses */ export declare function getDenoCorsHeaders(): Record<string, string>; /** * Apply CORS headers to a response * * @param response - The response to add CORS headers to * @returns New response with CORS headers applied */ export declare function applyDenoCorsHeaders(response: Response): Response; /** * Create a Supabase path rewriter function * * Supabase includes the function name in the path (e.g., /functions/v1/mcp-server/mcp or /mcp-server/mcp) * This function strips the function name prefix to get the actual route path. * * @returns Function that rewrites Supabase paths to actual route paths */ export declare function createSupabasePathRewriter(): (pathname: string) => string; /** * Rewrite request path for Supabase environment * * @param req - The original request * @returns New request with rewritten path if needed */ export declare function rewriteSupabaseRequest(req: Request): Request; /** * Start the server based on runtime environment * * @param app - Hono application instance * @param port - Port number to listen on * @param host - Hostname to bind to * @param options - Additional options for server startup * @param options.onDenoRequest - Optional callback to transform requests in Deno (e.g., for path rewriting) * @param options.onDenoResponse - Optional callback to transform responses in Deno (e.g., for CORS) * @returns Promise that resolves when server is started */ export declare function startServer(app: HonoType, port: number, host: string, options?: { onDenoRequest?: (req: Request) => Request | Promise<Request>; onDenoResponse?: (res: Response) => Response | Promise<Response>; }): Promise<void>; //# sourceMappingURL=server-lifecycle.d.ts.map