SSE를 지원하는 AWS Lambda 함수에 대한 MCP(Model Context Protocol) 서버 인프라를 제공하는 Node.js 패키지입니다.
Lambda 함수를 만들고 패키지를 가져옵니다.
import { MCPHandlerFactory } from '@markvp/mcp-lambda-layer';
import { z } from 'zod';
// Create MCP handler factory with your configuration
const factory = new MCPHandlerFactory({
tools: {
summarize: {
params: {
text: z.string(),
},
handler: async ({ text }) => {
// Your implementation here - could be any service/model/API
const summary = await yourSummarizeImplementation(text);
return {
content: [{ type: 'text', text: summary }],
};
},
},
},
prompts: {
generate: {
description: 'Generate content based on a prompt',
handler: async extra => {
// Your implementation here - could be any service/model/API
const result = await yourGenerateImplementation(extra.prompt);
return {
content: [{ type: 'text', text: result }],
};
},
},
},
});
// Export the handler directly
export const handler = factory.getHandler();
이 패키지에는 다음이 포함되어 있습니다.
Lambda 함수는 다음을 제공합니다.