Agent using MCP server on AWS Lambda through Amazon Bedrock AgentCore Gateway

Amazon Bedrock AgentCore → Amazon API Gateway → AWS Lambda → Amazon DynamoDB

Strands SDK agent on Lambda routes tool calls via AgentCore Gateway (MCP) to a Lambda MCP Server backed by DynamoDB, with Cognito JWT auth.

The user authenticates with Amazon Cognito and receives a JWT token.
The JWT is passed to an Agent Lambda which uses the Strands Agents SDK to create an AI agent backed by Amazon Bedrock (Claude Sonnet 4.5 cross-region inference profile).
The Strands Agent connects to an AgentCore Gateway MCP endpoint, dynamically discovering available product management tools via the MCP tools/list protocol.
The AgentCore Gateway validates the JWT token using a CUSTOM_JWT authorizer backed by Cognito, then routes MCP tool calls to the MCP Server Lambda via API Gateway.
The MCP Server Lambda implements the Model Context Protocol (JSON-RPC 2.0 over HTTP) and exposes three tools: list_products, get_product, and put_product, backed by a DynamoDB table.
The Strands SDK handles the full agentic loop: tool discovery, Claude tool selection, MCP tool execution, and response formatting — all in a single agent() call.
The model used by the agent is configurable via the BEDROCK_MODEL_ID environment variable on the Agent Lambda, set from the BedrockModelId SAM template parameter.

< Back to all patterns

GitHub icon Download this pattern (.zip)

GitHub icon View this pattern on GitHub


Clone repo

git clone https://github.com/aws-samples/serverless-patterns/cd serverless-patterns/strands-agentcore-mcp

Deploy

<code>./scripts/deploy.sh</code>


Testing

./scripts/test.sh
./scripts/test.sh 'List all products in Electronics'
./scripts/test.sh 'Get product ELEC-001 details'
./scripts/test.sh 'Add a new product called Widget Pro in Electronics for $49.99'

Cleanup

./scripts/terminate.sh

Created by:

Mike Hume

Mike Hume

AWS Senior Solutions Architect & UKPS Serverless Lead.

Follow on LinkedIn