MCP Now
AWS Resources Operations

AWS Resources Operations

by baryhuang
GitHub

Run generated python code to securely query or modify any AWS resources supported by boto3.

aws
docker
result
query
resource

AWS Resources MCP Server

Docker Hub smithery badge

Overview

A Model Context Protocol (MCP) server implementation that provides running generated python code to query any AWS resources through boto3.

At your own risk: I didn't limit the operations to ReadyOnly, so that cautious Ops people can be helped using this tool doing management operations. Your AWS user role will dictate the permissions for what you can do.

image

Demo: Fix Dynamodb Permission Error

https://github.com/user-attachments/assets/de88688d-d7a0-45e1-94eb-3f5d71e9a7c7

Why Another AWS MCP Server?

I tried AWS Chatbot with Developer Access. Free Tier has a limit of 25 query/month for resources. Next tier is $19/month include 90% of the features I don't use. And the results are in a fashion of JSON and a lot of restrictions.

I tried using aws-mcp but ran into a few issues:

  1. Setup Hassle: Had to clone a git repo and deal with local setup
  2. Stability Issues: Wasn't stable enough on my Mac
  3. Node.js Stack: As a Python developer, I couldn't effectively contribute back to the Node.js codebase

So I created this new approach that:

  • Runs directly from a Docker image - no git clone needed
  • Uses Python and boto3 for better stability
  • Makes it easy for Python folks to contribute
  • Includes proper sandboxing for code execution
  • Keeps everything containerized and clean

For more information about the Model Context Protocol and how it works, see Anthropic's MCP documentation.

Components

Resources

The server exposes the following resource:

  • aws://query_resources: A dynamic resource that provides access to AWS resources through boto3 queries

Example Queries

Here are some example queries you can execute:

1s3 = session.client('s3') 2result = s3.list_buckets()
  1. Get latest CodePipeline deployment:
1def get_latest_deployment(pipeline_name): 2 codepipeline = session.client('codepipeline') 3 4 result = codepipeline.list_pipeline_executions( 5 pipelineName=pipeline_name, 6 maxResults=5 7 ) 8 9 if result['pipelineExecutionSummaries']: 10 latest_execution = max( 11 [e for e in result['pipelineExecutionSummaries'] 12 if e['status'] == 'Succeeded'], 13 key=itemgetter('startTime'), 14 default=None 15 ) 16 17 if latest_execution: 18 result = codepipeline.get_pipeline_execution( 19 pipelineName=pipeline_name, 20 pipelineExecutionId=latest_execution['pipelineExecutionId'] 21 ) 22 else: 23 result = None 24 else: 25 result = None 26 27 return result 28 29result = get_latest_deployment("your-pipeline-name")

Tools

The server offers a tool for executing AWS queries:

  • query_aws_resources
    • Execute a boto3 code snippet to query AWS resources
    • Input:
      • code_snippet (string): Python code using boto3 to query AWS resources
      • The code must set a result variable with the query output
    • Allowed imports:
      • boto3
      • operator
      • json
      • datetime
      • pytz
    • Available built-in functions:
      • Basic types: dict, list, tuple, set, str, int, float, bool
      • Operations: len, max, min, sorted, filter, map, sum, any, all
      • Object handling: hasattr, getattr, isinstance
      • Other: print, import

Setup

Prerequisites

You'll need AWS credentials with appropriate permissions to query AWS resources. You can obtain these by:

  1. Creating an IAM user in your AWS account
  2. Generating access keys for programmatic access
  3. Ensuring the IAM user has necessary permissions for the AWS services you want to query

The following environment variables are required:

  • AWS_ACCESS_KEY_ID: Your AWS access key
  • AWS_SECRET_ACCESS_KEY: Your AWS secret key
  • AWS_SESSION_TOKEN: (Optional) AWS session token if using temporary credentials
  • AWS_DEFAULT_REGION: AWS region (defaults to 'us-east-1' if not set)

You can also use a profile stored in the ~/.aws/credentials file. To do this, set the AWS_PROFILE environment variable to the profile name.

Note: Keep your AWS credentials secure and never commit them to version control.

Installing via Smithery

To install AWS Resources MCP Server for Claude Desktop automatically via Smithery:

1npx -y @smithery/cli install mcp-server-aws-resources-python --client claude

Docker Installation

You can either build the image locally or pull it from Docker Hub. The image is built for the Linux platform.

Supported Platforms

  • Linux/amd64
  • Linux/arm64
  • Linux/arm/v7

Option 1: Pull from Docker Hub

1docker pull buryhuang/mcp-server-aws-resources:latest

Option 2: Build Locally

1docker build -t mcp-server-aws-resources .

Run the container:

1docker run \ 2 -e AWS_ACCESS_KEY_ID=your_access_key_id_here \ 3 -e AWS_SECRET_ACCESS_KEY=your_secret_access_key_here \ 4 -e AWS_DEFAULT_REGION=your_AWS_DEFAULT_REGION \ 5 buryhuang/mcp-server-aws-resources:latest

Or using stored credentials and a profile:

1docker run \ 2 -e AWS_PROFILE=[AWS_PROFILE_NAME] \ 3 -v ~/.aws:/root/.aws \ 4 buryhuang/mcp-server-aws-resources:latest

Cross-Platform Publishing

To publish the Docker image for multiple platforms, you can use the docker buildx command. Follow these steps:

  1. Create a new builder instance (if you haven't already):

    1docker buildx create --use
  2. Build and push the image for multiple platforms:

    1docker buildx build --platform linux/amd64,linux/arm64,linux/arm/v7 -t buryhuang/mcp-server-aws-resources:latest --push .
  3. Verify the image is available for the specified platforms:

    1docker buildx imagetools inspect buryhuang/mcp-server-aws-resources:latest

Usage with Claude Desktop

Running with Docker

Example using ACCESS_KEY_ID and SECRET_ACCESS_KEY

1{ 2 "mcpServers": { 3 "aws-resources": { 4 "command": "docker", 5 "args": [ 6 "run", 7 "-i", 8 "--rm", 9 "-e", 10 "AWS_ACCESS_KEY_ID=your_access_key_id_here", 11 "-e", 12 "AWS_SECRET_ACCESS_KEY=your_secret_access_key_here", 13 "-e", 14 "AWS_DEFAULT_REGION=us-east-1", 15 "buryhuang/mcp-server-aws-resources:latest" 16 ] 17 } 18 } 19}

Example using PROFILE and mounting local AWS credentials

1{ 2 "mcpServers": { 3 "aws-resources": { 4 "command": "docker", 5 "args": [ 6 "run", 7 "-i", 8 "--rm", 9 "-e", 10 "AWS_PROFILE=default", 11 "-v", 12 "~/.aws:/root/.aws", 13 "buryhuang/mcp-server-aws-resources:latest" 14 ] 15 } 16 } 17}

Running with Git clone

Example running with git clone and profile

{
  "mcpServers": {
    "aws": {
      "command": "/Users/gmr/.local/bin/uv",
      "args": [
        "--directory",
        "/<your-path>/mcp-server-aws-resources-python",
        "run",
        "src/mcp_server_aws_resources/server.py",
        "--profile",
        "testing"
      ]
    }
  }
}