Moving an internal Model Context Protocol (MCP) server to a hardened container base can reduce what an attacker might find inside a compromised image—not only by removing operating-system packages, but also by excluding tools the running application does not need. In a hands-on migration, Senior Site Reliability Engineer Sangharsh Agarwal found that a standard Node.js image included parts of the npm command-line toolchain, including dependency-resolution and publishing tools, even though the server did not invoke npm at runtime.
The example illustrates a practical security concern as organizations deploy internal services that connect AI agents to company systems. Such services may hold credentials or provide API access, Agarwal notes, yet they may not receive the same scanning attention as customer-facing applications. Hardened base images offer one way to reduce the software present in these containers.
Three approaches to a smaller runtime image
Agarwal compared three options, each with different trade-offs. Google’s distroless images are a long-established, free approach. Standard runtime images omit a shell and package manager, limiting the tools available inside the container. The trade-off is that patched images depend on upstream package availability and image rebuilds, which can leave a delay between disclosure of a vulnerability and availability of an updated image.
Chainguard Images are built from packages sourced through Wolfi and Chainguard OS, and the company rebuilds its images daily. That update cadence may suit teams prioritizing frequent rebuilds. However, the free tier provides only the latest and latest-dev tags; version-specific tags and remediation backed by a service-level agreement require a paid subscription.
Docker Hardened Images use Debian or Alpine foundations, which may make adoption less disruptive for teams already working with those distributions. The source reports that Docker made the core hardened images free and Apache 2.0 licensed at the end of 2025. The three choices therefore differ not just in image contents, but also in migration effort, update practices and commercial support.
What the migration exposed
The most notable observation from the MCP server migration was not a specific vulnerability count. The account does not provide scan totals, so the result is better understood as a finding about image composition: a standard Node.js base can carry npm’s own internal tooling into a production runtime, even when the application only needs to run the server.
Removing that unused tooling can reduce the container’s attack surface. It also shows why simply reviewing obvious operating-system packages may not identify everything an application image contains. A hardened base can omit components by default that teams might overlook in a manual cleanup.
The finding is relevant to internal MCP servers and other agent-connected services because the risk is not limited to public web applications. If a container with access to internal systems is compromised, unnecessary software within it may provide additional tools to an attacker. Reducing image contents does not eliminate the risk of compromise, but it can limit what is available inside the runtime.
Operational changes come with minimal images
Distroless and other minimal runtime images generally leave out familiar interactive tools such as a shell and package manager. That absence is intentional: fewer built-in utilities mean fewer components available for misuse after a compromise. It also changes routine operations. Engineers cannot rely on entering a running container and using shell commands to investigate it.
Multi-stage builds become especially useful in this model. A build stage can contain the package manager and other tooling needed to install dependencies; the final stage can then receive the required files without carrying the full build environment into production. Debugging also shifts from keeping tools permanently in each image to making them available when needed, through approaches such as debug images or development variants.
The choice among image families depends on a team’s constraints. Distroless may be a reasonable no-cost option for organizations already using Kubernetes ecosystem tools. Chainguard may appeal where its rebuild approach and provenance requirements justify a subscription. Docker’s Debian- or Alpine-based images may offer a lower-friction route for teams seeking hardening without changing their distribution base. These are trade-offs, rather than a universal ranking: patch expectations, compliance needs and migration capacity all matter.
For DevOps teams, the broader lesson is to treat internal services as production workloads when they carry credentials or reach sensitive systems. Scanning them and selecting a runtime image with only the components they require can make image contents easier to manage and reduce avoidable exposure.