Skip to main content
Glama

infra-guard

Un servidor MCP que analiza Terraform y Dockerfiles en busca de configuraciones de seguridad incorrectas de verdad — grupos de seguridad abiertos, buckets S3 públicos, políticas IAM con comodines, secretos escritos en el código, contenedores que se ejecutan como root — y devuelve hallazgos estructurados en lugar de una suposición.

Se integra con Claude Code, Claude Desktop o Cursor como herramienta. Pídele a tu asistente de IA que revise tu código de infraestructura, y él llama a infra-guard, obtiene hallazgos reales de Checkov y te los explica.

Pruébalo en el navegador: infra-guard-frontend-production.up.railway.app — pega el fichero Terraform, haz clic en Scan y verás hallazgos reales. No requiere instalación.

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

Por qué existe esto

Trabajé en infraestructura cloud en A.P. Moller–Maersk — Terraform, Docker, aprovisionamiento de AWS a escala real. La mayoría de los proyectos de portafolio son aplicaciones web genéricas; este es la herramienta que de verdad deseaba que existiera: algo que convierta «¿tiene mi Terraform agujeros de seguridad obvios?» en una respuesta real y estructurada en lugar de la mejor estimación de un asistente de IA.

infra-guard no adivina: pasa tu archivo por Checkov, un auténtico motor de análisis estático con cientos de comprobaciones integradas, y devuelve los hallazgos reales — ID de comprobación, título, recurso afectado, rango de líneas, fragmento de código. El LLM anfitrión (Claude, o el que sea que esté al otro lado de la conexión MCP) explica los hallazgos con palabras claras. El trabajo de la herramienta es, únicamente, ser precisa.

Related MCP server: MCP Security Scanner

Cómo funciona

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 invoca la CLI de Checkov, analiza su salida JSON y devuelve la misma forma sin importar desde qué framework se ejecute:

{
  "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 expone dos herramientas MCP, scan_terraform_file(file_content, filename) y scan_dockerfile_file(file_content, filename), sin capa de interpretación propia; los datos estructurados van directamente al LLM que aloje la sesión.

insecure_example.tf contiene cuatro problemas intencionados de Terraform (SSHH abierto, un bucket S3 público y sin cifrar, una política IAM con comodines, una contraseña RDS en código) — 14 comprobaciones superadas / 34 fallidas. insecure_example.Dockerfile tiene cinco (imagen base sin fijar, ADD en lugar de COPY, puerto 22 expuesto, sin HEALTHCHECK, se ejecuta como root) — 26 comprobaciones superadas / 5 fallidas.

Ejecutarlo localmente

Requiere uv.

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

Ejecuta el escáner directamente:

uv run python3 scanner.py

Ejecuta el servidor MCP sobre stdio (para clientes locales como Claude Code/Desktop):

uv run python3 server.py

Ejecútalo sobre HTTP Streamable (para clientes remotos o para reproducir el despliegue anterior):

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

Cómo conectarlo a un cliente MCP

Claude Code / Claude Desktop — añádelo a .mcp/json (a nivel del proyecto) o a tu configuración global de MCP:

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

Cualquier cliente HTTP Streamable (incluido el despliegue en vivo de arriba) — señala a este endpoint:

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

Ejecutar el playground localmente

# terminal 1 — API
uv run python3 api.py

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

El frontend lee la URL base de su API de la variable VITE_API_URL (ver frontend/.env.local), que por defecto es http://localhost:8001.

Despliegue

Tres servicios en Railway, todos creados con Docker/Nixpacks sin configuración manual del servidor:

  • Servidor MCP — Dockerfile, HTTP Streamable

  • API REST — Dockerfile.api, con el mismo núcleo scanner.py, alimenta al playground

  • Frontend — el builder Nixpacks de Railway detecta automáticamente la app de Vite en frontend/; VITE_API_URL se configura en tiempo de ejecución del build con la URL de la API desplegada

Ambos servicios de Pythones leen PORT del entorno, así que se adaptan al puerto que Railway les asigne sin necesidad de cambios de configuración.

Tecnologías

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

Hoja de ruta

  • Motor de análisis de Terraform en el núcleo

  • Servidor MCP sobre stdio

  • Transporte HTTP Streamable

  • Desplegado en Railway

  • Frontend web con un playground en tiempo real

  • Análisis de Dockerfiles, incluido in un conmutador Terraform/Dockerfile en el playground

  • Estimación del impacto en coste de los hallazgos

Licencia

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.

    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