MCP & Connectors

How do you sandbox MCP server execution for security?

QUICK ANSWER

To sandbox local MCP servers, run the processes in docker container environments, isolate the network using minimal networking settings, and restrict file access to specific, non-root directory paths.

Sandboxing Best Practices

Since stdio MCP servers execute system processes locally, a malicious or malfunctioning server could delete files or read user secrets. Isolate them with these layers:

Docker Isolation

Run your servers inside isolated containers, mounting only the necessary resource volumes:

docker run -it --rm -v /local/dir:/container/dir mcp-server-image

Environment Check

  • Never run Claude Desktop or MCP server tasks as root or Administrator.
  • Set database connection scopes to read-only accounts when querying live schemas.
Verified against: MCP Security Guide v1.0