remote-capable server
The server can be hosted and run remotely because it primarily relies on remote services or has no dependency on the local environment.
Integrations
Adapts the MCP TypeScript SDK to work with AWS Lambda functions, supporting Server-Sent Events through Lambda response streaming and function URLs
Provides MCP server infrastructure specifically designed for Node.js runtime in AWS Lambda, with official support for response streaming
Offers full TypeScript support for implementing MCP servers with type definitions and interfaces
MCP Lambda SAM
Model Context Protocol (MCP) implementation using AWS Lambda and SAM.
Overview
This project provides a serverless implementation of the Model Context Protocol, with two distinct interfaces:
- System Configuration (Administrative):
- Registration of MCP tools, resources, and prompts
- IAM permission management
- Infrastructure setup and configuration
- System Usage (Client):
- Establishing SSE connections
- Sending commands
- Receiving streaming responses
Architecture
Mermaid Diagram
You can visualize the system using this Mermaid syntax:
- The MCP Lambda reads registrations from the Registration Table on startup and when handling requests.
- It uses the Session Table to persist session state.
- It invokes registered Lambda tools dynamically using the ARNs stored in the Registration Table.
System Configuration Guide (Administrators)
This section is for system administrators who need to configure and manage the MCP server.
Deployment
The command will interactively prompt for administrative configuration:
- Stack name (for multiple instances)
- AWS Region
- VPC configuration (optional)
Permissions Overview
To access MCP endpoints, users and clients must have IAM permission to invoke the relevant Function URLs.
- Administrators: must be allowed to invoke the
mcp-registration
function URL - Clients: must be allowed to invoke the
mcp
function URL
You can grant access using either an IAM policy or aws lambda add-permission
(see below).
Assigning Permissions via AWS CLI
To grant permission to invoke the registration function URL:
To grant permission to invoke the MCP function URL (SSE and message):
Replace <registration-function-name>
and <mcp-function-name>
with the actual Lambda function names.
Registration API
Use these endpoints to manage MCP tools, resources, and prompts:
Register a New Tool
Update Registration
Delete Registration
List Registrations
Required IAM Permissions
For Administrators
Administrators need these permissions to manage registrations:
System Usage Guide (Clients)
This section is for clients who want to use the MCP server.
Required IAM Permissions
Clients need these permissions to use the MCP server:
Connecting to the Server
- Establish SSE Connection:
Example cURL for SSE
The first event will include a sessionId
. Use this when sending messages.
- Send Commands:
Error Handling
Common Client Errors
401
: Invalid/missing AWS credentials403
: Insufficient permissions404
: Invalid session ID429
: Rate limit exceeded
Troubleshooting
- Connection Issues:
- Verify AWS credentials
- Check IAM permissions
- Ensure network connectivity
- Command Execution Errors:
- Verify session ID is active
- Check command format matches tool registration
- Ensure parameters match schema
Requirements
- AWS CLI installed and configured
- AWS SAM CLI installed
- Node.js 20.x or later
- An AWS account with permissions to create:
- Lambda functions
- DynamoDB tables
- IAM roles
- SQS queues
AWS SAM CLI Setup
To deploy this application locally or to AWS using the AWS SAM CLI:
- Install the AWS SAM CLI: https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/install-sam-cli.html
- Ensure it's available in your PATH:Copy
- Build and deploy the application:Copy
- Follow the prompts to configure the stack name, region, capabilities, and parameter overrides.
You can rerun sam deploy
without --guided
to use saved configuration.
Installation
You can install and deploy this application in four ways:
1. Using AWS Serverless Application Repository (SAR)
The easiest way to deploy the MCP server is through the AWS Serverless Application Repository (SAR):
- Go to the SAR Console
- Search for mcp-lambda-sam by Mark Van Proctor
- Click Deploy
- Set your parameters:
StackIdentifier
: Unique ID for this MCP server instanceVpcEnabled
: Set totrue
if deploying in a VPCVpcId
andSubnetIds
: Provide only ifVpcEnabled
istrue
- Follow the prompts to deploy
Alternatively, you can deploy from the AWS CLI:
2. Using npx (CLI)
The command will interactively prompt for administrative configuration:
- Stack name (for multiple instances)
- AWS Region
- VPC configuration (optional)
3. Programmatic Usage with Install
Install the package:
After installing the package, you can use it programmatically:
4. Local Development and Deployment
Install the package:
After making development changes, you can deploy it manually:
Development
Publishing to SAR
If you're contributing to this project and need to publish updates to SAR:
- Package the application:
- Publish to SAR:
- Make the application public (one-time setup):
- Go to AWS Console > Serverless Application Repository
- Select the application
- Click "Share" and choose "Public"
- Apply the following sharing policy:
Copy
License
MIT
Contributing
- Fork the repository
- Create your feature branch
- Commit your changes
- Push to the branch
- Create a new Pull Request
This server cannot be installed
A Node.js package that provides Model Context Protocol server infrastructure for AWS Lambda functions with SSE support, enabling developers to implement MCP tools and prompts as serverless functions.