Manage AWS Resources with Python
Query or modify any AWS resource by running generated boto3 Python code through a sandboxed MCP tool - not limited to read-only operations.
Why it matters
Execute Python code to query and modify any AWS resources using boto3. This asset provides a secure and flexible way to manage your AWS infrastructure through an MCP server.
Outcomes
What it gets done
Query AWS resources using boto3 code snippets.
Modify AWS resources with Python execution.
Integrate with AWS services via Docker or direct execution.
Leverage multiple AWS authentication methods.
Install
Add it to your toolbox
Run in your project directory:
curl -fsSL https://spark.entire.vc/get/vb-aws-resources-operations | bash Capabilities
Tools your agent gets
Executes a boto3 code snippet to query or modify AWS resources with isolated Python execution
Overview
AWS Resources Operations MCP Server
An MCP server that executes generated boto3 Python code against AWS, returning JSON results, with sandboxed imports but no restriction to read-only operations. Reach for this when you want an AI assistant to flexibly query or manage AWS resources via generated code, and only after scoping IAM credentials carefully since it can perform mutating operations.
What it does
This MCP server runs generated Python code against boto3 to query - or modify - any AWS resource. Rather than exposing a fixed set of per-service tools, it provides a single flexible tool, aws_resources_query_or_modify, that executes a Python code snippet using boto3 and returns whatever the snippet assigns to a result variable, automatically serialized to JSON with proper handling of AWS-specific objects and datetime values.
The execution environment restricts imports to boto3, operator, json, datetime, pytz, dateutil, re, and time, and limits built-in functions to basic types, common operations (len, max, min, sorted, filter, map, sum, any, all), and object introspection (hasattr, getattr, isinstance). Code is validated with AST-based analysis before execution to check imports and structure. The server was built as a Python/Docker alternative to a Node.js-based AWS MCP server the author found unstable, and to AWS Chatbot's limited free tier (25 queries/month).
docker pull buryhuang/mcp-server-aws-resources:latest
When to use - and when NOT to
Use this when you want an AI assistant to query or manage arbitrary AWS resources - listing S3 buckets, checking the latest CodePipeline deployment, or debugging something like a DynamoDB permission error - without writing and running a one-off boto3 script yourself.
Do NOT use this without understanding the risk: operations are explicitly NOT limited to read-only. The author states plainly that your AWS IAM user role dictates what the tool can do, so if that role has write or delete permissions, generated code can modify or destroy AWS resources. Scope the IAM credentials tightly before connecting this to any AI assistant.
Capabilities
- Execute arbitrary boto3-based Python snippets against any AWS service the configured credentials can reach
- AST-based validation of code structure and allowed imports before execution
- Restricted execution sandbox (limited imports and built-ins)
- Automatic JSON serialization of results, including AWS-specific objects and datetimes
- Works with static access keys, session tokens, or a named
~/.aws/credentialsprofile
How to install
Pull and run the Docker image, providing AWS credentials as environment variables or by mounting ~/.aws:
docker pull buryhuang/mcp-server-aws-resources:latest
docker run \
-e AWS_ACCESS_KEY_ID=your_access_key_id_here \
-e AWS_SECRET_ACCESS_KEY=your_secret_access_key_here \
-e AWS_DEFAULT_REGION=us-east-1 \
buryhuang/mcp-server-aws-resources:latest
Also installable via Smithery (npx -y @smithery/cli install mcp-server-aws-resources-python --client claude), or by cloning the repo and running it with uv. Supports linux/amd64, linux/arm64, and linux/arm/v7.
Who it's for
Python-comfortable DevOps and cloud engineers who want an AI assistant to query or manage AWS resources flexibly through generated boto3 code, and who will scope IAM permissions carefully given the tool is not restricted to read-only actions.
Source README
AWS Resources MCP Server
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.
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:
- Setup Hassle: Had to clone a git repo and deal with local setup
- Stability Issues: Wasn't stable enough on my Mac
- 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:
- List S3 buckets:
s3 = session.client('s3')
result = s3.list_buckets()
- Get latest CodePipeline deployment:
def get_latest_deployment(pipeline_name):
codepipeline = session.client('codepipeline')
result = codepipeline.list_pipeline_executions(
pipelineName=pipeline_name,
maxResults=5
)
if result['pipelineExecutionSummaries']:
latest_execution = max(
[e for e in result['pipelineExecutionSummaries']
if e['status'] == 'Succeeded'],
key=itemgetter('startTime'),
default=None
)
if latest_execution:
result = codepipeline.get_pipeline_execution(
pipelineName=pipeline_name,
pipelineExecutionId=latest_execution['pipelineExecutionId']
)
else:
result = None
else:
result = None
return result
result = get_latest_deployment("your-pipeline-name")
Note: All code snippets must set a result variable that will be returned to the client. The result variable will be automatically converted to JSON format, with proper handling of AWS-specific objects and datetime values.
Tools
The server offers a tool for executing AWS queries:
aws_resources_query_or_modify- Execute a boto3 code snippet to query or modify AWS resources
- Input:
code_snippet(string): Python code using boto3 to query AWS resources- The code must set a
resultvariable with the query output
- Allowed imports:
- boto3
- operator
- json
- datetime
- pytz
- dateutil
- re
- time
- 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
Implementation Details
The server includes several safety features:
- AST-based code analysis to validate imports and code structure
- Restricted execution environment with limited built-in functions
- JSON serialization of results with proper handling of AWS-specific objects
- Proper error handling and reporting
Setup
Prerequisites
You'll need AWS credentials with appropriate permissions to query AWS resources. You can obtain these by:
- Creating an IAM user in your AWS account
- Generating access keys for programmatic access
- 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 keyAWS_SECRET_ACCESS_KEY: Your AWS secret keyAWS_SESSION_TOKEN: (Optional) AWS session token if using temporary credentialsAWS_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:
npx -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
docker pull buryhuang/mcp-server-aws-resources:latest
Option 2: Build Locally
docker build -t mcp-server-aws-resources .
Run the container:
docker run \
-e AWS_ACCESS_KEY_ID=your_access_key_id_here \
-e AWS_SECRET_ACCESS_KEY=your_secret_access_key_here \
-e AWS_DEFAULT_REGION=your_AWS_DEFAULT_REGION \
buryhuang/mcp-server-aws-resources:latest
Or using stored credentials and a profile:
docker run \
-e AWS_PROFILE=[AWS_PROFILE_NAME] \
-v ~/.aws:/root/.aws \
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:
Create a new builder instance (if you haven't already):
docker buildx create --useBuild and push the image for multiple platforms:
docker buildx build --platform linux/amd64,linux/arm64,linux/arm/v7 -t buryhuang/mcp-server-aws-resources:latest --push .Verify the image is available for the specified platforms:
docker 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
{
"mcpServers": {
"aws-resources": {
"command": "docker",
"args": [
"run",
"-i",
"--rm",
"-e",
"AWS_ACCESS_KEY_ID=your_access_key_id_here",
"-e",
"AWS_SECRET_ACCESS_KEY=your_secret_access_key_here",
"-e",
"AWS_DEFAULT_REGION=us-east-1",
"buryhuang/mcp-server-aws-resources:latest"
]
}
}
}
Example using PROFILE and mounting local AWS credentials
{
"mcpServers": {
"aws-resources": {
"command": "docker",
"args": [
"run",
"-i",
"--rm",
"-e",
"AWS_PROFILE=default",
"-v",
"~/.aws:/root/.aws",
"buryhuang/mcp-server-aws-resources:latest"
]
}
}
}
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"
]
}
}
}
FAQ
Common questions
Discussion
Questions & comments · 0
Sign In Sign in to leave a comment.