Server facts
run-model-context-protocol-servers-with-aws-lambda MCP Server
GitHub stars
385
Last commit
Dec 1, 2026
Runtime
python
License
Apache-2.0
Project
- Author
- awslabs
- License
- Apache-2.0
- Category
- Cloud & DevOps
Tech
- Runtime
- python
- Transports
- streamable-httpstdio
- Remote access
- Yes
- Authentication
- OAuth (Cognito/Okta/Auth0 via API Gateway/AgentCore) or AWS IAM / SigV4
Activity
- GitHub stars
- 385
- Last commit
- Data as of
Overview
Cloud architects researching how to `run with aws lambda mcp` can adapt existing local `stdio` MCP servers into serverless AWS Lambda functions using `awslabs/run-model-context-protocol-servers-with-aws-lambda` (Apache-2.0, published on PyPI as `run-mcp-servers-with-aws-lambda` and on npm as `@aws/run-mcp-servers-with-aws-lambda`). Rather than running long-lived local child processes, each Lambda invocation spawns the packaged `stdio` server subprocess (`python -m ...`, `node ...`, or `npx --offline`—never downloading on demand with `uvx`), initializes MCP, forwards the request, returns the response, and shuts down cleanly. Third-party API keys are supplied via encrypted Lambda environment variables or AWS Secrets Manager, while AWS credentials for wrapped servers must be explicitly forwarded via env vars or `/tmp/.aws/credentials` and scoped with least-privilege IAM policies.
The library provides four connection patterns for Python and TypeScript: standard MCP Streamable HTTP via Amazon API Gateway (`APIGatewayProxyEventHandler`) or Amazon Bedrock AgentCore Gateway (`BedrockAgentCoreGatewayTargetHandler`, paired with OAuth such as Cognito, Okta, or Auth0—compatible with Cursor, Cline, and Claude Desktop, with `scripts/clean-tool-schema.py` normalizing strict AgentCore schemas); and service-to-service IAM-authenticated patterns using Lambda Function URLs (`LambdaFunctionURLEventHandler` with custom SigV4 Streamable HTTP) or the Lambda Invoke API (`stdio_server_adapter` / `stdioServerAdapter`). Because Lambda retains no state across invocations, it fits stateless servers (like time or fetch) rather than stateful sqlite, filesystem, or git servers.
Install & configure
Requirements
- AWS account with AWS Lambda and your chosen front door (Amazon API Gateway, Bedrock AgentCore Gateway, Lambda Function URL, or IAM Lambda Invoke)
- Python (`run-mcp-servers-with-aws-lambda` / `mcp_lambda`) or TypeScript/Node.js (`@aws/run-mcp-servers-with-aws-lambda`) runtime
- Wrapped stateless `stdio` MCP server packaged alongside Lambda code or layers (`python -m`, `node`, or `npx --offline`) plus Secrets Manager/IAM config for credentials
Package your stateless `stdio` MCP server into your Lambda artifact (avoiding online `uvx`/`npx` downloads at runtime) and wrap `StdioServerAdapterRequestHandler` with `APIGatewayProxyEventHandler`, `BedrockAgentCoreGatewayTargetHandler`, `LambdaFunctionURLEventHandler`, or `stdio_server_adapter`. For Bedrock AgentCore Gateway, export and clean the tool schema via `@modelcontextprotocol/inspector` and `scripts/clean-tool-schema.py`.
Use cases
- Expose existing stateless Python or TypeScript `stdio` MCP servers (such as time or fetch) to Cursor, Cline, and Claude Desktop over Streamable HTTP via API Gateway and OAuth (Cognito, Okta, or Auth0).
- Attach packaged `stdio` MCP servers as AWS Lambda targets behind Amazon Bedrock AgentCore Gateway with schema validation.
- Connect backend microservices to Lambda-hosted MCP servers using AWS IAM authentication over SigV4-signed Function URLs or the Lambda Invoke API.
- Inject third-party API keys from AWS Secrets Manager or forward Lambda execution-role credentials into wrapped MCP subprocesses.
Strengths
- Official AWS Labs library under Apache-2.0 supporting both Python (`mcp_lambda`) and TypeScript (`@aws/run-mcp-servers-with-aws-lambda`).
- Supports four AWS integration patterns—API Gateway, Bedrock AgentCore Gateway, SigV4 Lambda Function URLs, and direct Lambda Invoke API.
- Works with off-the-shelf Streamable HTTP MCP clients (Cursor, Cline, Claude Desktop) when fronted by API Gateway or Bedrock AgentCore Gateway with OAuth.
- Includes concrete examples for Secrets Manager key loading, Lambda layers (`PYTHONPATH`), AWS profile file generation, and AgentCore schema cleanup.
Limitations
- Does not preserve MCP server state or sessions across invocations, making stateful servers (sqlite, filesystem, git) unsuitable.
- Only adapts `stdio` MCP servers in Python and TypeScript—servers built for SSE or languages such as Kotlin are not supported.
- SigV4 Lambda Function URLs and Lambda Invoke API transports use custom extensions not supported by off-the-shelf desktop MCP apps, and there is no built-in per-user secret management.