Plugged.in implements robust sandboxing for all STDIO MCP servers to ensure security and resource isolation. This guide covers the sandboxing architecture, configuration, and best practices.
Configure sandboxing behavior through environment variables:
Copy
# Sandboxing TypeMCP_ISOLATION_TYPE=bubblewrap # Options: bubblewrap | firejail | noneMCP_ISOLATION_FALLBACK=firejail # Fallback if primary not available# Network IsolationMCP_ENABLE_NETWORK_ISOLATION=false # Set to true for strict isolation# Resource LimitsMCP_CPU_CORES_MAX=0.5 # Maximum CPU cores (0.5 = 50% of one core)MCP_MEMORY_MAX_MB=512 # Maximum memory in MBMCP_IO_READ_MBPS=10 # I/O read limit in MB/sMCP_IO_WRITE_MBPS=5 # I/O write limit in MB/sMCP_PROCESS_TIMEOUT_MS=300000 # Process timeout in millisecondsMCP_STARTUP_TIMEOUT_MS=10000 # Startup timeout in milliseconds# Package StorageMCP_PACKAGE_STORE_DIR=/var/mcp-packagesMCP_PNPM_STORE_DIR=/var/mcp-packages/pnpm-storeMCP_UV_CACHE_DIR=/var/mcp-packages/uv-cache
// Bubblewrap configuration{ isolation: { type: "bubblewrap", config: { unshareAll: true, // Unshare all namespaces shareNet: true, // Allow network (configurable) dieWithParent: true, // Terminate on parent exit newSession: true, // New session for process uid: 1000, // Run as non-root user gid: 1000, // Run as non-root group hostname: "mcp-sandbox", // Isolated hostname capDrop: ["ALL"], // Drop all capabilities capAdd: ["CAP_NET_BIND_SERVICE"] // Add specific capabilities } }}
Fallback mode with SUID-based isolation
Copy
// Firejail configuration{ isolation: { type: "firejail", config: { private: "/tmp/mcp-workspace", // Private workspace noroot: true, // No root access net: "none", // Network isolation nodbus: true, // No D-Bus access nogroups: true, // No supplementary groups nonewprivs: true, // No new privileges seccomp: true, // Seccomp filtering capsDropAll: true, // Drop all capabilities quiet: true // Suppress firejail output } }}
NOT recommended for production
Copy
MCP_ISOLATION_TYPE=none
Disabling sandboxing exposes your system to potential security risks. Only use for debugging in isolated environments.
Error: “fusermount: fuse device not found”Solution:
Copy
# Install and enable FUSEsudo apt-get install -y fuse3sudo modprobe fuse# For Docker containersdocker run --cap-add SYS_ADMIN --device /dev/fuse
Network isolation too restrictive
Error: “Cannot connect to API endpoint”Solution:
Copy
# Disable network isolation for API serversexport MCP_ENABLE_NETWORK_ISOLATION=false# Or allow specific servers to bypassserver.applySandboxing = false # Use with caution