UNPKG

middy-mcp

Version:

Middy middleware for Model Context Protocol server

15 lines (14 loc) 787 B
import type middy from "@middy/core"; import type { ALBEvent, ALBResult, APIGatewayProxyEvent, APIGatewayProxyEventV2, APIGatewayProxyResult, APIGatewayProxyResultV2, Context } from "aws-lambda"; import { type JSONRPCMessage } from "@modelcontextprotocol/sdk/types.js"; import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js"; type RequestEvent = APIGatewayProxyEvent | APIGatewayProxyEventV2 | ALBEvent; type ResponseEvent = APIGatewayProxyResult | APIGatewayProxyResultV2 | ALBResult; type RequestContext = Context & { jsonRPCMessages: JSONRPCMessage[]; }; type MCPMiddlewareOptions = { server: McpServer; }; declare const mcp: ({ server, }: MCPMiddlewareOptions) => middy.MiddlewareObj<RequestEvent, ResponseEvent, Error, RequestContext>; export default mcp;