Hardened MCP setup restricting agent file operations to specific workspace folders and executing untrusted commands in disposable Docker containers.
Isolated Filesystem & Docker Execution MCP Config
Configuration
{
"mcpServers": {
"filesystem": {
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-filesystem",
"/Users/username/Classwork/open-source/project-sandbox"
]
},
"docker-runner": {
"command": "docker",
"args": [
"run",
"-i",
"--rm",
"--memory=2g",
"--cpus=2.0",
"--network=none",
"-v", "/Users/username/Classwork/open-source/project-sandbox:/workspace:ro",
"node:20-alpine"
]
}
}
}
Safety Guarantees
- The agent cannot read outside the specified directory tree.
- Container execution has
--network=none to prevent accidental data leakage.