Skip to main content
Glama

infra-guard

Ein MCP-Server, der Terraform-Konfigurationen und Dockerfiles auf echte Sicherheitsfehlkonfigurationen prüft — offene Security Groups, öffentliche S3-Buckets, Wildcard-IAM-Richtlinien, hartkodierte Secrets, Container, die als root laufen — und statt einer Vermutung strukturierte Befunde zurückliefert.

Er lässt sich als Tool in Claude Code, Claude Desktop oder Cursor einbinden. Bitten Sie Ihren KI-Assistenten, Ihren Infrastrukturcode zu überprüfen: Er ruft infra-guard auf, erhält echte Befunde von Checkov und erklärt sie Ihnen.

Im Browser ausprobieren: infra-guard-frontend-production.up.railway.app — Terraform einfügen, auf „Scan“ klicken, echte Befunde sehen. Keine Installation erforderlich.

MCP-Endpunkt: https://infra-guard-production.up.railway.app/mcp

Warum es das gibt

Ich habe bei A.P. Moller–Maersk Cloud-Infrastrukturarbeit gemacht — Terraform, Docker, AWS-Provisionierung in echtem Umfang. Die meisten Portfolio-Projekte sind generische Web-Apps; dieses hier ist das Werkzeug, das ich mir tatsächlich gewünscht habe: etwas, das „Hat meine Anwendung offensichtliche Sicherheitslücken?“ in eine echte, strukturierte Antwort verwandelt, statt in die bloße Vermutung eines KI-Assistenten.

infra-guard rät nicht. Es führt Ihre Datei durch Checkov, eine echte statische Analyse-Engine mit Hunderten eingebauten Checks, und liefert die tatsächlichen Befunde zurück — Check-ID, Titel, betroffene Ressource, Zeilenbereich, Code-Snippet. Das die Sitzung hostende Modell (Claude, oder was auch immer am anderen Ende der MCP-Verbindung sitzt) erklärt die Befunde in verständlichem Englisch. Die Aufgabe des Tools ist einfach: korrekt zu sein.

Related MCP server: MCP Security Scanner

So funktioniert es

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 toggle

scanner.py ruft die Checkov-CLI als Unterprozess auf, parst die JSON-Ausgabe und gibt immer die gleiche Struktur zurück, unabhängig davon, welches Framework ihn aufgerufen hat:

{
  "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 macht zwei MCP-Tools verfügbar, scan_terraform_file(file_content, filename) und scan_dockerfile_file(file_content, filename), und hat keine eigene Interpretationsebene — die strukturierten Daten fließen direkt in das Modell, das gerade die Sitzung hostet.

insecure_example.tf enthält vier absichtliche Terraform-Probleme (offene SSH-Verbindung, ein öffentlicher und unverschlüsselter S3-Bucket, eine Wildcard-IAM-Richtlinie, ein hartkodiertes RDS-Passwort) — 14 bestanden / 34 fehlgeschlagene Checks. insecure_example.Dockerfile enthält fünf (unverändertes Basis-Image, ADD statt COPY, Port 22 offen, kein HEALTHCHECK, läuft als root) — 28 bestanden / 5 fehlgeschlagene Checks.

Lokales Ausführen

Erfordert uv.

git clone https://github.com/SanjanaJanardhan/infra-guard.git
cd infra-guard
uv sync

Den Scanner direkt ausführen:

uv run python3 scanner.py

Den MCP-Server über stdio ausführen (für lokale Clients wie Claude Code/Desktop):

uv run python3 server.py

Den MCP-Server über Streamable HTTP ausführen (für Remote-Clients oder zum Reproduzieren des Deployments):

uv run python3 server.py --transport streamable-http --port 8000

Mit einem MCP-Client verbinden

Claude Code / Claude Desktop — folgenden Eintrag zur .mcp.json (Projektebene) oder zur globalen MCP-Konfiguration hinzugefügt:

{
  "mcpServers": {
    "infra-guard": {
      "command": "uv",
      "args": ["--directory", "/absolute/path/to/infra-guard", "run", "python3", "server.py"]
    }
  }
}

.NET-Circle Streamable-HTTP-Clients (inklusive des Live-Deployments oben) — Adresse auf:

https://infra-guard-production.up.railway.app/mcp

Playground lokal ausführen

# terminal 1 — API
uv run python3 api.py

# terminal 2 — frontend
cd frontend
npm install
npm run dev

Das Frontend bezieht seine API-Basis-URL aus der Datei VITE_API_URL (siehe frontend/.env.local), mit http://localhost:8001 als Standard.

Deployment

Drei Dienste auf Railway, alle aus Docker/Nixpacks erstellt, ohne manuelle Server-Konfiguration:

  • MCP-Server — Dockerfile, Streamable HTTP

  • REST API — Dockerfile.api, derselbe scanner.py-Kern, versorgt den Playground

  • Frontend — Der Nixpacks-Builder von Railway erkennt die Vite-App in frontend/ automatisch; VITE_API_URL wird zur Build-Zeit auf die URL der bereitgestellten API gesetzt.

Beide Python-Dienste lesen die Variable PORT aus der Umgebung, sodass sie sich ohne Konfigurationsänderungen an den jeweils zugewiesenen Port anpassen.

Stack

Python · Checkov · MCP Python SDK · FastAPI · React · Docker · Railway

Roadmap

  • Kern-Terraform-Scan-Engine

  • lässt sich über stdio verwenden

  • Streamable-HTTP-Transport

  • Auf Railway deployed

  • Web-Frontend mit Live-Playground

  • Dockerfile-Scanning inklusive Terraform/Dockerfile-Option im Playground

  • Kostenauswirkungs-Schätzung für Befunde

Lizenz

MIT

Available Tools

2 tools
scan_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

    A4.4/5.0

    Scored across 2 tools

    Disambiguation5/5

    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.

    Naming Consistency5/5

    Both tools follow the same scan_<format>_file pattern, and the descriptions mirror each other for symmetry. Naming is predictable and internally consistent.

    Tool Count3/5

    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.

    Completeness3/5

    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

    ActivitySlowing
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      A
      quality
      C
      maintenance
      Enables local-first scanning of Terraform for security misconfigurations while an AI assistant writes the code, providing fixes and compliance mappings without uploading infrastructure code.
      8
      7
      Apache 2.0
    • A
      license
      Not graded
      quality
      C
      maintenance
      Enables agents to review Terraform/Bicep infrastructure diffs against Checkov or builtin regex policies, returning structured findings for Azure security issues.
      Apache 2.0