1. Conduid
  2. Developer Tools
  3. AWS Lambda MCP Cookbook
MCP server · Developer Tools

AWS Lambda MCP Cookbook

This repository provides a working, deployable, open source-based, serverless MCP server blueprint with an AWS Lambda function and AWS CDK Python code with all the best practices and a complete CI/CD pipeline.

Unclaimed MIT last commit 10 months ago devtools
72Good

Scored 3 hours ago · breakdown

About AWS Lambda MCP Cookbook

AWS Lambda MCP Cookbook is an MCP server published by ran-isenberg in the Developer Tools category: this repository provides a working, deployable, open source-based, serverless MCP server blueprint with an AWS Lambda function and AWS CDK Python code with all the best practices and a complete CI/CD pipeline. It has been installed 0 times through Conduid.

The repository has 124 stars and 15 forks, with the last commit 10 months ago. Six months or more without a commit doesn't mean the server is broken, but check the open issues (0) before depending on it in production.

Install

Install
npx aws-lambda-mcp-cookbook

This server has no ConduID identity, so agent calls to it are not receipted. Pin the version you install and review the source before granting it credentials.

Ask AI

Ask AI about AWS Lambda MCP Cookbook

Powered by Claude · Grounded in docs

I know everything about AWS Lambda MCP Cookbook. Ask me about installation, configuration, usage, or troubleshooting.

Security checks

  • ·README presentNot checked yet.
  • ·License declaredNot checked yet.
  • ·Tests presentNot checked yet.
  • ·Dependencies pinnedNot checked yet.
  • ·No dynamic code executionNot checked yet.
  • !Scoped permissionsDoesn't declare a permission scope. Assume it can do anything its process can.

Releases

4.0.0MCP v2 · 30 Jul 2026What's Changed feature: mcp v2 by @ran-isenberg in https://github.com/ran-isenberg/aws-lambda-mcp-cookbook/pull/25 Full Changelog**: https://github.com/ran-isenberg/aws-lambda-mcp-cookbook/compare/3.1.0...4.0.0
3.1.03.1.0 · 14 Apr 2026What's Changed chore: update to python 3.14 and deps to uv by @ran-isenberg in https://github.com/ran-isenberg/aws-lambda-mcp-cookbook/pull/24 Full Changelog**: https://github.com/ran-isenberg/aws-lambda-mcp-cookbook/compare/3.0.2...3.1.0
3.0.23.0.2 · 31 Oct 2025What's Changed chore: updare deps by @ran-isenberg in https://github.com/ran-isenberg/aws-lambda-mcp-cookbook/pull/23 Full Changelog**: https://github.com/ran-isenberg/aws-lambda-mcp-cookbook/compare/3.0.1...3.0.2
3.0.13.0.1 · 18 Jul 2025What's Changed Delete service/run.sh by @ran-isenberg in https://github.com/ran-isenberg/aws-lambda-mcp-cookbook/pull/21 chore: improve docs and added unit tests by @ran-isenberg in…
3.0.03.0.0 · 29 Jun 2025What's Changed New FastMCP support in addition to custom MCP parser. feature: Makefile : update-deps automatically updates your cdk version by @ran-isenberg in https://github.com/ran-isenberg/aws-lambda-mcp-cookbook/pull/19 feature: v3 add…

README

AWS Lambda MCP Cookbook (Python)

license PythonSupport codecov version github-star-badge OpenSSF Scorecard issues

This project provides a working, open source based, AWS Lambda based Python MCP server implementation.

It provides two options:

  1. Pure, native Lambda function with no FastMCP.
  2. Lambda with AWS web adapter and FastMCP

It contains a production grade implementation including DEPLOYMENT code with CDK and a CI/CD pipeline, testing, observability and more (see Features section).

Choose the architecture that you see fit, each with its own pros and cons.

This project is a blueprint for new Serverless MCP servers.

📜Documentation | Blogs website

Contact details | mailto:ran.isenberg@ranthebuilder.cloud

Twitter Follow Website

Getting Started

You can start with a clean service out of this blueprint repository without using the 'Template' button on GitHub.

That's it, you are ready to deploy the MCP server (make sure Docker is running!):

cd {new repo folder}
poetry env activate
poetry install
make deploy

Check out the official Documentation.

Make sure you have poetry v2 and above.

You can also run 'make pr' will run all checks, synth, file formatters , unit tests, deploy to AWS and run integration and E2E tests.

The Problem

Starting a production grade Serverless MCP can be overwhelming. You need to figure out many questions and challenges that have nothing to do with your business domain:

  • How to deploy to the cloud? What IAC framework do you choose?
  • How to write a SaaS-oriented CI/CD pipeline? What does it need to contain?
  • How do you handle observability, logging, tracing, metrics?
  • How do you write a production grade Lambda function?
  • How do you handle testing?
  • What makes an AWS Lambda handler resilient, traceable, and easy to maintain? How do you write such a code?

The Solution

This project aims to reduce cognitive load and answer these questions for you by providing a production grade Python Serverless MCP server blueprint that implements best practices for AWS Lambda, MCP, Serverless CI/CD, and AWS CDK in one project.

The MCP server uses JSON RPC over HTTP (non stream-able) via API Gateway's body payload parameter. See integration tests and see how the test event is generated.

BE AWARE - The pure Lambda variation has limited MCP protocol support, it's based used for tools only simple MCP. For full blown services, use the FastMCP variation.

This project aims to reduce cognitive load and answer these questions for you by providing a skeleton Python Serverless service blueprint that implements best practices for AWS Lambda, Serverless CI/CD, and AWS CDK in one blueprint project.

This project is a blueprint for new Serverless MCP servers.

It provides two implementation options:

  1. Pure, native Lambda function with no FastMCP.
  2. Lambda with AWS web adapter and FastMCP

Choose the architecture that you see fit, each with its own pros and cons.

design

Option 1: Serverless Native Lambda MCP Server

This project provides a working, open source based, AWS Lambda based Python MCP server implementation.

The MCP server uses JSON RPC over HTTP (non streamable) via API Gateway's body payload parameter. See integration tests and see how the test event is generated.

It contains an advanced implementation including IaC CDK code and a CI/CD pipeline, testing, observability and more (see Features section).

It's started based on AWS sample for MCP - but had major refactors since, combined with the AWS Lambda Handler cookbook template.

Better fitted for POCs or tool oriented MCPs. Can be secured with custom authentication code and WAF.

Native/pure Lambda example:

import os

from aws_lambda_env_modeler import init_environment_variables
from aws_lambda_powertools.logging import correlation_paths
from aws_lambda_powertools.metrics import MetricUnit
from aws_lambda_powertools.utilities.typing import LambdaContext

from service.handlers.models.env_vars import McpHandlerEnvVars
from service.handlers.utils.authentication import authenticate
from service.handlers.utils.observability import logger, metrics, tracer
from service.logic.math import add_two_numbers
from service.mcp_parser.session_data import SessionData


from service.handlers.models.env_vars import McpHandlerEnvVars
from service.mcp_parser.parser import MCPLambdaHandler
from service.mcp_parser.session import DynamoDBSessionStore

session_store = DynamoDBSessionStore(table_name_getter=lambda: os.getenv('TABLE_NAME'))
mcp = MCPLambdaHandler(name='mcp-lambda-server', version='1.0.0', session_store=session_store)

@mcp.tool()
def math(a: int, b: int) -> int:
    """Add two numbers together"""

    # Uncomment the following line if you want to use session data
    # session_data: Optional[SessionData] = mcp.get_session()

    # call logic layer
    result = add_two_numbers(a, b)

    # save session data
    mcp.set_session(data={'result': result})

    metrics.add_metric(name='ValidMcpEvents', unit=MetricUnit.Count, value=1)
    return result


@init_environment_variables(model=McpHandlerEnvVars)
@logger.inject_lambda_context(correlation_id_path=correlation_paths.API_GATEWAY_REST)
@metrics.log_metrics
@tracer.capture_lambda_handler(capture_response=False)
def lambda_handler(event: dict, context: LambdaContext) -> dict:
    authenticate(event, context)
    return mcp.handle_request(event, context)

Option 2: Serverless Lambda Web Adapter & FastMCP

Based on AWS Lambda Web Adapter and FastMCP.

Use an HTTP API GW and Lambda function. Can be used with a REST API GW with a custom domain too.

Better fitted for production-grade MCP servers as it upholds to the official MCP protocol and has native auth mechanism (OAuth).

Example with FastMCP and AWS web adapter extension:

from fastmcp import FastMCP

from service.handlers.utils.observability import logger
from service.logic.prompts.hld import hld_prompt
from service.logic.resources.profiles import get_profile_by_id
from service.logic.tools.math import add_two_numbers

mcp: FastMCP = FastMCP(name='mcp-lambda-server')


@mcp.tool
def math(a: int, b: int) -> int:
    """Add two numbers together"""
    logger.info('using math tool', extra={'a': a, 'b': b})
    return add_two_numbers(a, b)


# Dynamic resource template
@mcp.resource('users://{user_id}/profile')
def get_profile(user_id: int):
    """Fetch user profile by user ID."""
    logger.info('fetching user profile', extra={'user_id': user_id})
    return get_profile_by_id(user_id)


@mcp.prompt()
def generate_serverless_design_prompt(design_requirements: str) -> str:
    """Generate a serverless design prompt based on the provided design requirements."""
    logger.info('generating serverless design prompt', extra={'design_requirements': design_requirements})
    return hld_prompt(design_requirements)


app = mcp.http_app(transport='http', stateless_http=True, json_response=True)

Monitoring Design

monitoring_design

Features

  • PURE Lambda - not web adapter, no FastMCP required or Web adapter with FastMCP.
  • Python Serverless MCP server with a recommended file structure.
  • MCP Tools input validation: check argument types and values
  • Tests - unit, integration (tests for full MCP messages) and E2E with a real MCP client
  • CDK infrastructure with infrastructure tests and security tests.
  • CI/CD pipelines based on Github actions that deploys to AWS with python linters, complexity checks and style formatters.
  • CI/CD pipeline deploys to dev/staging and production environments with different gates between each environment
  • Makefile for simple developer experience.
  • The AWS Lambda handler embodies Serverless best practices and has all the bells and whistles for a proper production ready handler.
  • AWS Lambda handler uses AWS Lambda Powertools.
  • AWS Lambda handler 3 layer architecture: handler layer, logic layer and data access layer
  • Session context storage in DynamoDB - global getter and setter (get_session, set_session) - be advised, has security issue - need to match session id to user
  • API protected by WAF with four AWS managed rules in production deployment
  • CloudWatch dashboards - High level and low level including CloudWatch alarms

CDK Deployment

The CDK code create an API GW with a path of /mcp which triggers the lambda on 'POST' requests.

The AWS Lambda handler uses a Lambda layer optimization which takes all the packages under the [packages] section in the Pipfile and downloads them in via a Docker instance.

This allows you to package any custom dependencies you might have, just add them to the Pipfile under the [packages] section.

Serverless Best Practices

The AWS Lambda handler will implement multiple best practice utilities.

Each utility is implemented when a new blog post is published about that utility.

The utilities cover multiple aspect of a production-ready service, including:

Security

  • Refer to the GitGub pages.

Known Issues:

  • Refer to the GitGub pages.

Code Contributions

Code contributions are welcomed. Read this guide.

Code of Conduct

Read our code of conduct here.

Connect

Credits

License

This library is licensed under the MIT License. See the LICENSE file.

README mirrored from the source repository 3 hours ago. The original is authoritative.

Questions

About AWS Lambda MCP Cookbook

How do I install AWS Lambda MCP Cookbook?

Run npx aws-lambda-mcp-cookbook, then add the server to your MCP client's configuration. Conduid has recorded 0 installs, so the command is known to work with current clients.

Is AWS Lambda MCP Cookbook safe to use with an AI agent?

Its trust score is 72 out of 100 (good). It passes 0 of 1 static security checks; the failures are listed above. It has no ConduID identity yet, so agent calls to it are not receipted.

Is AWS Lambda MCP Cookbook still maintained?

Yes — the latest release is 4.0.0 (30 Jul 2026), and the last commit was 10 months ago. The repository has 124 stars and 0 open issues.