Introduction

Many organizations scan customer-facing containers rigorously but give internal AI tooling a pass. Our team operates a small Model Context Protocol server that lets AI assistants reach systems such as GitHub and Slack. Because it ran inside the network, it did not receive the same image scrutiny as our public services. We decided to test whether replacing its base image would meaningfully reduce its reported attack surface.

What Happened

We rebuilt the MCP server using identical application source and dependencies, changing only the runtime base image. The original build used a Debian-based Node image called node:24-trixie-slim. The replacement used a Docker Hardened Image based on Alpine called dhi.io/node:24-alpine3.23 with a multi-stage Dockerfile. A -dev variant handled dependency installation during the build stage, while the production stage contained only the files required to run node src/server.js.

Both images were scanned with Docker Scout on September 28, 2026, using the same architecture. The Debian-based image returned 36 reported vulnerabilities: zero critical, six high, six medium, and 24 low. The hardened Alpine-based image returned zero reported vulnerabilities in that same scan.

Image size also changed. Docker Scout reported compressed sizes of roughly 104 MB versus 56 MB. Uncompressed sizes measured locally were about 255 MB versus 135 MB. The difference reflects both the smaller Alpine footprint and the removal of unnecessary operating system packages.

Zero reported vulnerabilities is a snapshot against a known CVE database, not a guarantee that the image is free of all security issues. This was a single migration of one internal tool, not a controlled vendor comparison.

Why This Matters

Internal AI infrastructure is increasingly treated as trusted infrastructure. MCP servers and agent bridges often hold real credentials and API access to production systems. Yet these containers frequently miss the scanning rigor applied to customer-facing services. By removing packages the server never executes at runtime—such as npm tooling, bash, systemd, apt, and dpkg—we reduced the available attack surface for code that should not be reachable in production.

The change also highlighted a practical debugging consideration. Hardened runtime images often ship without a shell. We used a dedicated -dev build stage for compilation and dependency installation, and Docker Debug can attach a toolkit to a running container without baking a shell into the production image. Teams should plan this debugging path before removing shells from runtime containers.

Key Takeaways

  • Changing only the base image reduced reported vulnerabilities from 36 to zero in a Docker Scout scan.
  • Multi-stage builds let you keep build tools in a -dev stage while shipping a shell-less production runtime.
  • Unused OS packages and package managers represent unnecessary attack surface in containers that never run them.
  • Zero reported vulnerabilities is a point-in-time scan result, not a permanent security guarantee.
  • Internal AI tooling such as MCP servers deserves the same container security attention as public-facing services.

Conclusion

Swapping a base image is not a magic fix, but it can produce a measurable reduction in reported vulnerabilities for internal tools that have been flying under the radar. As more teams deploy MCP servers and similar AI infrastructure, applying the same hardening discipline to internal containers as to public services is a practical step toward reducing supply chain risk. The full Dockerfiles, source code, and CI workflow used for this migration are available in the public hardened-mcp-server repository.