dockerlint-mcp
Provides static linting for Dockerfiles and Docker Compose files, including grammar-aware parsing, rule-based findings with line numbers and fixes, cache-order analysis, Compose security checks, .dockerignore matching, and safe fix previews without requiring a Docker daemon.
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
dockerlint-mcp, The Hard Way
Build an MCP server that lets an AI lint Dockerfiles and compose files without Docker. Start from "what is a Dockerfile, grammatically?" and end with a tested stdio server. No hadolint, no daemon, no framework doing the hard part for you.
At the end you will have built a small version of
dockerlint-mcp yourself, and you will understand the three
things most lint tools get wrong: parsing (regexes over raw text lie), rule design (findings need
a line number and a concrete fix, and must never leak secrets), and domain rules that look like
something familiar but are not (.dockerignore is not .gitignore).
Why This Exists
Most "linter" tutorials are a list of regexes. That breaks the first time someone writes
RUN apt-get update \
# pin the mirror
&& apt-get install -y curlor RUN echo "apt-get update", or a heredoc. A linter an AI relies on has to be right about structure
first, and quiet when the file is fine: every false positive teaches the model to ignore you.
Related MCP server: dockerfile-audit-mcp
Who This Is For
Developers who built a hello-world MCP server and want a real one
Anyone who writes Dockerfiles and wants to know why the usual advice is the usual advice
Anyone curious how a Dockerfile is actually tokenized
Prerequisites: Python and a rough idea of what docker build does. No Docker installation is needed;
nothing here ever runs a container.
pip install -r requirements.txt
python verify.py # runs every module and checks itModules
# | Module | What You'll Build |
01 | A parser: continuations with comments inside, directives, heredocs, JSON vs shell form, flags, stages, ARG expansion | |
02 |
| |
03 | Which instructions make layers, size hints, and why | |
04 |
| |
05 | Docker's glob rules, root anchoring, | |
06 | Safe automatic fixes as a unified diff, verified by re-linting, never written | |
07 | A sandboxed stdio server, |
The code lives in minilint/, one file per module, and grows as you go. Each module has a
main.py that exercises that stage and checks its own claims with assert; verify.py runs them all.
Design rules that run through every module
Parse, then judge. Rules look at parsed commands, never at raw text.
Every finding has a line number and a concrete fix. "Consider improving caching" is not a finding.
Never echo a secret. Report the variable name; the value stays out of the model's context.
Stay quiet on good files. A false-positive corpus is part of the test suite.
Static means static. Nothing is built, run, pulled or written.
Fail loudly and usefully. Errors say what to do next.
This server cannot be deployed
Maintenance
Related MCP Connectors
Hadolint-grade Dockerfile audit — 19 checks: secrets, privileges, supply chain, hygiene.
Audit Dockerfiles for root users, baked-in secrets, curl-pipe-shell and unpinned base images.
Four IaC audits in one call: Compose, Dockerfile, GitHub Actions, Kubernetes. 131 checks.
30+ deterministic dev and delivery tools: linting, metrics, diagrams, model advice, AI-text checks.
Related MCP Servers
- AlicenseAqualityCmaintenanceEnables agents to validate Dockerfiles for build-breaking syntax errors, risky patterns like root users and secrets in ENV/ARG, and cache-order problems, returning every finding with its line and a fix. It also verifies referenced container images against public registries, reporting tag existence, digests to pin, supported platforms, last rebuild time, and end-of-life status with an upgrade tag.21MIT
- AlicenseNot gradedqualityCmaintenanceEnables users to audit Dockerfiles for container-security anti-patterns, including missing USER, baked-in secrets, curl | sh / wget | bash, unpinned base images, and ADD with remote URLs. It parses Dockerfile structure to return risk levels and actionable fixes.MIT
- AlicenseNot gradedqualityCmaintenanceExposes a Dockerfile auditing engine to AI assistants, letting them scan a Dockerfile for the 32 deterministic layer-aware rules, print a stage/layer map showing what each layer adds or deletes, explain any rule's rationale and fix, and list available rules. Findings include file:line evidence so agents can surface and triage image-safety issues directly in Claude Code, Cursor, or Cline.MIT
- AlicenseNot gradedqualityBmaintenanceEnables users to analyze Dockerfiles without a Docker daemon or build, ranking layer sizes biggest first and surfacing deterministic waste flags. It also validates supplied layer sizes against the number of layer-producing instructions.MIT