AWS Security Inspector MCP server

Enables security professionals to inspect and analyze AWS infrastructure for security issues through natural language queries about GuardDuty findings, IAM permissions, S3 buckets, and CloudFront distributions.
Back to servers
Setup instructions
Provider
groovyBugify
Release date
Apr 24, 2025
Language
Python
Stats
62 stars

AWS Security MCP is a server that implements the Model Context Protocol (MCP), allowing AI assistants like Claude to perform comprehensive AWS security analysis through natural language. It automatically discovers resources across multiple AWS accounts and provides security insights without requiring deep AWS CLI knowledge.

Prerequisites

Software Requirements

  • Python 3.11 or higher
  • uv package manager
  • AWS Account with appropriate IAM permissions
  • MCP Client (Claude Desktop, Cline, or compatible client)

AWS Permissions

Core MCP Permissions

{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Sid": "CrossAccountAccess",
      "Effect": "Allow",
      "Action": [
        "sts:AssumeRole"
      ],
      "Resource": "arn:aws:iam::*:role/aws-security-mcp-cross-account-access"
    },
    {
      "Sid": "OrganizationDiscovery",
      "Effect": "Allow",
      "Action": [
        "organizations:ListAccounts"
      ],
      "Resource": "*"
    }
  ]
}

Required AWS Managed Policies

You must attach the AWS managed SecurityAudit policy to your MCP Server's IAM user or role:

Policy ARN: arn:aws:iam::aws:policy/SecurityAudit

This policy is essential for AWS Security MCP functionality, providing read-only access to AWS security services.

Installation

  1. Clone the repository

    git clone https://github.com/groovyBugify/aws-security-mcp.git
    
  2. Configure AWS Credentials (optional if you already have AWS credentials configured)

  3. Start the Server

    chmod +x run_aws_security.sh
    ./run_aws_security.sh sse
    
  4. Configure MCP Client

    # Install mcp-proxy
    uv tool install mcp-proxy
    
    # Check location of mcp-proxy
    which mcp-proxy
    
    # Add to Claude Desktop config
    {
      "mcpServers": {
        "aws-security": {
          "command": "/path/to/mcp-proxy",
          "args": ["http://localhost:8000/sse"]
        }
      }
    }
    

Configuration

YAML Configuration

Edit config.yaml in the project root:

aws:
  region: "us-east-1"
  profile: null

server:
  log_level: "info"
  startup_quiet: false
  tool_quiet: false

cross_account:
  role_name: "aws-security-mcp-cross-account-access"
  auto_setup_on_startup: true
  max_concurrent_assumptions: 5

Environment Variable Override

Environment variables take precedence over YAML configuration:

export MCP_LOG_LEVEL=debug
export MCP_STARTUP_QUIET=false
export AWS_DEFAULT_REGION=eu-west-1

Usage Examples

Basic Infrastructure Queries

Query: "Can you share a list of running ec2 instances?"

Query: "Share all the secrets stored on env variables of Lambda functions, and share a list of functions for remediating this issue."

Query: "Check my 'prod-ecs-cluster' and share more details about the 'user-login' service, is it deployed?"

Security Analysis

Query: "Show all GuardDuty findings from the last 7 days, and priortise based on the risk of exposure."

Query: "Analyze IAM roles with administrative privileges"

Query: "Generate blast radius analysis for IP 172.16.1.10"

Query: "Fetch more details about the ip - 172.22.141.11, and share a network map for this resource."

Cross-Account Operations

Query: "List all connected AWS accounts"
Query: "Refresh my AWS session"
Query: "Find resources tagged Team:Security across all accounts"
Query: "Show compliance status across organization"

Cross-Account Access Setup

AWS Security MCP uses a hub-and-spoke model for multi-account access:

  1. Create the following role in each target AWS account:

Role Name: aws-security-mcp-cross-account-access

Trust Policy:

{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Effect": "Allow",
      "Principal": {
        "AWS": "arn:aws:iam::YOUR-MASTER-ACCOUNT-ID:root"
      },
      "Action": "sts:AssumeRole"
    }
  ]
}

Permissions: Attach AWS managed policy arn:aws:iam::aws:policy/SecurityAudit

Athena Integration

AWS Security MCP can integrate with Amazon Athena for advanced log analysis. The following log sources are recommended:

  • AWS CloudTrail
  • VPC Flow Logs
  • CloudFront Logs
  • ALB Access Logs
  • WAF Logs
  • AWS Shield Logs

Example queries:

Query: "Show all failed login attempts from external IPs in the last 24 hours"

Query: "Can you share what did '[email protected]' did in past 24 hours on my aws account? and share a timeline report?"

Query: "Correlate GuardDuty findings with CloudTrail and VPC Flow logs events"

Docker Deployment

docker build -t aws-security-mcp .
docker run -p 8000:8000 \
  -e AWS_ACCESS_KEY_ID=your_key \
  -e AWS_SECRET_ACCESS_KEY=your_secret \
  aws-security-mcp

Troubleshooting

Common Issues

Tool Discovery Fails

# Check AWS credentials
aws sts get-caller-identity

# Verify cross-account role exists
aws iam get-role --role-name aws-security-mcp-cross-account-access

Cross-Account Access Denied

# Test role assumption manually
aws sts assume-role \
  --role-arn arn:aws:iam::TARGET-ACCOUNT:role/aws-security-mcp-cross-account-access \
  --role-session-name test-session

Enable Debug Mode

export MCP_LOG_LEVEL=debug
export MCP_STARTUP_QUIET=false
python3 aws_security_mcp/main.py sse

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 "aws-security" '{"command":"/path/to/mcp-proxy","args":["http://localhost:8000/sse"]}'

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": {
        "aws-security": {
            "command": "/path/to/mcp-proxy",
            "args": [
                "http://localhost:8000/sse"
            ]
        }
    }
}

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": {
        "aws-security": {
            "command": "/path/to/mcp-proxy",
            "args": [
                "http://localhost:8000/sse"
            ]
        }
    }
}

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