BLOG

Building AWS Architecture with MCP Servers and Strands Agents

Table of contents

Introduction

In the rapidly evolving landscape of cloud architecture and AI-driven development, two powerful technologies are revolutionizing how we build and deploy AWS solutions: Model Context Protocol (MCP) servers and Strands agents.

MCP servers provide a standardized way to connect Large Language Models (LLMs) to external data sources and tools. They act as bridges between AI models and various services, enabling seamless integration with documentation, APIs, and cloud resources. In the AWS context, MCP servers can provide direct access to AWS documentation, service APIs, and architectural tools.

Strands agents are intelligent orchestration frameworks that leverage LLMs to automate complex workflows. They can reason about tasks, make decisions, and execute multi-step processes with minimal human intervention. When combined with MCP servers, Strands agents become incredibly powerful tools for cloud architecture and automation.

This combination represents a major improvement over traditional agent coding approaches. Instead of writing verbose, complex code to handle API calls, error handling, and workflow orchestration, developers can now describe their intentions in natural language and let the intelligent agents handle the implementation details. This shift dramatically reduces development time and makes cloud architecture more accessible to a broader range of developers.

Here is an example of an architect diagram of a website that uses AWS Lambda for a static website hosted on S3. This was prepared by combining MCP servers and Strand agents.

Prompt: “Get the documentation for AWS Lambda then create a diagram of a website that uses AWS Lambda for a static website hosted on S3”

Code Example:

Let’s check the code that was used to prepare the aboce diagram. It showcases power of MCP servers with Strands agents for AWS architecture generation:

Code Breakdown and Explanation

MCP Client Initialization:

This section creates an MCP client that connects to AWS’s official documentation server. The uvx command dynamically fetches and runs the latest version of the AWS documentation MCP server, ensuring you always have access to the most current AWS documentation.

Diagram Generation Client:

Similarly, this creates a client for the AWS diagram generation MCP server, which can create visual representations of AWS architectures programmatically.

Model Configuration:

This configures the underlying LLM using AWS Bedrock’s Claude 3.5 Haiku model. The temperature of 0.7 provides a good balance between creativity and consistency for architectural decisions. Although Strand agents connect by default to Bedrock, you can use many third party providers such as Gemini, Anthropic and OpenAI.

Agent Orchestration:

Here’s where Strands agents are coming in the picture. The agent automatically discovers all available tools from both MCP servers and integrates them seamlessly. The system prompt establishes the agent’s role as an AWS Solutions Architect, giving it the context needed to make intelligent architectural decisions.

Natural Language Execution:

This single line demonstrates the power of the approach. Instead of writing complex code to query documentation APIs, parse responses, and generate diagrams, we simply describe what we want in natural language. The agent handles all the complexity behind the scenes.

Why It’s Simpler Than Traditional Agent Coding

Traditional agent development requires extensive boilerplate code for several critical areas:

Manual API Integration: Developers typically spend significant time writing HTTP clients, handling authentication, parsing responses, and managing rate limits for each service they want to integrate.

Error Handling and Retry Logic: Robust agents require sophisticated error handling, exponential backoff, circuit breakers, and retry mechanisms for reliable operation.

Workflow Orchestration: Coordinating multi-step processes requires complex state management, conditional branching, and task scheduling logic.

Tool Discovery and Management: Traditional approaches require hardcoding available tools and their interfaces, making the system rigid and difficult to extend.

In contrast, the Strands + MCP approach provides several key benefits:

Reduced Boilerplate: The framework handles all the low-level infrastructure concerns, allowing developers to focus on business logic and architectural decisions.

Dynamic Tool Discovery: MCP servers can advertise their capabilities dynamically, and Strands agents can discover and utilize new tools without code changes.

Natural Language Interface: Instead of writing procedural code, developers can describe their intentions in natural language, making the system more accessible and maintainable.

Built-in Reliability: The framework includes robust error handling, retry logic, and recovery mechanisms out of the box.

Modularity and Reusability: MCP servers can be shared across projects and teams, promoting code reuse and consistency.

Various ways to Deploy: Strand agents can be deployed on Lambda, ECS, EKS, or EC2 instances.

This approach aligns with modern cloud-native and serverless design principles by emphasizing declarative configuration, automatic scaling, and managed infrastructure.

Required Packages

To run the mcp_arch_diagram.py script, you'll need to install the following Python packages:

Package Breakdown:

  • mcp: Core Model Context Protocol implementation
  • strands: The agent orchestration framework
  • boto3: AWS SDK for Python (required for Bedrock integration)
  • anthropic: Anthropic's Python client library

Additional Requirements:

  • Ensure you have uvx installed globally for dynamic package execution
  • Configure AWS credentials for Bedrock access
  • Set up appropriate IAM permissions for AWS Bedrock usage

Other AWS Architectures It Can Create

The flexibility of MCP servers with Strands agents extends far beyond static websites. Here are several other AWS architectures this approach can generate:

Serverless API with Lambda and API Gateway

To generate a diagram for serverless API architecture with proper authentication and data persistence.

Event-Driven Data Pipeline

Useful to a diagram for building scalable data processing workflows that respond to real-time events.

Multi-Tier Web Application

To a diagram for traditional multi-tier architectures with high availability and performance optimization.

Machine Learning Pipeline

To build diagram for end-to-end machine learning workflows with proper data management and monitoring.

Each of these examples demonstrates how natural language descriptions can be translated into comprehensive AWS architectures without writing complex infrastructure code.

Cloud Diagrams:

We checked how to create architectural diagrams for a new workload but what how do you find the root cause of issues and inefficiencies in your present workload? Cloud Diagrams visualizes your cloud footprint in near-realtime and connects the dots between various services and recommends actionable insights. This reduces outages, troubleshooting efforts and decreases operational costs.

Conclusion

The combination of MCP servers and Strands agents represents a fundamental change in how we approach cloud architecture and automation. By reducing the complexity of API integrations, error handling, and workflow orchestration, this approach enables us to focus on what matters most: designing robust, scalable solutions.

The key benefits include dramatically reduced development time, increased accessibility for developers of all skill levels, improved maintainability through natural language interfaces, and enhanced modularity through standardized MCP server integrations.

As cloud architectures become increasingly complex, tools that simplify and automate the development process become invaluable. MCP servers with Strands agents provide a glimpse into the future of cloud development, where intelligent agents can understand our intentions and execute complex workflows with minimal human intervention.

I encourage you to explore this technology stack and experiment with building your own AWS architectures. Start with simple examples like the static website we’ve discussed, then gradually explore more complex scenarios. The learning curve is gentle, but the possibilities are vast.

I strongly recommend checking out Cloud Diagram to get near real-time map of your cloud infrastructure to resolve incidents faster and enable better architecture decisions.

The future of cloud development is here, and it speaks your language — literally.

Schedule a call with our team

You will receive a calendar invite to the email address provided below for a 15-minute call with one of our team members to discuss your needs.

You will be presented with date and time options on the next step