AWS Lambda MCP server

Enables LLMs to interact with AWS Lambda functions, providing access to private resources, AWS services, and Lambda's capabilities for data processing and external API integration.
Back to servers
Provider
Danilo Poccia
Release date
Feb 26, 2025
Language
Python
Stats
99 stars

MCP2Lambda is a bridge that enables AI models to interact with AWS Lambda functions as tools without code changes. By implementing the Model Context Protocol (MCP), it allows large language models to access and invoke Lambda functions, extending their capabilities to interact with AWS services, private networks, and the internet.

Installation

Via Smithery

The simplest way to install MCP2Lambda for Claude Desktop is via Smithery:

npx -y @smithery/cli install @danilop/MCP2Lambda --client claude

Manual Installation

  1. Clone the repository:

    git clone https://github.com/yourusername/mcp2lambda.git
    cd mcp2lambda
    
  2. Configure AWS credentials:

    aws configure
    

Prerequisites

  • Python 3.12 or higher
  • AWS account with configured credentials
  • AWS Lambda functions
  • An MCP-compatible client (Claude Desktop or Amazon Bedrock with Converse API)

Deploying Sample Lambda Functions

MCP2Lambda includes sample functions to demonstrate its capabilities:

  1. Install the AWS SAM CLI from the official documentation

  2. Deploy the sample functions:

    cd sample_functions
    sam build
    sam deploy
    

The sample functions will be deployed with the prefix mcp2lambda- and include:

  • CustomerIdFromEmail: Retrieves a customer ID from an email address
  • CustomerInfoFromId: Gets customer details from a customer ID
  • RunPythonCode: Executes Python code in a Lambda sandbox

Configuration Options

Strategy Selection

MCP2Lambda supports two operational modes:

  1. Pre-Discovery Mode (default): Registers each Lambda function as an individual tool at startup
  2. Generic Mode: Uses two generic tools for listing and invoking Lambda functions

Control this behavior with:

# Disable pre-discovery mode via environment variable
export PRE_DISCOVERY=false
python main.py

# Or using CLI flag
python main.py --no-pre-discovery

Integration with Claude Desktop

Add MCP2Lambda to your Claude Desktop configuration file:

{
  "mcpServers": {
    "mcp2lambda": {
      "command": "uv",
      "args": [
        "--directory",
        "<full path to the mcp2lambda directory>",
        "run",
        "main.py"
      ]
    }
  }
}

Add to your Claude personal preferences:

Use the AWS Lambda tools to improve your answers.

Using with Amazon Bedrock

MCP2Lambda works with Amazon Bedrock's Converse API:

  1. Navigate to the client directory:

    cd mcp_client_bedrock
    
  2. Install dependencies:

    uv pip install -e .
    
  3. Run the client:

    python main.py
    

You can configure different Bedrock models by modifying the model_id in main.py:

model_id = "us.anthropic.claude-3-7-sonnet-20250219-v1:0"
#model_id = "us.amazon.nova-pro-v1:0"

Running the MCP Server

Start the MCP server locally:

cd mcp2lambda
uv run main.py

By default, only Lambda functions whose names start with mcp2lambda- will be available to the model.

How to add this MCP server to Cursor

There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json file so that it is available in all of your projects.

If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json file.

Adding an MCP server to Cursor globally

To add a global MCP server go to Cursor Settings > MCP and click "Add new global MCP server".

When you click that button the ~/.cursor/mcp.json file will be opened and you can add your server like this:

{
    "mcpServers": {
        "cursor-rules-mcp": {
            "command": "npx",
            "args": [
                "-y",
                "cursor-rules-mcp"
            ]
        }
    }
}

Adding an MCP server to a project

To add an MCP server to a project you can create a new .cursor/mcp.json file or add it to the existing one. This will look exactly the same as the global MCP server example above.

How to use the MCP server

Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.

The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.

You can also explictly ask the agent to use the tool by mentioning the tool name and describing what the function does.

Want to 10x your AI skills?

Get a free account and learn to code + market your apps using AI (with or without vibes!).

Nah, maybe later