Skip to content
This repository was archived by the owner on Jan 30, 2026. It is now read-only.

Add offline mode for air-gapped Docker deployments#37

Open
scampion wants to merge 7 commits intopydantic:mainfrom
scampion:main
Open

Add offline mode for air-gapped Docker deployments#37
scampion wants to merge 7 commits intopydantic:mainfrom
scampion:main

Conversation

@scampion
Copy link

Summary

  • Add --offline CLI flag to run with pre-cached dependencies (no network access at runtime)
  • Configure pyodide to use local packages from node_modules instead of CDN
  • Update Dockerfile to pre-cache all dependencies during build (npm + pyodide packages)

Why offline mode?

Many enterprise and research environments operate in air-gapped networks where containers cannot access external registries or CDNs at runtime. This is
common in:

  • Secure/classified environments with strict network isolation policies
  • Edge deployments with limited or no internet connectivity
  • Regulated industries (finance, healthcare, government) requiring reproducible, auditable builds
  • CI/CD pipelines that enforce network-disabled test environments

This feature allows the Docker image to be fully self-contained — all dependencies (npm packages and pyodide Python packages) are cached during build,
enabling the MCP server to run without any network access.

Changes

  • mcp_run_python/_cli.py: Add --offline argument
  • mcp_run_python/main.py: Support offline mode - copy node_modules, skip install step, pass --cached-only to deno
  • mcp_run_python/deno/src/runCode.ts: Set pyodide indexURL to local node_modules/pyodide/
  • Dockerfile: Run deno install + noop mode during build to pre-cache packages; default to --offline in entrypoint
  • smoke_test.sh: Add basic smoke test script

Test plan

  • Build Docker image: docker build -t mcp-run-python .
  • Run container without network: docker run --network none -p 3001:3001 mcp-run-python
  • Verify with smoke test: ./smoke_test.sh

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants