AWS Resources MCP Server
以下摘录自该仓库的 README(片段) · 在 GitHub 读完整 README →
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:
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:
1. List S3 buckets:
2. Get latest CodePipeline deployment:
**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 result variable 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: