请使用此仓库 - https://github.com/aws-samples/sample-serverless-mcp-servers
一个简单的MCP服务器,原生运行在AWS Lambda和Amazon API Gateway上,无需任何额外的桥接组件或自定义传输。这得益于v2025-03-26引入的可流式传输HTTP传输方式,现在这一切成为可能。这只是个原型。
架构尽可能简单:

安装依赖项:
cd src
npm install
cd ..
初始化服务器并设置环境变量以包含MCP服务器端点:
cd terraform
terraform init
terraform plan
terraform apply
export SIMPLE_MCP_SERVER_ENDPOINT=$(terraform output --raw endpoint_url)
cd ..
注意:API Gateway端点可能需要几秒钟才能开始运作。
运行客户端:
node src/client.js
观察响应:
> node client.js
> listTools 响应: { tools: [ { name: 'ping', inputSchema: [Object] } ] }
> callTool:ping 响应: { content: [ { type: 'text', text: 'pong' } ] }