π MCP-AWS: AI Agent for AWS EC2 Management
LocalAbout π MCP-AWS: AI Agent for AWS EC2 Management
MCP-AWS is a proof-of-concept terminal app for using an OpenAI agent to manage AWS EC2 instances with natural-language commands. Its custom MCP server exposes tools to create and terminate instances.
Key features
- 01Provision AWS EC2 instances
- 02Terminate instances by ID
- 03Natural-language terminal interaction
- 04Integrate custom MCP tools with OpenAI Agents SDK
Use cases
- 01Create an EC2 instance from a terminal request
- 02Terminate an EC2 instance by its ID
- 03Explore MCP server integration with OpenAI Agents SDK
MCP support
The custom MCP server exposes tools to create EC2 instances and terminate them by instance ID. The project demonstrates integration with OpenAI Agents SDK.
Configuration
Local server config is the same for every client. Copy it into your clientβs MCP config file.
Tools
Local servers expose tools only once running on your machine, and the maintainer has not provided a tool list.
Details
From the project 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! π
π Features
- 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. π οΈ
- Terminate EC2 Instances: Provide the instance ID, and the agent will terminate the instance for you. β
- 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:
initiate_aws_ec2_instance: Creates an AWS EC2 instance.terminate_aws_ec2_instance: Terminates an AWS EC2 instance by its ID.
π Getting Started
Prerequisites
- Python 3.12+ (for local setup) or Docker (for containerized setup)
- AWS IAM Role: Create an IAM role with the necessary permissions to manage EC2 instances.
- Environment Variables: Prepare a
.envfile with the following variables:AWS_ACCESS_KEY_IDAWS_SECRET_ACCESS_KEYAWS_DEFAULT_REGIONOPENAI_API_KEYAMI_IDINSTANCE_TYPEKEY_NAMESECURITY_GROUP_IDSAWS_REGION
πββοΈ Running the App
- Clone the repository:
git clone https://github.com/anirban1592/mcp-server-aws.git cd mcp-aws - Create
.envfile as shown in prerequisites
Option 1: Docker Setup (Recommended)
- Build the Docker image:
docker image build -t my-mcp . - Run the container:
docker container run -it my-mcp
Option 2: Local Setup
-
Create and activate virtual environment:
pip install uv uv venv .venv # Windows .venv\Scripts\activate # Unix/MacOS source .venv/bin/activate -
Run the application:
cd openai-agent/ uv run agent.py
π¬ Using the AI Agent
-
To create an EC2 instance:
Enter your command: Create an EC2 instance -
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:
- How to integrate MCP servers with OpenAI Agents SDK
- How to build a simple AI-driven application for AWS resource management
Enjoy exploring the power of AI and MCP servers! π
Comments
New to MCP?
From what the protocol is to installing your first server, these answers cover most first questions.
An open protocol that defines how AI applications connect to external tools and data in a uniform way. Clients talk to the model; MCP servers provide tools, resources and prompt templates. They exchange standard messages, so one server can be reused by many clients.
