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.
31 lines • 1.57 kB
TypeScript
import type { MiddlewareHandler } from "hono";
/**
* Detects if a middleware is Express/Connect style or Hono style
*
* Express/Connect middleware: (req, res, next) => void or (err, req, res, next) => void
* Hono middleware: (c, next) => Promise<Response | void> or (c, next) => Response | void
*
* @param middleware - The middleware function to check
* @returns true if it's Express/Connect middleware, false if it's Hono middleware
*/
export declare function isExpressMiddleware(middleware: any): boolean;
/**
* Automatically adapts middleware to work with Hono
* Detects if the middleware is Express/Connect style and adapts it accordingly
* If it's already Hono-compatible middleware, returns it as-is
*
* @param middleware - The middleware function (Express/Connect or Hono)
* @param middlewarePath - The path pattern the middleware is mounted at (optional, only used for Express/Connect middleware)
* @returns A Hono middleware function
*/
export declare function adaptMiddleware(middleware: any, middlewarePath?: string): Promise<MiddlewareHandler>;
/**
* Adapts Connect/Express middleware to work with Hono
* Based on @hono/connect approach using node-mocks-http
*
* @param connectMiddleware - The Connect middleware handler
* @param middlewarePath - The path pattern the middleware is mounted at (e.g., "/mcp-use/widgets/*")
* @returns A Hono middleware function
*/
export declare function adaptConnectMiddleware(connectMiddleware: any, middlewarePath: string): Promise<MiddlewareHandler>;
//# sourceMappingURL=connect-adapter.d.ts.map