AI Infrastructure Agent (AWS) MCP server

Provides autonomous AWS infrastructure management through natural language processing, combining real-time resource discovery with AI-driven planning to execute step-by-step deployments across EC2, VPC, RDS, and security groups while maintaining persistent state tracking and conflict resolution.
Back to servers
Setup instructions
Provider
VersusControl
Release date
Aug 31, 2025
Language
Python
Stats
138 stars

AI Infrastructure Agent is an intelligent system for managing AWS infrastructure through natural language commands. Powered by advanced AI models (OpenAI GPT, Google Gemini, Anthropic Claude, or AWS Bedrock Nova), it translates infrastructure requests into executable AWS operations while providing safety features like conflict detection and resolution.

Installation

Clone the Repository

git clone https://github.com/VersusControl/ai-infrastructure-agent.git
cd ai-infrastructure-agent

Configure the Agent

Edit the main configuration file:

# Edit the main configuration
nano config.yaml

Choose your preferred AI provider in the configuration:

agent:
  provider: "openai"          # Options: openai, gemini, anthropic, bedrock
  model: "gpt-4"             # Model to use
  max_tokens: 4000
  temperature: 0.1
  dry_run: true              # Start with dry-run enabled
  auto_resolve_conflicts: false

Set Environment Variables

Depending on your chosen AI provider, you'll need to set specific API keys:

# For OpenAI
export OPENAI_API_KEY="your-openai-api-key"

# For Google Gemini
export GEMINI_API_KEY="your-gemini-api-key"

# For AWS Bedrock Nova - use AWS credentials (no API key needed)
# Configure AWS credentials using: aws configure, environment variables, or IAM roles

Configure AWS Credentials

# Configure AWS CLI
aws configure

# Or set environment variables
export AWS_ACCESS_KEY_ID="your-access-key"
export AWS_SECRET_ACCESS_KEY="your-secret-key"
export AWS_DEFAULT_REGION="us-west-2"

Deployment Options

Option 1: Docker Installation

Basic Docker Run:

docker run -d \
  --name ai-infrastructure-agent \
  -p 8080:8080 \
  -v $(pwd)/config.yaml:/app/config.yaml:ro \
  -v $(pwd)/states:/app/states \
  -e OPENAI_API_KEY="your-openai-api-key-here" \
  -e AWS_ACCESS_KEY_ID="your-aws-access-key" \
  -e AWS_SECRET_ACCESS_KEY="your-aws-secret-key" \
  -e AWS_DEFAULT_REGION="us-west-2" \
  ghcr.io/versuscontrol/ai-infrastructure-agent

Using Docker Compose (Recommended):

Create a docker-compose.yml file:

version: '3.8'

services:
  ai-infrastructure-agent:
    image: ghcr.io/versuscontrol/ai-infrastructure-agent
    container_name: ai-infrastructure-agent
    restart: unless-stopped
    ports:
      - "8080:8080"
    volumes:
      # Mount configuration file (read-only)
      - ./config.yaml:/app/config.yaml:ro
      # Mount data directories (persistent)
      - ./states:/app/states
    environment:
      # AI Provider API Keys (choose one)
      - OPENAI_API_KEY=${OPENAI_API_KEY}
      # - GEMINI_API_KEY=${GEMINI_API_KEY}
      # - ANTHROPIC_API_KEY=${ANTHROPIC_API_KEY}
      
      # AWS Configuration
      - AWS_ACCESS_KEY_ID=${AWS_ACCESS_KEY_ID}
      - AWS_SECRET_ACCESS_KEY=${AWS_SECRET_ACCESS_KEY}
      - AWS_DEFAULT_REGION=${AWS_DEFAULT_REGION:-us-west-2}

Start the application:

# Start with Docker Compose
docker-compose up -d

# View logs
docker-compose logs -f

# Stop the application
docker-compose down

Option 2: Automated Bash Script

# Clone the repository
git clone https://github.com/VersusControl/ai-infrastructure-agent.git
cd ai-infrastructure-agent

# Run the installation script
./scripts/install.sh

# Start the Web UI
./scripts/run-web-ui.sh

Access the Dashboard

Open your browser and navigate to:

http://localhost:8080

Usage Examples

The agent can handle various infrastructure requests through natural language. Here are some examples:

"Create a t3.micro EC2 instance with Ubuntu 22.04"

"Deploy a load-balanced web application with 2 EC2 instances behind an ALB"

"Create an RDS MySQL database with read replicas in multiple AZs"

"Set up a development environment with VPC, subnets, EC2, and RDS"

Example Workflow

When you submit a request like:

"Create an EC2 instance for hosting an Apache Server with a dedicated security group that allows inbound HTTP (port 80) and SSH (port 22) traffic."

The agent will:

  1. Analyze your request and create a detailed execution plan
  2. Present the plan for your review and approval
  3. Execute the plan in the correct order (after approval)
  4. Monitor progress in real-time

Troubleshooting

AWS Authentication Issues

# Check AWS credentials
aws sts get-caller-identity

# Verify permissions
aws iam get-user

# Test basic AWS access
aws ec2 describe-regions

AI Provider API Issues

# Check API key is set
echo $OPENAI_API_KEY

# Test API connection
curl -H "Authorization: Bearer $OPENAI_API_KEY" \
     https://api.openai.com/v1/models

Port Already in Use

# Check what's using the port
lsof -i :8080
lsof -i :3000

# Kill processes if needed
kill -9 <pid>

# Or change ports in config.yaml

Low Confidence Errors

If you encounter "Decision validation failed: decision confidence too low" errors, try increasing max_tokens in your config:

agent:
  provider: "gemini"
  model: "gemini-2.5-flash-lite"
  max_tokens: 10000  # Increase this value

Security Considerations

  • Never commit API keys to version control
  • Use least-privilege IAM policies for AWS access
  • Run in private networks when possible
  • Enable comprehensive logging for compliance
  • Always test in dry-run mode first before making changes

How to install this MCP server

For Claude Code

To add this MCP server to Claude Code, run this command in your terminal:

claude mcp add-json "ai-infrastructure-agent" '{"command":"npx","args":["-y","ai-infrastructure-agent"]}'

See the official Claude Code MCP documentation for more details.

For Cursor

There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json file so that it is available in all of your projects.

If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json file.

Adding an MCP server to Cursor globally

To add a global MCP server go to Cursor Settings > Tools & Integrations and click "New MCP Server".

When you click that button the ~/.cursor/mcp.json file will be opened and you can add your server like this:

{
    "mcpServers": {
        "ai-infrastructure-agent": {
            "command": "npx",
            "args": [
                "-y",
                "ai-infrastructure-agent"
            ]
        }
    }
}

Adding an MCP server to a project

To add an MCP server to a project you can create a new .cursor/mcp.json file or add it to the existing one. This will look exactly the same as the global MCP server example above.

How to use the MCP server

Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.

The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.

You can also explicitly ask the agent to use the tool by mentioning the tool name and describing what the function does.

For Claude Desktop

To add this MCP server to Claude Desktop:

1. Find your configuration file:

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Windows: %APPDATA%\Claude\claude_desktop_config.json
  • Linux: ~/.config/Claude/claude_desktop_config.json

2. Add this to your configuration file:

{
    "mcpServers": {
        "ai-infrastructure-agent": {
            "command": "npx",
            "args": [
                "-y",
                "ai-infrastructure-agent"
            ]
        }
    }
}

3. Restart Claude Desktop for the changes to take effect

Want to 10x your AI skills?

Get a free account and learn to code + market your apps using AI (with or without vibes!).

Nah, maybe later