1
0
mirror of synced 2026-08-06 11:37:16 +00:00
Files
omrsamer 534d438500 Feature/cfn samples mcp server (#464)
* Add CloudFormation samples for MCP Server on AgentCore Runtime

- Created 04-cfn-samples/ directory with production-ready CloudFormation templates
- Added mcp-server-agentcore-runtime sample with:
  - Complete CloudFormation template (mcp-server-template.yaml)
  - Automated deployment scripts (deploy.sh, test.sh, cleanup.sh)
  - Authentication helper (get_token.py)
  - MCP client test script (test_mcp_server.py)
  - Comprehensive documentation (README.md, DETAILED_GUIDE.md)
- Features:
  - One-command deployment with automated Docker image building
  - JWT authentication via Cognito
  - ARM64 Docker images built via CodeBuild
  - Three sample MCP tools (add_numbers, multiply_numbers, greet_user)
  - Least-privilege IAM roles
  - Complete troubleshooting guide

* Add omrsamer to CONTRIBUTORS.md

* Add three additional CloudFormation samples

- Added basic-runtime: Simple agent without tools or memory
- Added multi-agent-runtime: Two-agent system with orchestrator and specialist
- Added weather-agent-runtime: Complete agent with browser, code interpreter, and memory
- Updated main README with all four samples and comprehensive documentation

* Add deployment and cleanup scripts for all CFN samples

- Added deploy.sh and cleanup.sh for basic-runtime
- Added deploy.sh and cleanup.sh for multi-agent-runtime
- Added deploy.sh and cleanup.sh for weather-agent-runtime
- All scripts are executable and follow the same pattern as mcp-server-agentcore-runtime
- Scripts include proper error handling and user-friendly output

* Add comprehensive README documentation for CFN samples with architecture diagrams

- Added detailed README.md files for basic-runtime, multi-agent-runtime, and weather-agent-runtime
- Included architecture PNG diagrams for basic-runtime and multi-agent-runtime
- Standardized testing sections across all READMEs (AWS CLI and Console only)
- Removed Python testing sections for consistency
- Added deployment, testing, troubleshooting, and cost estimate sections
- Updated CONTRIBUTORS.md with contributor name
- Updated main 04-cfn-samples README.md

* Add architecture diagram to mcp-server-agentcore-runtime README

- Added architecture.png with visual diagram
- Updated README to use local PNG instead of tutorial reference
- Added detailed architecture component descriptions

* Update get_token.py cosmetic changes

* Fix Python formatting to pass ruff linter

* Restructure infrastructure samples: rename to 04-infrastructure-as-code and organize CloudFormation templates

- Rename 04-cfn-samples to 04-infrastructure-as-code
- Create cloudformation subfolder for better organization
- Rename weather-agent-runtime to end-to-end-weather-agent
- Rename weather agent template.yaml to end-to-end-weather-agent.yaml
- Update all documentation and scripts to reflect new structure
- Update main README with new paths and folder structure
- All Python files pass ruff formatting checks

* Update CloudFormation examples to use us-west-2 region and remove production-ready language

- Changed all deploy.sh, cleanup.sh, and test.sh scripts from us-east-1 to us-west-2
- Updated all README files with CLI examples to use us-west-2
- Updated Python helper scripts (get_token.py, test_mcp_server.py) to use us-west-2 in examples
- Updated multi-agent-runtime template.yaml default region to us-west-2
- Removed 'production-ready' language from README files, replaced with 'complete'
- All 4 CloudFormation examples now consistently use us-west-2 region

* Resolve CONTRIBUTORS.md merge conflict - include all contributors from both branches

---------

Signed-off-by: Maira Ladeira Tanke <102240958+mttanke@users.noreply.github.com>
Co-authored-by: Maira Ladeira Tanke <102240958+mttanke@users.noreply.github.com>
2025-10-14 09:18:20 -04:00

89 lines
2.7 KiB
Bash
Executable File

#!/bin/bash
# Deploy script for Multi-Agent Runtime CloudFormation stack
# This script deploys two AgentCore Runtimes where Agent1 can invoke Agent2
set -e
# Configuration
STACK_NAME="${1:-multi-agent-demo}"
REGION="${2:-us-west-2}"
TEMPLATE_FILE="template.yaml"
echo "=========================================="
echo "Deploying Multi-Agent Runtime"
echo "=========================================="
echo "Stack Name: $STACK_NAME"
echo "Region: $REGION"
echo "=========================================="
# Check if template file exists
if [ ! -f "$TEMPLATE_FILE" ]; then
echo "Error: Template file '$TEMPLATE_FILE' not found!"
exit 1
fi
# Deploy the CloudFormation stack
echo ""
echo "Creating CloudFormation stack..."
aws cloudformation create-stack \
--stack-name "$STACK_NAME" \
--template-body file://"$TEMPLATE_FILE" \
--capabilities CAPABILITY_NAMED_IAM \
--region "$REGION"
if [ $? -eq 0 ]; then
echo ""
echo "✓ Stack creation initiated successfully!"
echo ""
echo "Waiting for stack creation to complete..."
echo "This will take approximately 15-20 minutes..."
echo "(Building two Docker images and deploying two agents)"
echo ""
aws cloudformation wait stack-create-complete \
--stack-name "$STACK_NAME" \
--region "$REGION"
if [ $? -eq 0 ]; then
echo ""
echo "=========================================="
echo "✓ Stack deployed successfully!"
echo "=========================================="
echo ""
echo "Stack Outputs:"
aws cloudformation describe-stacks \
--stack-name "$STACK_NAME" \
--query 'Stacks[0].Outputs' \
--output table \
--region "$REGION"
echo ""
echo "Agent1 (Orchestrator) Runtime ARN:"
aws cloudformation describe-stacks \
--stack-name "$STACK_NAME" \
--query 'Stacks[0].Outputs[?OutputKey==`Agent1RuntimeArn`].OutputValue' \
--output text \
--region "$REGION"
echo ""
echo "Agent2 (Specialist) Runtime ARN:"
aws cloudformation describe-stacks \
--stack-name "$STACK_NAME" \
--query 'Stacks[0].Outputs[?OutputKey==`Agent2RuntimeArn`].OutputValue' \
--output text \
--region "$REGION"
echo ""
echo "To delete this stack, run:"
echo " ./cleanup.sh $STACK_NAME $REGION"
echo ""
else
echo ""
echo "✗ Stack creation failed or timed out"
echo "Check the CloudFormation console for details"
exit 1
fi
else
echo ""
echo "✗ Failed to initiate stack creation"
exit 1
fi