cdk-serverless-mcp-server
Provides an HTTP endpoint for the MCP server, exposing it via a REST API.
Hosts and runs the MCP server logic as a serverless function.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@cdk-serverless-mcp-serveradd 10 and 15"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
π§ cdk-serverless-mcp-server
A super simple Model Context Protocol (MCP) server deployed on AWS Lambda and exposed via Amazon API Gateway, deployed with AWS CDK. This skeleton is based on the awesome work of FrΓ©dΓ©ric Barthelet: which has developed a middy middleware for Model Context Protocol (MCP) server integration with AWS Lambda functions in this repo
Long story
Related MCP server: Serverless MCP Server
π Features
πͺ Minimal MCP server setup using @modelcontextprotocol/sdk
π Deployed as a single AWS Lambda function
π HTTP POST endpoint exposed via API Gateway at /mcp
π Supports local development testing with jest
π§ͺ Includes a simple example tool (add) with JSON-RPC interaction
π¦ Project Structure
cdk-serverless-mcp-server/
βββ __tests__/ # Jest tests
βββ bin/ # CDK entry point
βββ cdk-serverless-mcp-server.ts # CDK app
βββ lib/ # CDK stack
β βββ cdk-serverless-mcp-server-stack.ts # CDK stack
βββ src/ # Source code
β βββ index.mjs # MCP server handler
βββ .gitignore # Git ignore file
βββ cdk.json # CDK Project config
βββ package.json # Project dependencies
βββ package-lock.json # Project lock file
βββ README.md # This documentation fileπ Prerequisites
Node.js v22+
AWS CDK v2+
π Getting Started
Install dependencies:
npm installInstall AWS CDK globally (if not already installed):
npm install -g aws-cdkTest Locally with jest
npm run test𧬠Code Breakdown
This code is based on the awesome work of FrΓ©dΓ©ric Barthelet: which has developed a middy middleware for Model Context Protocol (MCP) server integration with AWS Lambda functions in this repo
src/index.js
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";
const server = new McpServer({
name: "Lambda hosted MCP Server",
version: "1.0.0",
});
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());π‘ Deploy to AWS
Just run:
npm run layer-dependencies-install # install dependencies for the layerThen, deploy the stack:
cdk bootstrap
cdk deployAfter deployment, the MCP server will be live at the URL output by the command.
π§ͺ Once deployed, test with curl requests
List tools
curl --location 'http://your-endpoint/dev/mcp' \
--header 'content-type: application/json' \
--header 'accept: application/json' \
--header 'jsonrpc: 2.0' \
--data '{
"jsonrpc": "2.0",
"method": "tools/list",
"id": 1
}'β Use the add Tool
curl --location 'http://your-endpoint/dev/mcp' \
--header 'content-type: application/json' \
--header 'accept: application/json' \
--header 'jsonrpc: 2.0' \
--data '{
"jsonrpc": "2.0",
"id": 2,
"method": "tools/call",
"params": {
"name": "add",
"arguments": {
"a": 5,
"b": 3
}
}
}'π License
MIT β feel free to fork, tweak, and deploy your own version!
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Latest Blog Posts
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/eleva/cdk-serverless-mcp-server'
If you have feedback or need assistance with the MCP directory API, please join our Discord server