Back to MCP directory
publicPublicdnsLocal runtime

simple-mcp-server-on-lambda

一个简单的MCP服务器原型,直接在AWS Lambda和API Gateway上原生运行,无需额外桥接组件或自定义传输。

article

README

🚀 简单的Lambda上的MCP服务器

本项目是一个可在AWS Lambda和Amazon API Gateway上原生运行的简单MCP服务器,无需额外的桥接组件或自定义传输。这得益于v2025 - 03 - 26引入的可流式HTTP传输。不过要注意,这目前只是个原型。

架构图

架构尽可能简单,如下所示:

🚀 快速开始

✨ 主要特性

  • 可在AWS Lambda和Amazon API Gateway上原生运行。
  • 无需额外的桥接组件或自定义传输。

📦 安装指南

先决条件

  • AWS CLI
  • Terraform

安装步骤

  1. 安装依赖项
cd src
npm install
cd ..
  1. 引导服务器并设置带有MCP服务器端点的环境变量
cd terraform
terraform init
terraform plan
terraform apply
export SIMPLE_MCP_SERVER_ENDPOINT=$(terraform output --raw endpoint_url) 
cd ..

⚠️ 重要提示

API Gateway端点可能需要几秒钟才能运行。

💻 使用示例

基础用法

  1. 运行客户端
node src/client.js
  1. 查看响应
> node client.js
> listTools response:  { tools: [ { name: 'ping', inputSchema: [Object] } ] }
> callTool:ping response:  { content: [ { type: 'text', text: 'pong' } ] }

📚 详细文档

help

Runtime guide

cloud

Hosted runtime

Hosted servers run from a provider-managed environment. You usually connect the MCP client to the hosted endpoint or follow the provider's authorization flow, without keeping a local process alive

  1. Open provider connection page
  2. Authorize or copy endpoint
  3. Connect from your MCP client
terminal

Local runtime / other methods

Local servers run on your own machine or infrastructure. You normally copy the server_config into your MCP client, install the required package, and provide env variables from env_schema when needed

  1. Copy server_config
  2. Install required package
  3. Fill env variables and restart client