Middy middleware for hosting MCP servers on AWS Lambda

Middy middleware for hosting MCP servers on AWS Lambda

sam-serverless-mcp-server•byfredericbarthelet

A Middy middleware that handles Model Context Protocol server requests and responses within AWS Lambda functions, supporting API Gateway and ALB proxy integrations.

License: MIT License•Runtime: Awaiting documentation review•Category: cloud devops

WHAT IT DOES

  • •Wires a Model Context Protocol server into a Middy-based Lambda handler through the mcpMiddleware.
  • •Handles MCP requests sent to AWS Lambda via API Gateway proxy integration or an ALB.
  • •Can throw HTTP exceptions, so it can be paired with the Middy HTTP error handler.

BEST FOR

  • •Developers hosting an MCP server as an AWS Lambda behind API Gateway.
  • •Teams already using the Middy middleware framework who want to expose an MCP server from Lambda.

ABOUT SAM-SERVERLESS-MCP-SERVER

Middy middleware for hosting MCP servers on AWS Lambda is cataloged as an MCP server attributed to fredericbarthelet. A Middy middleware that handles Model Context Protocol server requests and responses within AWS Lambda functions, supporting API Gateway and ALB proxy integrations. It is categorized under cloud devops. See the capability inspector for recorded interfaces and their independent review status; consult upstream documentation for the current interface.

HOW TO INSTALL

Installation configuration is not reviewed. No executable setup is offered for this entry; inspect the source repository before proceeding.

LICENSE

Catalog license label: MIT License. Check the source repository's current license and terms before using, modifying or distributing this software.

Capability inspector

Capability definitions are not reviewed. Unreviewed imports are not exposed as trusted interfaces.

Tools (0)

No reviewed records to display. This does not establish that upstream lacks this capability.

Resources (0)

No reviewed records to display. This does not establish that upstream lacks this capability.

Prompts (0)

No reviewed records to display. This does not establish that upstream lacks this capability.

NEWSLETTER - COMING LATER

Newsletter subscriptions are not open yet

Email delivery is not connected. This page does not collect email addresses or create subscriptions.

Browse the registry for current listings instead.

Community Reviews

Coming later

Reviews for Middy middleware for hosting MCP servers on AWS Lambda are not available yet

Review publishing and storage are not connected. This page does not collect or publish ratings or comments, including after sign-in.

FREQUENTLY ASKED QUESTIONS

What client protocol versions are supported when hosting an MCP server this way?

It is only compatible with MCP clients using at least protocol version 2025-03-26.

What Node.js and Middy versions are required?

Node.js 18.0.0 or later and Middy 6.0.0 or later.

Upstream README

View this exact version on GitHub

README.md · 4371528d76d5 · Fetched 2026-11-13 12:07:59 UTC

Original upstream text, without AI rewriting. Scripts, forms and unsafe links are filtered for safety.

Showing the last retrieved documentation snapshot; check the source for current changes.

Middy MCP

A Middy middleware for Model Context Protocol (MCP) server integration with AWS Lambda functions.

Description

Middy MCP is a middleware that enables seamless integration between AWS Lambda functions and Model Context Protocol servers. It provides a convenient way to handle MCP requests and responses within your Lambda functions using the Middy middleware framework. It supports requests sent to AWS Lambda from API Gateway (both REST API / v1 and HTTP API / v2) using the Proxy integration, as well as requests sent form an ALB.

Disclaimer: hosting your MCP server this way is only compatible with MCP clients using at least protocol version 2025-03-26.

Install

pnpm install middy-mcp

Requirements

  • Node.js >= 18.0.0
  • Middy >= 6.0.0

Usage

This middleware can throw HTTP exceptions, so it can be convenient to use it in combination with the @middy/http-error-handler.

Hereafter is an exemple of a minimal Lambda function handler file. Deploy this lambda as a proxy integration on a POST route of your API Gateway and you're good to go.

import middy from "@middy/core";
import httpErrorHandler from "@middy/http-error-handler";
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
import { z } from "zod";

import mcpMiddleware from "middy-mcp";

// Create an MCP server
const server = new McpServer({
  name: "Lambda hosted MCP Server",
  version: "1.0.0",
});

// Add an addition tool
server.tool("add", { a: z.number(), b: z.number() }, async ({ a, b }) => ({
  content: [{ type: "text", text: String(a + b) }],
}));

export const handler = middy()
  .use(mcpMiddleware({ server }))
  .use(httpErrorHandler());

License

This project is licensed under the MIT License - see the LICENSE file for details.

Contributing

Contributions are welcome! Please feel free to open an issue or to submit a pull request 🚀!

Install configuration

Are you the maintainer?

Claim this server with your GitHub account to request manual ownership verification.

README Embed Badge
Markdown

Link to the catalog listing for Middy middleware for hosting MCP servers on AWS Lambda from your README. This badge does not certify ownership, compatibility or security.

[![MCP catalog listing](https://img.shields.io/badge/MCP-awesome--mcp-orange?style=flat-square)](https://awesome-mcp.com/servers/sam-serverless-mcp-server)

REPOSITORY STATS

GitHub StarsUnavailable
ForksUnavailable

Public repository statistics could not be verified. Check the configured source address; unavailable counts are not zero.

Downloads and pulls

Separate sources, scopes and periods. Never combined or treated as installations, active users or security reviews.

No reviewed package or image identity; download statistics are not listed yet.

Related cloud devops MCP Servers

Alternative and complementary servers in the same category

View all in cloud devops →
Huawei MCP Server
mcp-server-huaweiclouddeveloper•huaweiclouddeveloper

A Model Context Protocol server built on Huawei Cloud services that enables AI assistants to operate Huawei Cloud resources within conversational workflows, supporting ECS, OBS, GaussDB, and other cloud products.

Repository stats unavailable
Cloud & DevOps
Coolify MCP Server
coolify-mcp-server•wrediam

An MCP server that exposes the Coolify v4.3.1 REST API so AI clients can manage applications, databases, services, servers, deployments, and more.

Repository stats unavailable
Cloud & DevOps

A deprecated Model Context Protocol server for interacting with Kong Konnect APIs, enabling AI assistants to query and analyze Kong Gateway configurations, traffic, and analytics.

Repository stats unavailable
Cloud & DevOps