infra-guard
One-line summary: infra-guard is an MCP server that scans Terraform and Dockerfile content with Checkov and returns structured security findings (no guessing, no fixes) for the hosting LLM to explain.
scan_terraform_file(file_content, filename)— audits raw.tfcontent for misconfigurations (open security groups, public S3 buckets, wildcard IAM policies, hardcoded secrets, etc.).scan_dockerfile_file(file_content, filename)— audits raw Dockerfile content (unpinned base images,ADDinstead ofCOPY, exposed port 22, missingHEALTHCHECK, running as root, etc.).Takes file content as a string, not a path — you paste or pass raw code;
filenameis optional and only used as a friendlier output label (defaults:main.tf/Dockerfile).Returns identical structured shapes for both tools — summary counts (passed/failed/total) plus per-finding
check_id,title,resource,severity,start_line/end_line, andcode_snippet.No interpretation layer — it hands structured data straight back so the host assistant (Claude Code, Claude Desktop, Cursor, etc.) can explain or suggest fixes itself.
Severity values are locally approximated from a check-ID map, falling back to
"info"when unmapped.
Enables scanning Dockerfiles for security issues such as unpinned base images, ADD instead of COPY, exposed SSH ports, missing healthchecks, and running as root.
Enables scanning Terraform configuration files for security misconfigurations such as open security groups, public S3 buckets, wildcard IAM policies, and hardcoded secrets.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@infra-guard Scan my Terraform for security misconfigurations and explain the findings"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
infra-guard
An MCP server that scans Terraform and Dockerfiles for real security misconfigurations — open security groups, public S3 buckets, wildcard IAM policies, hardcoded secrets, containers running as root — and hands back structured findings instead of a guess.
It plugs into Claude Code, Claude Desktop, or Cursor as a tool. Ask your AI assistant to review your infrastructure code, and it calls infra-guard, gets back real findings from Checkov, and explains them to you.
Try it in the browser: infra-guard-frontend-production.up.railway.app — paste Terraform, click Scan, see real findings. No install required.
MCP endpoint: https://infra-guard-production.up.railway.app/mcp
Why this exists
I did cloud infrastructure work at A.P. Moller–Maersk — Terraform, Docker, AWS provisioning at real scale. Most portfolio projects are generic web apps; this one is the tool I actually wished existed: something that turns "does my Terraform have any obvious security holes" into a real, structured answer instead of an AI assistant's best guess.
infra-guard doesn't guess. It runs your file through Checkov, a real static analysis engine with hundreds of built-in checks, and returns the actual findings — check ID, title, affected resource, line range, code snippet. The hosting LLM (Claude, or whatever's on the other end of the MCP connection) explains the findings in plain English. The tool's job is just to be correct.
Related MCP server: MCP Security Scanner
How it works
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),
plus POST /api/explain for optional local AI remediation
frontend/ → React + Vite playground: severity badges, sort/group findings,
click a finding to scroll/highlight its lines in a CodeMirror
editor, "Explain & Fix" for AI-generated remediation, calls api.pyscanner.py shells out to the Checkov CLI, parses its JSON output, and returns the same shape regardless of which framework ran:
{
"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",
"severity": "critical",
"start_line": 6,
"end_line": 24,
"code_snippet": "resource \"aws_security_group\" \"app_sg\" { ... }"
}
]
}server.py exposes two MCP tools, scan_terraform_file(file_content, filename) and scan_dockerfile_file(file_content, filename), with no interpretation layer of its own — the structured data goes straight to whatever LLM is hosting the session.
A note on severity: Checkov's open-source CLI always returns severity: null — real per-check severity only exists when a scan is connected to Bridgecrew/Prisma Cloud's paid platform (--bc-api-key), which means an account and sending scan content to that platform. This project doesn't do that, so scanner.py assigns severity locally from a small _SEVERITY_MAP keyed by check ID, falling back to "info" for anything unmapped. It's a deliberate, disclosed approximation, not a Checkov feature.
insecure_example.tf has four intentional Terraform issues (open SSH ingress, a public+unencrypted S3 bucket, a wildcard IAM policy, a hardcoded RDS password) — 14 passed / 34 failed checks. insecure_example.Dockerfile has five (unpinned base image, ADD instead of COPY, port 22 exposed, no HEALTHCHECK, runs as root) — 26 passed / 5 failed checks.
Running it locally
Requires uv.
git clone https://github.com/SanjanaJanardhan/infra-guard.git
cd infra-guard
uv syncRun the scanner directly:
uv run python3 scanner.pyRun the MCP server over stdio (for local clients like Claude Code/Desktop):
uv run python3 server.pyRun it over Streamable HTTP (for remote clients, or to reproduce the deployed setup):
uv run python3 server.py --transport streamable-http --port 8000Connecting it to an MCP client
Claude Code / Claude Desktop — add to .mcp.json (project-level) or your global MCP config:
{
"mcpServers": {
"infra-guard": {
"command": "uv",
"args": ["--directory", "/absolute/path/to/infra-guard", "run", "python3", "server.py"]
}
}
}Any Streamable HTTP client (including the live deployment above) — point it at:
https://infra-guard-production.up.railway.app/mcpRunning the playground locally
# terminal 1 — API
uv run python3 api.py
# terminal 2 — frontend
cd frontend
npm install
npm run devThe frontend reads its API base URL from VITE_API_URL (see frontend/.env.local), defaulting to http://localhost:8001.
Enabling "Explain & Fix" (optional, local-only)
Clicking a finding shows an "Explain & Fix" button that calls Claude (Haiku) to generate a plain-English explanation and a suggested fixed code snippet, grounded in that finding's real check_id/resource/code_snippet.
This deliberately isn't enabled on the public deployment — the playground is public and unauthenticated, so wiring a paid API behind a button there means anyone's clicks spend your API credits. Instead, api.py looks for ANTHROPIC_API_KEY in the environment (via .env, loaded with python-dotenv) and returns {"configured": false} if it's missing, which the frontend renders as a plain "not enabled" message rather than a broken button.
To try it locally:
cp .env.example .env
# edit .env and add your own key from https://console.anthropic.com/
uv run python3 api.py.env is gitignored — never commit a real key, and never set ANTHROPIC_API_KEY on the Railway API service.
Deployment
Three services on Railway, all built from Docker/Nixpacks with no manual server config:
MCP server —
Dockerfile, Streamable HTTPREST API —
Dockerfile.api, samescanner.pycore, powers the playgroundFrontend — Railway's Nixpacks builder auto-detects the Vite app in
frontend/;VITE_API_URLis set at build time to the deployed API's URL
Both Python services read PORT from the environment, so they adapt to whatever port Railway assigns with no config changes.
Stack
Python · Checkov · MCP Python SDK · FastAPI · React · Vite · uv · Docker · Railway
Roadmap
Core Terraform scanning engine
MCP server over stdio
Streamable HTTP transport
Deployed to Railway
Web frontend with a live playground
Dockerfile scanning, including a Terraform/Dockerfile toggle in the playground
AI-generated remediation ("Explain & Fix"), local-only by design
Cost-impact estimate for findings
License
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.
Maintenance
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