AWS Infrastructure MCP Server
Enables Claude AI to automatically audit AWS cloud resource configurations, diagnose security vulnerabilities, and generate high-availability optimization reports.
README
AWS Infrastructure MCP Server
透過 Model Context Protocol(MCP),讓 Claude AI 自動審計 AWS 雲端資源配置,診斷安全漏洞並生成高可用性優化報告。
專案背景
傳統 AWS 資源審計需要人工逐一檢查控制台,耗時且容易遺漏。 本專案將 AWS CloudShell 導出的資源快照透過 MCP 協議接入 Claude Desktop,實現 AI 一鍵自動診斷與結構化報告生成。
架構流程
① AWS CloudShell(跨區環境)
→ ② 導出台灣區資源快照 all_aws_config_exports.json
→ ③ MCP 協議對接?(自動審查)
→ ④ Claude AI 核心診斷專家
→ ⑤ 一鍵生成高可用性與防禦優化報告
實際診斷出的安全漏洞
| 編號 | 問題 | 風險等級 | 說明 |
|---|---|---|---|
| 1 | NAT Gateway Blackhole | 🔴 高風險 | NAT Gateway 被刪除,私有子網(10.8.3.0/24 等)對外路由完全失效 |
| 2 | 安全群組過度暴露 | 🔴 高風險 | Default VPC 內多個 launch-wizard 安全群組將 SSH(22) 和 RDP(3389) 開放給全世界(0.0.0.0/0),面臨暴力破解風險 |
現有雲端資源審計矩陣
| 安全審計領域 | 當前潛在風險 | 風險等級 | 建議方案 |
|---|---|---|---|
| VPC 邊界隔離 | NAT Gateway 已成 blackhole,私有子網失去對外連線 | 高風險 | 重建 NAT Gateway 或改用 VPC Endpoint |
| 安全組入口 | SSH/RDP 對全網際網路開放 | 高風險 | 限縮來源 IP 或改用 SSM Session Manager |
| IAM 權限管理 | Assume Role 權限過於寬泛 | 極高風險 | 嚴格實施最小特權原則 |
| S3 存取控管 | 儲存桶未設封閉,IaC 狀態檔可能外洩 | 高風險 | 啟動 Public Access Block |
技術棧
| 類別 | 工具 |
|---|---|
| AI 協議 | Model Context Protocol(MCP) |
| AI 模型 | Claude Desktop |
| 後端 | Python(MCP Server) |
| 容器化 | Docker、Dockerfile |
| 資源導出 | AWS CloudShell |
| 腳本 | Shell Script |
專案結構
aws-infrastructure-mcp-server/
├── server.py # MCP Server 主程式
├── all_aws_config_exports.json # AWS 台灣區資源快照(mock示範資料)
├── feature.md # 功能說明文件
├── requirements.txt # Python 依賴套件
├── setup_and_run.sh # 一鍵啟動腳本
├── Dockerfile # 容器化部署定義
└── .gitignore
快速啟動
# 1. 安裝依賴
pip install -r requirements.txt
# 2. 一鍵啟動 MCP Server
bash setup_and_run.sh
操作步驟
步驟一:導出 AWS 資源快照
在 AWS CloudShell 執行以下指令,導出台灣區完整資源配置:
# 在 AWS CloudShell 執行
aws configservice list-discovered-resources \
--resource-type AWS::EC2::SecurityGroup \
--region ap-east-2 > all_aws_config_exports.json
步驟二:啟動 MCP Server
bash setup_and_run.sh
步驟三:Claude Desktop 對接
開啟 Claude Desktop,透過 MCP 協議連接本地 Server, 輸入審計指令即可讓 AI 自動分析資源快照。
步驟四:取得診斷報告
Claude AI 自動解析 JSON 資源快照,輸出結構化安全漏洞報告。
Docker 部署
# 建置映像檔
docker build -t aws-mcp-server .
# 啟動容器
docker run -d \
-v $(pwd)/all_aws_config_exports.json:/app/all_aws_config_exports.json \
aws-mcp-server
注意事項
all_aws_config_exports.json為 mock 示範資料, 實際使用時請替換為從 AWS CloudShell 導出的真實資源快照- 真實資源快照包含帳號 ID、ARN 等敏感資訊, 請勿將真實資料推送至公開倉庫
- 建議搭配
.gitignore排除真實快照檔案
延伸應用
本 MCP Server 可進一步擴充以下功能:
- 自動生成 Terraform 修復腳本
- 整合 Slack / Email 告警通知
- 排程定期審計並比對資源變更差異
- 結合 AWS Config Rules 實現持續合規檢查
作者
陳銘暉 | Tibame 網工班 2026
配套專案:雙雲 CI/CD 與 AIOps 自動化維運平台
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
Neon Database
MCP server for interacting with Neon Management API and databases
E2B
Using MCP to run code via e2b.
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.