@juspay/neurolink
Version:
Universal AI Development Platform with working MCP integration, multi-provider support, voice (TTS/STT/realtime), and professional CLI. 58+ external MCP servers discoverable, multimodal file processing, RAG pipelines. Build, test, and deploy AI applicatio
43 lines (42 loc) • 1.29 kB
TypeScript
/**
* 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<void>;