[{"data":1,"prerenderedAt":97},["ShallowReactive",2],{"pattern-lambda-web-mcp-server-nodejs-awscli":3,"pattern-group-lambda-web-mcp-server-nodejs-awscli":72},{"id":4,"title":5,"architectureURL":6,"cleanup":7,"contributors":11,"deploy":13,"description":18,"extension":19,"framework":20,"gitHub":21,"highlight":25,"introBox":26,"language":33,"level":34,"meta":35,"patternArch":36,"patternGroup":55,"patternGroupLabel":6,"resources":56,"stem":67,"testing":68,"videoId":6,"__hash__":71},"patterns\u002Fpatterns\u002Flambda-web-mcp-server-nodejs-awscli.json","Remote MCP server with an IAM-protected backend API on AWS Lambda Web Functions",null,{"text":8},[9,10],"Delete both functions and their endpoints: \u003Ccode>aws lambda-web delete-web-function --function-name $STACK-mcp\u003C\u002Fcode> and \u003Ccode>aws lambda-web delete-web-function --function-name $STACK-cpu-api\u003C\u002Fcode>.","See the GitHub repo for removing the execution roles and log groups.",[12],"content\u002Fcontributors\u002Fjulian-wood.json",{"text":14},[15,16,17],"Set a name prefix, \u003Ccode>export STACK=lambda-web-mcp-server\u003C\u002Fcode>, then deploy the API: \u003Ccode>aws lambda-web deploy --name $STACK-cpu-api --code cpu-api --timeout-seconds 60\u003C\u002Fcode>.","Switch its endpoint to IamAuth: \u003Ccode>aws lambda-web update-web-function-endpoint --function-name $STACK-cpu-api --endpoint-name dev --auth-type IamAuth\u003C\u002Fcode>.","See the GitHub repo for creating the MCP server's execution role and deploying the MCP server.","Run a remote MCP server as an AWS Lambda Web Function that calls an existing HTTP API on a second Web Function, protected with IamAuth and SigV4.","json","AWS CLI",{"template":22},{"patternPath":23,"templateFile":24},"lambda-web-mcp-server\u002Fnodejs\u002Fawscli","mcp-server\u002Findex.js","true",{"headline":27,"text":28},"How it works",[29,30,31,32],"This pattern deploys two AWS Lambda Web Functions. The first is a remote MCP server that speaks MCP over Streamable HTTP at \u003Ccode>\u002Fmcp\u003C\u002Fcode>. The second is a plain HTTP API with no MCP code, standing in for a service you already run.","The API's endpoint uses the \u003Ccode>IamAuth\u003C\u002Fcode> auth type, so Lambda only forwards requests signed with AWS Signature Version 4 by a principal that has \u003Ccode>lambda:InvokeWebFunctionEndpoint\u003C\u002Fcode>. The MCP server signs each request with its own execution role, whose policy allows invoking only that endpoint. Lambda removes the \u003Ccode>Authorization\u003C\u002Fcode> header after validating the signature, so the API code does no authentication of its own.","The MCP server exposes two tools. \u003Ccode>get_current_time\u003C\u002Fcode> runs in the MCP server. \u003Ccode>run_cpu_work\u003C\u002Fcode> calls the API, which runs 1-20 seconds of SHA-256 hashing and streams a JSON line every second. The MCP server relays each line to the MCP client as a progress notification over a Server-Sent Events stream, and a client cancel closes the backend connection and stops the work.","Running the CPU work in its own function keeps the MCP server responsive and lets each function scale on its own. The MCP server endpoint uses the \u003Ccode>ApplicationManaged\u003C\u002Fcode> auth type, which makes it public. Add authentication to it before using this pattern outside a demo.","Node.js","300",{},{"icon1":37,"icon2":42,"icon3":45,"line1":48,"line2":52},{"x":38,"y":39,"service":40,"label":41},15,50,"icon-internet","MCP client",{"x":39,"y":39,"service":43,"label":44},"lambda-web-functions","MCP server",{"x":46,"y":39,"service":43,"label":47},85,"CPU API (IamAuth)",{"from":49,"to":50,"label":51},"icon1","icon2","Streamable HTTP",{"from":50,"to":53,"label":54},"icon3","SigV4","lambda-web-mcp-server",{"bullets":57},[58,61,64],{"text":59,"link":60},"AWS Lambda Web Functions","https:\u002F\u002Fdocs.aws.amazon.com\u002Flambda\u002Flatest\u002Fdg\u002Fweb-functions.html",{"text":62,"link":63},"Model Context Protocol","https:\u002F\u002Fmodelcontextprotocol.io",{"text":65,"link":66},"Signing AWS API requests with Signature Version 4","https:\u002F\u002Fdocs.aws.amazon.com\u002FIAM\u002Flatest\u002FUserGuide\u002Freference_sigv.html","patterns\u002Flambda-web-mcp-server-nodejs-awscli",{"text":69},[70],"See the GitHub repo for detailed testing instructions.","qASlnWzLgFbvZJ2M46R6Tsf12P211PnjN8Jy6YG9pck",[73],{"id":4,"title":5,"architectureURL":6,"cleanup":74,"contributors":76,"deploy":77,"description":18,"extension":19,"framework":20,"gitHub":79,"highlight":25,"introBox":81,"language":33,"level":34,"meta":83,"patternArch":84,"patternGroup":55,"patternGroupLabel":6,"resources":90,"stem":67,"testing":95,"videoId":6,"__hash__":71},{"text":75},[9,10],[12],{"text":78},[15,16,17],{"template":80},{"patternPath":23,"templateFile":24},{"headline":27,"text":82},[29,30,31,32],{},{"icon1":85,"icon2":86,"icon3":87,"line1":88,"line2":89},{"x":38,"y":39,"service":40,"label":41},{"x":39,"y":39,"service":43,"label":44},{"x":46,"y":39,"service":43,"label":47},{"from":49,"to":50,"label":51},{"from":50,"to":53,"label":54},{"bullets":91},[92,93,94],{"text":59,"link":60},{"text":62,"link":63},{"text":65,"link":66},{"text":96},[70],1791847087611]