mcp-use TypeScript API
    Preparing search index...

    Type Alias McpMiddlewareFn<Methods, TEnv>

    McpMiddlewareFn: (
        ctx: MiddlewareContext<Methods, TEnv>,
        next: () => Promise<void>,
    ) => Promise<void>

    Type-preserving middleware over every wrapped MCP method.

    The global wildcard cannot inspect or replace a method-specific result. Its next resolves after downstream middleware, and the composer propagates that downstream result unchanged. It must call next() or throw.

    Type Parameters

    Type Declaration