-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Description
🚀 Summary
The MCP SDK currently requires Express.js, which
doesn't support AWS Lambda's streaming capabilities.
We need a native Lambda transport to enable real-time
streaming responses in serverless deployments.
🔴 The Problem
When deploying MCP servers to AWS Lambda, we face a
critical limitation:
- Current SDK: Requires StreamableHTTPServerTransport
→ needs Express.js - Express + Lambda: Must use serverless-express →
doesn't support streaming - Result: Can't stream responses, limiting real-time
capabilities
💡 Proposed Solution
Add a native LambdaServerTransport to the MCP SDK:
import { LambdaServerTransport } from
'@modelcontextprotocol/sdk/server/lambda.js';
export const handler =
awslambda.streamifyResponse(async (event,
responseStream) => {
const transport = new LambdaServerTransport(event,
responseStream);
const server = new Server({ name: 'my-mcp-server',
version: '1.0.0' });
await server.connect(transport);
// Register your handlers here
await transport.start();
});
✨ Key Benefits
- 🚄 Native Streaming: Use Lambda's response streaming
for real-time updates - ⚡ Better Performance: No Express overhead = faster
cold starts - 🎯 Simpler Deploy: Direct Lambda handler, no
middleware needed - 💰 Cost Effective: Stream responses instead of
buffering in memory
🛠️ Technical Requirements
The transport should handle:
- Lambda Function URL events
- AWS ResponseStream API
- Stateless operation (one request per invocation)
- Proper error responses
- CloudWatch-friendly logging
🌟 Impact
This would make AWS Lambda a first-class deployment
option for MCP servers, enabling:
- Real-time tool responses
- Progressive data streaming
- Modern serverless architectures
- Simplified deployments
Note: We've already built a working implementation
that proves this approach works. Native SDK support
would benefit the entire MCP community.
Here's the gist: https://gist.github.com/mapstack-chris/92d122cd517a5090032fe2a7c74587bb