本项目是一个可在AWS Lambda和Amazon API Gateway上原生运行的简单MCP服务器,无需额外的桥接组件或自定义传输。这得益于v2025 - 03 - 26引入的可流式HTTP传输。不过要注意,这目前只是个原型。
架构尽可能简单,如下所示:
cd src
npm install
cd ..
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 response: { tools: [ { name: 'ping', inputSchema: [Object] } ] }
> callTool:ping response: { content: [ { type: 'text', text: 'pong' } ] }