AWS Resources MCP Server
AWS 资源 MCP 服务器
概述
模型上下文协议 (MCP) 服务器实现,提供运行生成的 python 代码以通过 boto3 查询任何 AWS 资源。
风险自负:我没有将操作限制为 ReadyOnly,以便谨慎的运维人员能够使用此工具进行管理操作。您的 AWS 用户角色将决定您可以执行的操作权限。
演示:修复 Dynamodb 权限错误
https://github.com/user-attachments/assets/de88688d-d7a0-45e1-94eb-3f5d71e9a7c7
Related MCP server: MCP Development Server
为什么要使用另一个 AWS MCP 服务器?
我尝试了 AWS Chatbot 的开发者访问权限。免费套餐每月资源查询次数限制为 25 次。下一个套餐是每月 19 美元,包含 90% 我不常用的功能。结果以 JSON 格式呈现,并且有很多限制。
我尝试使用aws-mcp ,但遇到了一些问题:
设置麻烦:必须克隆 git repo 并处理本地设置
稳定性问题:在我的 Mac 上不够稳定
Node.js Stack :作为一名 Python 开发人员,我无法有效地为 Node.js 代码库做出贡献
因此我创建了这个新方法:
直接从 Docker 镜像运行 - 无需 git clone
使用 Python 和 boto3 来获得更好的稳定性
让 Python 开发者更容易做出贡献
包含适当的代码执行沙盒
保持所有物品容器化并保持清洁
有关模型上下文协议及其工作原理的更多信息,请参阅Anthropic 的 MCP 文档。
成分
资源
服务器公开以下资源:
aws://query_resources:通过 boto3 查询提供对 AWS 资源的访问的动态资源
示例查询
以下是您可以执行的一些示例查询:
列出 S3 存储桶:
s3 = session.client('s3')
result = s3.list_buckets()获取最新的 CodePipeline 部署:
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")注意:所有代码片段都必须设置一个将返回给客户端的result变量。该result变量将自动转换为 JSON 格式,并正确处理 AWS 特定的对象和日期时间值。
工具
该服务器提供了执行 AWS 查询的工具:
aws_resources_query_or_modify执行 boto3 代码片段来查询或修改 AWS 资源
输入:
code_snippet(字符串):使用 boto3 查询 AWS 资源的 Python 代码代码必须设置查询输出的
result变量
允许进口:
博托3
操作员
json
日期时间
皮茨
日期实用程序
关于
时间
可用的内置函数:
基本类型:dict、list、tuple、set、str、int、float、bool
操作:len、max、min、sorted、filter、map、sum、any、all
对象处理:hasattr、getattr、isinstance
其他:打印、导入
实现细节
该服务器包含几个安全功能:
基于 AST 的代码分析来验证导入和代码结构
受限的执行环境,内置函数有限
对结果进行 JSON 序列化,并正确处理特定于 AWS 的对象
正确的错误处理和报告
设置
先决条件
您需要拥有具有适当权限的 AWS 凭证才能查询 AWS 资源。您可以通过以下方式获取这些凭证:
在您的 AWS 账户中创建 IAM 用户
生成用于编程访问的访问密钥
确保 IAM 用户具有要查询的 AWS 服务的必要权限
需要以下环境变量:
AWS_ACCESS_KEY_ID:您的 AWS 访问密钥AWS_SECRET_ACCESS_KEY:您的 AWS 密钥AWS_SESSION_TOKEN:(可选)如果使用临时凭证,则使用 AWS 会话令牌AWS_DEFAULT_REGION:AWS 区域(如果未设置,则默认为“us-east-1”)
您还可以使用存储在~/.aws/credentials文件中的配置文件。为此,请将AWS_PROFILE环境变量设置为配置文件名称。
注意:请确保您的 AWS 凭证安全,切勿将其提交到版本控制中。
通过 Smithery 安装
要通过Smithery自动为 Claude Desktop 安装 AWS Resources MCP Server:
npx -y @smithery/cli install mcp-server-aws-resources-python --client claudeDocker 安装
您可以在本地构建镜像,也可以从 Docker Hub 拉取。该镜像是为 Linux 平台构建的。
支持的平台
Linux/amd64
Linux/arm64
Linux/arm/v7
选项 1:从 Docker Hub 拉取
docker pull buryhuang/mcp-server-aws-resources:latest选项 2:本地构建
docker build -t mcp-server-aws-resources .运行容器:
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或者使用存储的凭证和配置文件:
docker run \
-e AWS_PROFILE=[AWS_PROFILE_NAME] \
-v ~/.aws:/root/.aws \
buryhuang/mcp-server-aws-resources:latest跨平台发布
要为多个平台发布 Docker 镜像,可以使用docker buildx命令。请按以下步骤操作:
创建一个新的构建器实例(如果还没有):
docker buildx create --use为多个平台构建并推送图像:
docker buildx build --platform linux/amd64,linux/arm64,linux/arm/v7 -t buryhuang/mcp-server-aws-resources:latest --push .验证该图像是否适用于指定的平台:
docker buildx imagetools inspect buryhuang/mcp-server-aws-resources:latest
与 Claude Desktop 一起使用
使用 Docker 运行
使用 ACCESS_KEY_ID 和 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"
]
}
}
}使用 PROFILE 并安装本地 AWS 凭证的示例
{
"mcpServers": {
"aws-resources": {
"command": "docker",
"args": [
"run",
"-i",
"--rm",
"-e",
"AWS_PROFILE=default",
"-v",
"~/.aws:/root/.aws",
"buryhuang/mcp-server-aws-resources:latest"
]
}
}
}使用 Git clone 运行
使用 git clone 和 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"
]
}
}
}Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- FlicenseCqualityDmaintenanceA Model Context Protocol (MCP) server that enables AI assistants like Claude to interact with your AWS environment. This allows for natural language querying and management of your AWS resources during conversations. Think of better Amazon Q alternative.3295
- Flicense-qualityDmaintenanceA Model Context Protocol server that enables Claude to manage software development projects with complete context awareness and code execution through Docker environments.244
- AlicenseAqualityFmaintenanceA Model Context Protocol server implementation that enables Claude to perform AWS operations on S3 and DynamoDB services through natural language commands.23127MIT
- Alicense-qualityCmaintenanceA Model Context Protocol server that enables AI assistants like Claude to perform Python development tasks through file operations, code analysis, project management, and safe code execution.9MIT
Related MCP Connectors
A comprehensive Model Context Protocol (MCP) server that enables AI assistants to interact with yo…
Hosted Amazon Seller Central and Amazon Ads MCP server for Claude, ChatGPT, Cursor, and agents.
Hosted Amazon Seller and Vendor MCP server for Claude, ChatGPT, Cursor, Codex, Gemini, Copilot.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/baryhuang/mcp-server-aws-resources-python'
If you have feedback or need assistance with the MCP directory API, please join our Discord server