Here's my analysis of issue #118 and two approaches to fix it:
The Problem
The Docker image has docker-ce-cli but no Node.js/npx, so stdio-based MCP servers (which are overwhelmingly npm packages) can't run directly inside the container.
Approach 1: Add Node.js to the runtime image (simplest)
In the Dockerfile runtime stage, add Node.js from the official Nodesource repo or just install the Debian package:
dockerfile
# In the runtime RUN block (line 65-85), add nodejs to the apt-get install list:
RUN apt-get update -qq && \
apt-get install -yqq --no-install-recommends \
ca-certificates \
chromium \
curl \
gnupg \
libgomp1 \
nodejs npm \ # <-- add these
sudo \
tmux \
vim-tiny && \
...
Debian bookworm ships Node.js 18.x which is sufficient for most MCP servers. If a newer version is needed, you could instead use the NodeSource setup script or copy from a node:20-slim build stage.
Trade-off: Adds ~60-80MB to the image. Given the image already includes Chromium (~300MB), this is relatively minor.
Approach 2: Document the Docker container workaround (no image change)
Since the Docker CLI + socket is already available, add a "Docker Deployment" section to docs/src/mcp.md showing how to run MCP servers as containers:
toml
# In moltis.toml — run MCP via a Docker container
[mcp.servers.filesystem]
command = "docker"
args = ["run", "--rm", "-i", "-v", "/tmp:/tmp", "--entrypoint", "npx", "node:20-alpine", "-y", "@modelcontextprotocol/server-filesystem", "/tmp"]
# Or use official MCP Docker images
[mcp.servers.memory]
command = "docker"
args = ["run", "--rm", "-i", "mcp/memory"]
Recommendation
I'd do both: add Node.js to the image (Approach 1) for the common case, and document the Docker workaround (Approach 2) as an alternative for users who want isolation or need a specific Node version. The Debian bookworm nodejs package keeps it simple without adding a third-party repo.
Want me to implement either or both?
User
Implement both
Assistant
Both changes are in place:
Dockerfile (lines 58-59): Added nodejs and npm to the runtime image's apt packages, with an updated comment explaining why.
docs/src/mcp.md: Added a new "Running MCP Servers in Docker" section before "Security Considerations" documenting both approaches — using the built-in Node.js directly, and running MCP servers as isolated Docker containers via the mounted socket.
One new unresolved thread — Docker-in-Docker bind mounts reference host paths, not the Moltis container's paths. Good catch. Let me add that note.
Assistant
Done. Added an inline TOML comment and an explanatory note clarifying that Docker bind-mount paths resolve against the host filesystem. Committed, pushed, and resolved the thread.
Now update the Dockerfile comments block to match the new layer structure (remove the inline comments that described the old single-RUN layout).
Assistant
Done. Both threads resolved:
Layer caching: Split the monolithic RUN into three independent layers (base packages, Node.js 22 via NodeSource, Docker CLI) so upgrading Node no longer invalidates other layers.
Wording fix: Clarified that the Docker CLI is installed in the image; the mounted socket provides daemon connectivity.
User
commit and push
Assistant
Everything is already committed and pushed — the last commit a8db995c was pushed in the previous step. Nothing new to commit:
pipefail protection: NodeSource setup script is now downloaded to a temp file first, so a curl failure properly propagates a non-zero exit instead of silently falling back to Node 18.
npx cache in containers: Added a named Docker volume (moltis-npx-cache) to the containerized MCP example so npm packages persist across restarts.
Resolved. Added a tip in the "Using the built-in Node.js" section showing users how to mount /home/moltis/.npm as a named volume so npx doesn't re-download packages on every container start.
Good point — this mirrors the existing Docker CLI install pattern. Let me replace the setup script with the GPG key + apt source approach.
Assistant
Resolved. Replaced the curl | bash setup script with explicit GPG key import + apt source entry — no more shell script execution, and it now mirrors the existing Docker CLI install pattern in the Dockerfile.
Resolved. Added install -m 0755 -d /etc/apt/keyrings at the start of the NodeSource layer so it doesn't depend on the Docker CLI layer creating the directory first.
Resolved. Expanded the tip to also show binding the data directory, so users know they need to mount both the npm cache and any directories the MCP server needs access to.