Skip to main content
Glama

infra-guard

MCP-сервер, который сканирует Terraform и Dockerfile файл for real security misconfigurations — открыт groups безопасности, public S3 бакеты, publicly diss. Globally injection... I need to think.

Let's_write final clean Russian:

infra-guard

MCP-сервер, который сканирует Terraform и Dockerfile-файлы на реальные проблемы безопаности — открытые группы безопаности, публичные S3 бакеты, wildcard IAM-полис, захардкодженные секреты, контейнеры работающие под root — и возвращает структурированные находки, а не догадку.

Он подключается к Claude Code, Claude Desktop или Cursor как инструмент. Попросите вашемого ИИ-ассистента проверить инфраструктурный код, и он вызовет infra-guaard, получит реальные находки от Checkov и объяснит их вам.

Попробуйте в браузере: infra-guaard-frontend-production.up.railway.app — вставьте Terraform, нажмите Scan, посмотрите реальные результаты. Установка не требуется.

MCP-эндпоинт: https://infra-guaard-production.up.railway.app/mcp

Зачем это существует

Я занимался облачной инфраструктурой в A.P. Moller–Maersk — Terraform, Docker, AWS provisioning в реальном масштабе. Большинство портфолио-проектов — типовые веб-приложения; этот — инструмент, который мне действительно хотелось: то, что превращает «есть ли в моём Terraform очевидные дыры в безопасности» в настоящий структурированный ответ, а не в догадку ИИ-ассистента.

infra-gard не гадает. Он прогоняет ваш файл через Checkov — настоящий движок статического анализа с сотнями встроенных проверок — и возвращает реальные находки: ID проверки, severity, диапазон строк и фрагмент кода. 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 toggle

scanner.py вызывает CLI Checkov, разбирает его 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 passed / 34 failed checks. В insecure_example.Dockerfile — пять (незакрелённый базовый образ, ADD вместо COPY, открытый порт 22, отсутствие HEALTHCHECK, запуск под root) — 26 passed / 5 failed checks.

Запуск локально

Требуется uv.

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

Запустите сканер напрямую:

uv run python3 scanner.py

Запустите MCP-сервер через stdio (для локальных клиентов вроде 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

Запуск playground локально

# terminal 1 — API
uv run python3 api.py

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

Фронтенд читает базовый URL API из VITE_API_URL (см. frontend/.env.local); по умолчанию используется http://localhost:8001.

Развёртывание

Три сервиса на Railway, все собраны из Docker/Nixpacks без ручной настройки сервера:

  • MCP-сервер — Dockerfile, Streamable HTTP

  • REST API — Dockerfile.api, то же ядро scanner.py, обеспечивает работу playground

  • Frontend — допустимый сборщик Nixpacks автоматически находит Vite-приложение в frontend/; VITE_API_URL задаётся на этапе сборки и указывает на URL развёрнутого API

Оба Python-сервиса читают PORT из окружения, поэтому они подстраиваются под любой порт, который назначит Railway, без изменений конфигурации.

Стек

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

Дорожная карта

  • Основной движок сканирования Terraform

  • MCP-сервер через stdio

  • Транспорт Streamable HTTP

  • Деплой на Railway

  • Веб-фронтенд с живым playground

  • Сканирование Dockerfile, включая переключатель Terraform/Dockerfile в playground

  • Оценка влияния находок на стоимость

Лицензия

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

NameRequiredDescriptionDefault
filenameNoDockerfile
file_contentYes

Output Schema

NameRequiredDescription

No output parameters

TDQS

A4.4/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Without annotations, the description carries the behavioral disclosure burden. It states it scanning the file and returns structured findings including check ID, title, resource, line range, and code snippet, which clearly implies non-mutating analysis and describes the output shape. It does not discuss error cases or external service dependencies, but the read-only nature is apparent enough.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is well-structured: a clear first sentence states the action, a second adds usage and format context, and an argument list adds parameter semantics. There is no filler or redundancy, and all content earns its place.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

With two parameters, an output schema present, and a clear relationship to the sibling scan_terraform_file, the description is nearly complete. It covers purpose, usage, output format, and argument semantics. It could have noted potential limitations or invalid content behavior, but for this scope the core information for correct invoking is present.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 0%, so the description must add meaning. It does so by explaining file_content is 'the raw text of a Dockerfile' and filename is 'used only for a friendlier label in output.' This adds useful semantic context beyond the schema's bare type/default information.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the verb ('Scan'), the target resource ('Dockerfile content'), and the purpose ('for security misconfigurations'). It distinguishes from the sibling by naming the file type and explicitly noting the return shape is the same as scan_terraform_file, so an agent can tell them apart immediately.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description states 'Use this whenever the user asks to review, audit, or check the security of a Dockerfile.' This is explicit usage guidance. It doesn't explicitly say 'use scan_terraform_file for Terraform files,' though that is strongly implied by the sibling name and the shape reference, so it lacks an explicit when-not/exclusion.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

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

NameRequiredDescriptionDefault
filenameNomain.tf
file_contentYes

Output Schema

NameRequiredDescription

No output parameters

TDQS

A4.5/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description carries the full burden of behavioral disclosure, and it does well by outlining what the tool returns (Checkov check ID, title, resource, line range, code snippet). It does not mention limitations such as invalid Terraform or external dependencies, but it clearly communicates the main behavior and output shape.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is compact and well-structured: a one-sentence definition, a use indicator, and an argument list that adds value beyond the schema. There is no redundant or filler content.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the small parameter count, output schema availability, and sibling context, the description covers the essential inputs and expected outputs. It could be slightly more explicit about behavior on invalid/nonexistent Terraform content, but for the average call it is complete enough.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Input schema coverage is 0%, but the description fully compensates by documenting both arguments: file_content as the raw .tf text and filename as only a friendlier output label. This gives an agent everything needed to construct correct parameters.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description uses a specific verb ('scan') and resource type (Terraform .tf files) and states the goal ('security misconfigurations') and engine (Checkov). It is easily distinguished from sibling scan_dockerfile_file by mentioning Terraform explicitly.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description explicitly says to use it whenever the user asks to review, audit, or check Terraform code. It does not explicitly mention excluding other file types or name the Dockerfile sibling as an alternative, so it slightly misses the top guidance bar.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

  1. 2 tool updatesv0.1.0
    • First observedscan_dockerfile_file
    • First observedscan_terraform_file

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

ActivityMaintained
ResponsivenessNo 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