Get the FREE Ultimate OpenClaw Setup Guide →

serverless s-cdk

Sample implementations of MCP Servers running on AWS Serverless compute Resources

Installation
Run this command in your terminal to add the MCP server to Claude Code.
Run in terminal:
Command
claude mcp add --transport stdio huanshenyi-serverless-mcp-servers-cdk aws cloudformation deploy --stack-name ServerlessMcpServersCdkStack --region us-east-1 \
  --env AWS_REGION="us-east-1" \
  --env AWS_PROFILE="your-aws-profile"

How to use

This MCP server is deployed as a serverless stack on AWS using CDK, running MCP logic inside Lambda and exposing an API through API Gateway. It provides two implementations: a Hono-based TypeScript MCP server (recommended) and an optional Express.js MCP server. The MCP client and testing utilities live under the src folder, allowing you to exercise MCP tools and resources against the deployed endpoint or a local mock. After deployment, you can test the remote MCP endpoint via the included client scripts, or configure Claude & Cursor to point at either localhost or the remote API Gateway URL. The Bearer token authentication option can be enabled to protect the MCP endpoints by setting MCP_AUTH_TOKEN in environment variables and passing the token in requests via the client or CLI.

How to install

Prerequisites:

  • AWS CLI configured with appropriate permissions
  • Node.js 22.x and npm
  • AWS CDK installed and bootstrapped for your account

Installation steps:

  1. Install the main project dependencies npm install

  2. Install MCP client and server dependencies

    • MCP client (cd src/js/mcpclient && npm install)
    • Hono TypeScript MCP server (recommended) (cd src/ts/mcpserver && npm install)
    • Express.js MCP server (optional) (cd src/js/mcpserver && npm install)
  3. Bootstrap CDK (if not already bootstrapped) cdk bootstrap aws://<account-id>/us-east-1

  4. Build and deploy the Hono-based MCP server (recommended) (cd src/ts/mcpserver && npm run build) npm run build cdk deploy --region us-east-1

  5. Verify deployment and test locally or remotely using the MCP client and sample configuration provided in the repository.

Additional notes

Notes and tips:

  • The CDK stack deploys a Lambda-backed MCP server behind API Gateway. The primary endpoint is us-east-1 and may take about a minute to become available after deployment.
  • Hono is the recommended MCP server implementation; if you switch to the Express.js version, adjust the CDK stack to package the Express server code instead.
  • Bearer token authentication can be enabled by setting MCP_AUTH_TOKEN in the environment (local dev, or Lambda environment variables in the CDK stack). Ensure your clients supply the Authorization header with a valid token.
  • For local testing of the client and server, you can run the Hono TypeScript server locally (npm run dev in the ts/mcpserver directory) or run the Express server locally (node src/js/mcpserver/index.js).
  • If you plan to switch between Hono and Express implementations, follow the documentation in the README to modify the CDK stack code to point to the correct asset (dist for Hono, or the Express build directory).
  • API Gateway may take a short time to become available after deployment; if requests fail, retry after a minute.

Related MCP Servers

Sponsor this space

Reach thousands of developers