DEV Community

Cover image for Develop a simple "AWS infra manager" MCP server using Kiro Vibe coding session
sigitp
sigitp

Posted on • Edited on

Develop a simple "AWS infra manager" MCP server using Kiro Vibe coding session

Introduction

The Model Context Protocol (MCP) is revolutionizing how AI assistants interact with external systems and data sources. In this technical blog, we'll walk through creating a comprehensive AWS infrastructure management MCP server using Kiro, an agentic AI-powered Integrated Development Environment (IDE). This server will provide seamless integration with key AWS services, enabling intelligent infrastructure management through natural language interactions.

What is Model Context Protocol (MCP)?

Model Context Protocol is an open standard that enables AI assistants to securely connect to external data sources and tools. MCP servers act as bridges between AI models and various systems, providing structured access to APIs, databases, and services while maintaining security and context awareness.

What is Kiro

Kiro is an agentic IDE that helps you go from prototype to production with spec-driven development. From simple to complex tasks, Kiro works alongside you to turn prompts into detailed specs, then into working code, docs, and tests—so what you build is exactly what you want and ready to share with your team. Kiro’s agents help you solve challenging problems and automate tasks like generating documentation and unit tests. With Kiro, you can build beyond prototypes while being in the driver’s seat every step of the way.

The word agentic is key here. It means that Kiro is not just responding to prompts it is capable of autonomous, goal-driven actions. Instead of asking the AI to generate one snippet at a time, you describe what you want to build, and Kiro actively investigates your codebase, opens relevant files, and modifies them accordingly to fulfill your request. Kiro is built with advanced AI models that are grounded in context and capable of multi-step reasoning. It connects to your local development environment, interprets your intentions, reads and modifies source code, and provides transparent feedback along the way.

Project Overview

Using Kiro, our "aws-infra-manager-mcp-server" example project will provide management capabilities for:

  • AWS Identity: Get caller identity and account information
  • Amazon EC2: List and filter EC2 instances
  • Amazon VPC: List VPCs in your account
  • Amazon S3: List S3 buckets
  • Amazon RDS: List RDS database instances
  • AWS Lambda: List Lambda functions
  • AWS Regions: Get available AWS regions

Setting Up the Development Environment

Prerequisites

Before starting the Kiro Vibe session, ensure you have:
• Python 3.10 or higher and pip installed
• uv, an extremely fast Python package and project manager(pip install uv)
• AWS CLI configured with appropriate permissions
• Basic understanding of AWS services and MCP concepts

Installing uv Package Manager

bash
# Install uv globally
pip install uv

# Verify installation
uv --version
Enter fullscreen mode Exit fullscreen mode

FastMCP SDK

We will use FastMCP SDK to build the MCP server, which provides a streamlined approach to building MCP servers with:
Automatic tool registration - Decorators for easy tool definition
Type safety - Pydantic models for request/response validation
Built-in error handling - Standardized error responses
Async support - Non-blocking operations for better performance

The Kiro Vibe Prompt

Here's the initial prompt we'll use for our Kiro Vibe coding session:

Create a new MCP server project called "aws-infra-manager-mcp-server" using FastMCP SDK.

As a start, the MCP server should be able to manage:
- AWS Identity: Get caller identity and account information
- Amazon EC2: List and filter EC2 instances
- Amazon VPC: List VPCs in your account
- Amazon S3: List S3 buckets
- Amazon RDS: List RDS database instances
- AWS Lambda: List Lambda functions
- AWS Regions: Get available AWS regions

Use "uv" as the python package manager and the execution command for this mcp server project.
Enter fullscreen mode Exit fullscreen mode

🚀 Kiro Generated Code Overview

After Kiro completed, it will generate the complete code, and you can fine tune by asking Kiro to make sure the code works as expected. My own result as an example is available here: https://github.com/sigitp-git/aws-infra-manager-mcp-server. The generated AWS Infrastructure Manager MCP Server is an example of Model Context Protocol server that bridges the gap between AI assistants and AWS infrastructure management. Built with Python and the FastMCP SDK, this project demonstrates how to create powerful, secure, and user-friendly infrastructure automation tools that can be integrated with Kiro (recursively 😁) or Amazon Q CLI.

Features

This MCP server provides essential AWS management capabilities:

🔍 Core AWS Tools
  • AWS Identity: Get caller identity and account information
  • Amazon EC2: List and filter EC2 instances
  • Amazon VPC: List VPCs in your account
  • Amazon S3: List S3 buckets
  • Amazon RDS: List RDS database instances
  • AWS Lambda: List Lambda functions
  • AWS Regions: Get available AWS regions
🛡️ Built-in Features
  • Error Handling: Comprehensive AWS API error handling
  • Session Management: Automatic AWS session and credential management
  • FastMCP Integration: Full compatibility with FastMCP framework
  • Type Safety: Proper type hints and validation

Architecture

┌─────────────────────────────────────────────────────────────┐
│            AWS Infrastructure Manager MCP Server            │
├─────────────────────────────────────────────────────────────┤
│  Core Services   │  Compute         │  Storage & Functions  │
│  • Identity      │  • EC2           │  • S3                 │
│  • Regions       │  • VPC           │  • RDS                │
│  • Error Handling│                  │  • Lambda             │
└─────────────────────────────────────────────────────────────┘
Enter fullscreen mode Exit fullscreen mode

Usage Examples

Using the MCP server with Kiro IDE or Amazon Q CLI

Add the following MCP server definition into your mcp.json file. For Amazon Q, the file is on .aws/amazonq/mcp.json path, while for Kiro the file is on .kiro/settings/mcp.json path. Modify /Users/sigitpriyanggoro/aws-infra-manager-mcp-server with your own directory structure to test it out.

{
  "mcpServers": {
    "aws-infra-manager": {
      "command": "uv",
      "args": [
        "run",
        "--directory",
        "/Users/sigitpriyanggoro/aws-infra-manager-mcp-server",
        "python",
        "-m",
        "aws_infra_manager_mcp_server.server"
      ],
      "env": {
        "AWS_REGION": "us-east-1"
      },
      "disabled": false,
      "autoApprove": [
        "get_caller_identity",
        "list_ec2_instances",
        "list_vpcs",
        "list_s3_buckets",
        "list_rds_instances",
        "list_lambda_functions",
        "get_aws_regions"
      ]
    }
  }
}
Enter fullscreen mode Exit fullscreen mode

Once configured, you can use the MCP tools directly in Kiro or Amazon Q CLI:

# List all EC2 instances
list all my ec2 instances

# Get AWS account information  
get my aws caller identity

# List VPCs
show me all my vpcs

# List S3 buckets
what s3 buckets do I have
Enter fullscreen mode Exit fullscreen mode

Here's a screenshot of using the MCP server from Kiro:

mcp-server-test-on-kiro

Here's a screenshot of using the MCP server from Amazon Q:

Note that I didn’t put mutating changes capabilities in this example such as create and delete for safer testing purposes. You can modify the MCP server capabilities by asking Kiro, and adjust the IAM policies to enable mutating changes.

🚀 Getting Started

The project example is designed for immediate exploration and testing:

# Quick setup
git clone https://github.com/sigitp-git/aws-infra-manager-mcp-server
cd aws-infra-manager-mcp-server
uv sync --extra dev
Enter fullscreen mode Exit fullscreen mode

Or you can start to develop your own MCP server with the example Kiro Vibe session prompt provided above.

Security and Compliance

IAM Permissions

The server requires specific IAM permissions for each AWS service, which you may need to modify to fit your use case. Remember to always follow IAM security best practices.

{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Effect": "Allow",
      "Action": [
        "sts:GetCallerIdentity",
        "ec2:DescribeInstances",
        "ec2:DescribeVpcs",
        "ec2:DescribeRegions",
        "s3:ListAllMyBuckets",
        "rds:DescribeDBInstances",
        "lambda:ListFunctions"
      ],
      "Resource": "*"
    }
  ]
}
Enter fullscreen mode Exit fullscreen mode

🎉 Conclusion

The "aws-infra-manager-mcp-server" represents an example Kiro built project in infrastructure management automation. By leveraging the Model Context Protocol and FastMCP SDK, we've created a powerful, extensible platform that bridges the gap between AI assistants and AWS infrastructure management.

The use of Kiro Vibe session for the initial development accelerates the creation process while ensuring best practices and comprehensive functionality. The resulting MCP server provides a foundation for intelligent infrastructure management that can evolve with your organization's needs.

Key Takeaways

  1. Kiro Vibe session is great for: rapid exploration and testing, building when requirements are unclear, and implementing a task such as what we are trying to accomplish in this blog
  2. FastMCP SDK accelerates development - Rapid prototyping and deployment of MCP servers
  3. The example MCP server we built in this project provides easy AWS infrastructure management using natural language prompts, which can be integrated with Amazon Q, Kiro, or other AI assistants

Next Steps

  1. Try it yourself! Run the Kiro Vibe session with the provided prompt, feel free to modify the prompt as needed
  2. Review and customize the generated code for your specific needs
  3. Set up testing environments for safe development and testing
  4. Deploy to your test environment following security best practices
  5. Test, monitor and iterate based on usage patterns and feedback
  6. Once you have more clarity on your requirements, write a comprehensive specification and refine your project with Kiro Spec session(s) 🙂

Using Kiro, we can easily build custom MCP servers to increase our productivity. This example MCP server we built using Kiro opens up new possibilities for infrastructure automation and management, making complex AWS operations accessible through simple, natural language interactions. The combination of MCP's standardized protocol and AWS's comprehensive service creates a powerful platform for the future of infrastructure management.


GitHub Example, Kiro generated: aws-infra-manager-mcp-server

License: MIT

Python Version: 3.10+

Top comments (0)