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.07 kB
TypeScript
/**
* 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 provided Hono application as an HTTP server for the current runtime.
*
* @param app - Hono application instance to serve
* @param port - Port number to listen on
* @param host - Hostname to bind to
* @param options - Optional runtime-specific hooks
* @param options.onDenoRequest - Transform an incoming Deno `Request` before it is passed to the application
* @param options.onDenoResponse - Transform a Deno `Response` before it is returned (if omitted, default CORS headers are applied)
* @returns Nothing.
*/
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