βοΈ
Fastmcp Lambda
Production-ready MCP server for AWS Lambda. Deploy FastMCP with Lambda Web Adapter using the included deployment script.
0 installs
Trust: 34 β Low
Cloud
Ask AI about Fastmcp Lambda
Powered by Claude Β· Grounded in docs
I know everything about Fastmcp Lambda. Ask me about installation, configuration, usage, or troubleshooting.
0/500
Loading tools...
Reviews
Documentation
MCP FastMCP Server
An MCP (Model Context Protocol) server built with FastMCP, optimized for AWS Lambda deployment using the Lambda Web Adapter.
Features
- Serverless Ready: Optimized for AWS Lambda with
stateless_http=True - Lambda Web Adapter: Uses AWS Lambda Web Adapter for seamless Lambda integration
- Streamable HTTP: Uses
streamable-httptransport for MCP over HTTP - Multiple Tools: Includes greeting, math operations, and server details tools
- Resources & Prompts: Includes sample resources and prompts
- One-Click Deployment: Automated deployment script for AWS Lambda
Quick Start
1. Clone and Deploy to AWS Lambda
# Clone the repository
git clone https://github.com/mishramohit437/fastmcp-lambda.git
cd fastmcp-lambda
# Configure AWS CLI (first time only)
aws configure
# Deploy to AWS Lambda
./deploy_lambda.sh
The script will:
- Build the Docker image
- Push to Amazon ECR
- Create Lambda function
- Create Function URL
- Output your MCP endpoint
2. Configure Claude Desktop
Add to your MCP configuration (mcp.json or claude_desktop_config.json):
{
"mcpServers": {
"fastmcp-lambda": {
"url": "YOUR_FUNCTION_URL/mcp",
"transport": "streamable-http"
}
}
}
Replace YOUR_FUNCTION_URL with the URL output by the deployment script.
Local Development
# Install dependencies
pip install fastmcp
# Run in stdio mode (for local Claude Desktop testing)
python -m mcp_fast_mcp.server --stdio
# Run in HTTP mode (for web testing)
python -m mcp_fast_mcp.server --port 8080
Using Docker
# Build and run with Docker Compose
docker-compose up --build
# Or build manually
docker build -t mcp-fast-mcp .
docker run -p 8080:8080 mcp-fast-mcp
Available Tools
| Tool | Description |
|---|---|
hello_world | A simple hello world tool for testing |
get_server_details | Returns server environment details |
greet | Greet someone by name |
add | Add two numbers together |
multiply | Multiply two numbers together |
Resources
| Resource | Description |
|---|---|
greeting://hello | A simple greeting resource |
Prompts
| Prompt | Description |
|---|---|
greet_prompt | Generate a greeting prompt for a given name |
AWS Deployment
For detailed deployment instructions, see DEPLOYMENT.md.
Prerequisites
- AWS Account with appropriate permissions
- AWS CLI installed and configured
- Docker installed
Quick Deploy
# Make script executable (if needed)
chmod +x deploy_lambda.sh
# Deploy with default region (eu-north-1)
./deploy_lambda.sh
# Or specify your region
AWS_REGION=us-east-1 ./deploy_lambda.sh
Architecture
Client β Lambda Function URL β Lambda Web Adapter β FastMCP Server β Response
(HTTPS) (Container) (streamable-http)
Components:
- ECR: Container registry for Docker images
- Lambda: Serverless compute running FastMCP
- Function URL: Direct HTTPS endpoint
- IAM Role: Basic execution role with CloudWatch logs
Configuration
Key Settings
| Setting | Value | Description |
|---|---|---|
| PORT | 8080 | Server port (Lambda Web Adapter default) |
| Transport | streamable-http | MCP transport for Lambda compatibility |
| Stateless | True | Serverless optimization |
| Platform | linux/amd64 | Lambda architecture |
Environment Variables
| Variable | Default | Description |
|---|---|---|
| PORT | 8080 | Server port |
| HOST | 0.0.0.0 | Server host |
| AWS_REGION | eu-north-1 | AWS region for deployment |
Development
Project Structure
fastmcp-lambda/
βββ mcp_fast_mcp/
β βββ __init__.py
β βββ server.py # Main server with tools
βββ Dockerfile # Lambda Web Adapter setup
βββ deploy_lambda.sh # Deployment script
βββ docker-compose.yml # Local Docker testing
βββ DEPLOYMENT.md # Detailed AWS deployment guide
βββ pyproject.toml # Project config
βββ README.md # This file
Adding New Tools
@mcp.tool()
def your_tool(param: str) -> str:
"""Tool description."""
return f"Result: {param}"
Adding New Resources
@mcp.resource("your-resource://path")
def your_resource() -> str:
"""Resource description."""
return "Resource content"
Maintenance
Update the Deployment
# Make changes to your code
# Rebuild and redeploy
./deploy_lambda.sh
View Logs
# CloudWatch Logs (replace with your region)
aws logs tail /aws/lambda/mcp-fast-mcp --region us-east-1 --follow
Cost Estimation
| Service | Free Tier | Paid |
|---|---|---|
| Lambda Requests | 1M requests/month | $0.20 per 1M requests |
| Lambda Duration | 400K GB-seconds/month | $0.00001667/GB-second |
| Function URL | 1M requests/month | $0.20 per 1M requests |
Estimated cost for 10K requests/month: ~$0 (within free tier)
License
MIT
