๐Ÿš€ MCP-AWS: AI Agent for AWS EC2 Management

๐Ÿš€ MCP-AWS: AI Agent for AWS EC2 Management

POC : MCP server with openAI agents SDK

anirban1592

Developer Tools
Visit Server

README

๐Ÿš€ MCP-AWS: AI Agent for AWS EC2 Management

Welcome to MCP-AWS, a simple yet powerful AI-driven application that leverages OpenAI Agents and MCP servers to manage AWS EC2 instances. This app allows you to provision and terminate EC2 instances using natural language commands in your terminal. ๐Ÿ–ฅ๏ธโœจ


๐ŸŽฅ Demo Video

Watch the demo video to see MCP-AWS in action! ๐Ÿš€

Watch the Demo


๐ŸŒŸ Features

  1. Provision EC2 Instances: Just tell the AI agent to create an EC2 instance, and it will handle the rest, providing you with the instance ID. ๐Ÿ› ๏ธ
  2. Terminate EC2 Instances: Provide the instance ID, and the agent will terminate the instance for you. โŒ
  3. MCP Server Integration: Explore how custom MCP servers can be created and integrated with OpenAI Agents SDK. ๐Ÿงฉ

๐Ÿ› ๏ธ Tools in the MCP Server

The MCP server is a custom server with two tools:

  1. initiate_aws_ec2_instance: Creates an AWS EC2 instance.
  2. terminate_aws_ec2_instance: Terminates an AWS EC2 instance by its ID.

๐Ÿš€ Getting Started

Prerequisites

  1. Python 3.12+ (for local setup) or Docker (for containerized setup)
  2. AWS IAM Role: Create an IAM role with the necessary permissions to manage EC2 instances.
  3. Environment Variables: Prepare a .env file with the following variables:
    • AWS_ACCESS_KEY_ID
    • AWS_SECRET_ACCESS_KEY
    • AWS_DEFAULT_REGION
    • OPENAI_API_KEY
    • AMI_ID
    • INSTANCE_TYPE
    • KEY_NAME
    • SECURITY_GROUP_IDS
    • AWS_REGION

๐Ÿƒโ€โ™‚๏ธ Running the App

  1. Clone the repository:
    git clone https://github.com/anirban1592/mcp-server-aws.git
    cd mcp-aws
    
  2. Create .env file as shown in prerequisites

Option 1: Docker Setup (Recommended)

  1. Build the Docker image:
    docker image build -t my-mcp .
    
  2. Run the container:
    docker container run -it my-mcp
    

Option 2: Local Setup

  1. Create and activate virtual environment:

    pip install uv
    uv venv .venv
    # Windows
    .venv\Scripts\activate
    # Unix/MacOS
    source .venv/bin/activate
    
  2. Run the application:

    cd openai-agent/
    uv run agent.py
    

๐Ÿ’ฌ Using the AI Agent

  1. To create an EC2 instance:

    Enter your command: Create an EC2 instance
    
  2. To terminate an EC2 instance:

    Enter your command: Terminate EC2 instance with ID <instance-id>
    

โš ๏ธ Word of Caution

  • IAM Role and Credentials: Please create AWS IAM roles and credentials at your own risk. Ensure you follow AWS best practices for security.
  • Billing and Security: This app is a proof of concept (POC) and is intended for learning purposes only. We are not responsible for any billing issues or security incidents.

๐Ÿ“š Learnings

This project demonstrates:

  1. How to integrate MCP servers with OpenAI Agents SDK
  2. How to build a simple AI-driven application for AWS resource management

Enjoy exploring the power of AI and MCP servers! ๐ŸŒŸ

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
MCP Package Docs Server

MCP Package Docs Server

Facilitates LLMs to efficiently access and fetch structured documentation for packages in Go, Python, and NPM, enhancing software development with multi-language support and performance optimization.

Featured
Local
TypeScript
Claude Code MCP

Claude Code MCP

An implementation of Claude Code as a Model Context Protocol server that enables using Claude's software engineering capabilities (code generation, editing, reviewing, and file operations) through the standardized MCP interface.

Featured
Local
JavaScript
@kazuph/mcp-taskmanager

@kazuph/mcp-taskmanager

Model Context Protocol server for Task Management. This allows Claude Desktop (or any MCP client) to manage and execute tasks in a queue-based system.

Featured
Local
JavaScript
Linear MCP Server

Linear MCP Server

Enables interaction with Linear's API for managing issues, teams, and projects programmatically through the Model Context Protocol.

Featured
JavaScript
mermaid-mcp-server

mermaid-mcp-server

A Model Context Protocol (MCP) server that converts Mermaid diagrams to PNG images.

Featured
JavaScript
Jira-Context-MCP

Jira-Context-MCP

MCP server to provide Jira Tickets information to AI coding agents like Cursor

Featured
TypeScript
Linear MCP Server

Linear MCP Server

A Model Context Protocol server that integrates with Linear's issue tracking system, allowing LLMs to create, update, search, and comment on Linear issues through natural language interactions.

Featured
JavaScript
Sequential Thinking MCP Server

Sequential Thinking MCP Server

This server facilitates structured problem-solving by breaking down complex issues into sequential steps, supporting revisions, and enabling multiple solution paths through full MCP integration.

Featured
Python