/** * MCP Body Attachment Middleware for Fastify * Attaches parsed body to raw request for MCP SDK compatibility */ import type { MiddlewareDefinition } from "../../types/index.js"; /** * Create MCP body attachment middleware for Fastify. * The MCP SDK reads body from request.raw.body, but Fastify * parses body separately. This middleware bridges the gap. * * @returns Middleware that attaches body to raw request * * @example * ```typescript * // In Fastify adapter * const mcpBodyMiddleware = createMCPBodyAttachmentMiddleware(); * server.registerMiddleware(mcpBodyMiddleware); * ``` */ export declare function createMCPBodyAttachmentMiddleware(): MiddlewareDefinition; /** * Fastify-specific preHandler hook. * Use this directly with Fastify for optimal integration. * * This is a lower-level hook that works directly with Fastify * request objects rather than the unified ServerContext. * * @param request - Fastify request object * @returns Promise that resolves when body is attached * * @example * ```typescript * // In Fastify adapter initialization * fastify.addHook('preHandler', fastifyMCPBodyHook); * ``` */ export declare function fastifyMCPBodyHook(request: { raw: { body?: unknown; }; body?: unknown; }): Promise;