infra-guard
infra-guard
Terraform と Dockerfile をスキャンして実際のセキュリティ設定ミス(オープンなセキュリティグループ、公開 S3 バケット、ワイルドカード IAM ポリシー、ハードコードされたシークレット、root で実行されるコンテナなど)を検出し、推測ではなく構造化された検出結果を返す MCP サーバーです。
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 は scan_terraform_file(file_content, filename) と scan_dockerfile_file(file_content, filename) の 2 つの MCP ツールを公開しています。独自の解釈層は持たず、構造化されたデータはセッションをホストしている LLM にそのまま渡されます。
insecure_example.tf には、意図的に仕込んだ 4 つの Terraform の問題(SSH インバウンドの全開放、公開かつ暗号化されていない S3 バケット、ワイルドカード IAM ポリシー、ハードコードされた RDS パスワード)があります。チェック結果は合格 14 / 不合格 34 です。insecure_example.Dockerfile には 5 つの問題(ベースイメージのバージョン未固定、COPY ではなく ADD、ポート 22 を公開、HEALTHCHECK なし、root で実行)があります — 合格 26 / 不合格 5 です。
ローカルで実行する
uv が必要です。
git clone https://github.com/SanjanaJanardhan/infra-guard.git
cd infra-guard
uv syncスキャナーを直接実行する:
uv run python3 scanner.pyMCP サーバーを stdio で実行する(Claude Code/Desktop などのローカルクライアント用):
uv run python3 server.pyStreamable HTTP で実行する(リモートクライアント用、またはデプロイ環境を再現する場合):
uv run python3 server.py --transport streamable-http --port 8000MCP クライアントに接続する
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フロントエンドは API のベース URL を VITE_API_URL から読み取ります(frontend/.env.local を参照)。デフォルトは http://localhost:8001 です。
デプロイ
Railway 上の 3 つのサービスです。すべて 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
Available Tools
2 toolsscan_dockerfile_fileA
Scan Dockerfile content for security misconfigurations using Checkov and return structured findings, in the same shape as scan_terraform_file (check ID, title, resource, line range, code snippet). Use this whenever the user asks to review, audit, or check the security of a Dockerfile.
Args: file_content: the raw text of a Dockerfile filename: original filename, used only for a friendlier label in output
Inputs: file_content (required), filename. Returns: object
scan_terraform_fileA
Scan Terraform (.tf) file content for security misconfigurations using Checkov and return structured findings.
Each finding includes the Checkov check ID, a human-readable title, the affected resource, its line range in the file, and the offending code snippet. Use this whenever the user asks to review, audit, or check the security of Terraform code.
Args: file_content: the raw text of a .tf file filename: original filename, used only for a friendlier label in output
Inputs: file_content (required), filename. Returns: object
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 2 tools
The two tools are cleanly separated by file type: one handles Terraform files and the other handles Dockerfiles. There is no functional overlap or realistic risk of selecting the wrong tool.
Both tools follow the same scan_<format>_file pattern, and the descriptions mirror each other for symmetry. Naming is predictable and internally consistent.
Two tools is a thin set: they cover exactly Terraform and Dockerfile scanning, but the server named infra-guard feels narrow. The count is coherent but borderline for the apparent purpose.
For the supported file types, the scanning workflow is functional, but common IaC targets such as Kubernetes manifests or CloudFormation templates are absent. There is also no batch or exception-handling capability, leaving notable coverage gaps.
Related MCP Connectors
Security scanner for AI-written code: SAST, secrets, dependencies, IaC, containers and DAST.
Zero-config MCP security scanner for AI-generated apps. 25K+ vulnerability patterns.
Query your team's drift, vulnerability, and upgrade data from any AI assistant. OAuth 2.1, 51 tools.
CVE lookups (NVD) and dependency-manifest audits (OSV) for AI agents. No API keys.
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.1519MIT No Attribution- AlicenseAqualityCmaintenanceEnables local-first scanning of Terraform for security misconfigurations while an AI assistant writes the code, providing fixes and compliance mappings without uploading infrastructure code.87Apache 2.0
- AlicenseNot gradedqualityCmaintenanceEnables agents to review Terraform/Bicep infrastructure diffs against Checkov or builtin regex policies, returning structured findings for Azure security issues.Apache 2.0