infra-guard
infra-guard
一个 MCP 服务器,用于扫描 Terraform 和 Dockerfile 中的真实安全错误配置——开放的安全组、公开的 S3 存储桶、通配符 IAM 策略、硬编码的密钥、以 root 身份运行的容器——并返回结构化发现结果,而不是猜测。
它可以作为工具接入 Claude Code、Claude Desktop 或 Cursor。让你的 AI 助手审查你的基础设施代码,它会调用 infra-guard,从 Checkov 获得真实发现,并向你解释这些发现。
在浏览器中试用: infra-guard-frontend-production.up.railway.app —— 粘贴 Terraform,点击 Scan,即可看到真实发现。无需安装。
MCP 端点: https://infra-guard-production.up.railway.app/mcp
为什么会有这个项目
我之前在 A.P. Moller–Maersk 从事云基础设施工作——在真实规模上使用 Terraform、Docker 和 AWS 进行预置。大多数项目集项目都是普通的 Web 应用;而这个项目正是我希望存在的工具:把“我的 Terraform 是否有明显的安全漏洞”变成一个真实、结构化的答案,而不是 AI 助手的最佳猜测。
infra-guard 不会猜测。它用 Checkov 扫描你的文件,Checkov 是一个包含数百个内置检查的真实静态分析引擎,然后返回实际发现结果——检查 ID、标题、受影响资源、行范围、代码片段。承载会话的 LLM(Claude,或 MCP 连接另一端的任何模型)会用简单的英文解释这些发现。这个工具的职责只是保证正确。
Related MCP server: MCP Security Scanner
工作原理
scanner.py → core engine: scan_terraform(...) / scan_dockerfile(...) -> structured dict
server.py → wraps both as MCP tools, served over stdio or Streamable HTTP
api.py → wraps both as a plain REST API (POST /api/scan, POST /api/scan-dockerfile)
frontend/ → React + Vite playground that calls api.py, with a Terraform/Dockerfile togglescanner.py 调用 Checkov CLI,解析其 JSON 输出,并无论由哪个框架调用都返回同样的结构:
{
"summary": { "passed": 14, "failed": 34, "total_checks": 48 },
"findings": [
{
"check_id": "CKV_AWS_24",
"title": "Ensure no security groups allow ingress from 0.0.0.0:0 to port 22",
"resource": "aws_security_group.app_sg",
"start_line": 6,
"end_line": 24,
"code_snippet": "resource \"aws_security_group\" \"app_sg\" { ... }"
}
]
}server.py 暴露两个 MCP 工具:scan_terraform_file(file_content, filename) 和 scan_dockerfile_file(file_content, filename),它自身没有解释层——结构化数据直接发送给托管该会话的 LLM。
insecure_example.tf 包含四个故意留下的 Terraform 问题(开放 SSH 入站、一个公开且加密的 S3 桶、一个通配符 IAM 策略、一个硬编码的 RDS 密码)——14 项通过 / 34 项失败。insecure_example.Dockerfile 包含五个问题(基础镜像未固定版本、使用 ADD 而不是 COPY、暴露 22 端口、没有 HEALTHCHECK、以 root 身份运行)——26 项通过 / 5 项失败。
在本地运行
需要 uv。
git clone https://github.com/SanjanaJanardhan/infra-guard.git
cd infra-guard
uv sync直接运行扫描器:
uv run python3 scanner.py通过 stdio 运行 MCP 服务器(适用于 Claude Code/Desktop 等本地客户端):
uv run python3 server.py通过 Streamable HTTP 运行(适用于远程客户端,或复现已部署的配置):
uv run python3 server.py --transport streamable-http --port 8000连接到 MCP 客户端
Claude Code / Claude Desktop —— 将其添加到 .mcp.json(项目级)或你的全局 MCP 配置中:
{
"mcpServers": {
"infra-guard": {
"command": "uv",
"args": ["--directory", "/absolute/path/to/infra-guard", "run", "python3", "server.py"]
}
}
}任何 Streamable HTTP 客户端(包括上面的在线部署)—— 将其指向:
https://infra-guard-production.up.railway.app/mcp在本地运行演示环境
# terminal 1 — API
uv run python3 api.py
# terminal 2 — frontend
cd frontend
npm install
npm run dev前端从 VITE_API_URL 读取其 API 基础 URL(见 frontend/.env.local),默认值为 http://localhost:8001。
部署
三个服务都部署在 Railway 上,全部由 Docker/Nixpacks 构建,无需手动配置服务器:
MCP 服务器 ——
Dockerfile,Streamable HTTPREST API ——
Dockerfile.api,使用同一个scanner.py核心,驱动演示环境前端 —— Railway 的 Nixpacks 构建器自动检测
frontend/中的 Vite 应用;VITE_API_URL在构建时设置为已部署 API 的 URL
两个 Python 服务都会从环境中读取 PORT,因此无需修改配置即可适配 Railway 分配的任何端口。
技术栈
Python · Checkov · MCP Python SDK · FastAPI · React · Vite · uv · Docker · Railway
路线图
核心 Terraform 扫描引擎
基于 stdio 的 MCP 服务器
Streamable HTTP 传输
部署到 Railway
带实时演示环境的 Web 前端
Dockerfile 扫描,包括演示环境中的 Terraform/Dockerfile 切换
检查结果成本影响估算
许可证
MIT
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
- AlicenseAqualityDmaintenanceEnables AI assistants to scan project dependencies and Infrastructure as Code files for security vulnerabilities and misconfigurations. It also provides automated fixing capabilities to remediate identified security issues.183MIT

MCP Security Scannerofficial
AlicenseAqualityDmaintenanceIntegrates Checkov, Semgrep, Bandit, and ASH to provide comprehensive code security analysis for AI coding assistants.1515MIT No Attribution
shieldly-mcpofficial
AlicenseAqualityCmaintenanceEnables AI assistants to analyze AWS IAM policies and CloudFormation templates for security risks.243MIT- AlicenseNot gradedqualityAmaintenanceEnables AI agents to scan code for security and quality issues and receive machine-readable reports with suggested fixes and verification criteria.892MIT
Related MCP Connectors
Zero-config MCP security scanner for AI-generated apps. 25K+ vulnerability patterns.
CVE lookups (NVD) and dependency-manifest audits (OSV) for AI agents. No API keys.
CVE lookups (NVD) and dependency-manifest audits (OSV) for AI agents. No API keys.
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/SanjanaJanardhan/infra-guard'
If you have feedback or need assistance with the MCP directory API, please join our Discord server