Filesystem MCP Server Policy

The Filesystem MCP server only performs local file I/O. It has the simplest policy.

What it needs

ResourceAccessDetails
FilesystemReadOnly the directories it should serve
NetworkNoneNo internet access
EnvNoneNo variables

Complete Policy

command: ["node", "@modelcontextprotocol/server-filesystem"]

filesystem:
  read:
    - "./my-files"           # Only this directory is served
  write: []                  # Write nothing (read-only)

network:
  allow: []                  # No network

env:
  allow: []                  # No env vars

limits:
  memory_mb: 128
  timeout_s: 60

How to run

# Step 1: Install the server
npm install -g @modelcontextprotocol/server-filesystem

# Step 2: Run sandboxed
warden run --policy policy-filesystem.yaml

Tips

  • Grant only the directories you actually need
  • Use write: [] if you only need to read
  • If it needs write access, give it a separate directory (the output dir)
  • This is the most secure server, no network, no env

Variations

Read + Write access

filesystem:
  read:
    - "./data"
  write:
    - "./output"             # Output files go here

Multiple directories

filesystem:
  read:
    - "./documents"
    - "./images"
    - "./config"
  write: []

Troubleshooting

ErrorFix
permission deniedCheck that the directory is listed in filesystem.read
File not foundThe path is relative to the policy file's folder
Write failedAdd the directory to filesystem.write

Resources