Filesystem MCP Server: Give an Assistant Safe Access to Your Folders

The Filesystem MCP server is the reference Node.js program from the Model Context Protocol project that lets an AI assistant read, write, search and move files, but only inside folders you allow. You list those folders when it starts, or your app supplies them through Roots. Everything outside them is refused.

Filesystem MCP server at a glance
ItemValue
npm package@modelcontextprotocol/server-filesystem
Docker imagemcp/filesystem
Where it runsOn your own computer, started by your MCP app
Access limitAllowed directories only, from arguments or Roots
Tools13, of which 9 only read

Updated

MCP (Model Context Protocol) is an open standard that lets an assistant app call small helper programs called servers. The filesystem server is the one most people install first, because it turns "look at my product descriptions folder" into something the assistant can actually do. This page explains what it can touch, how the folder limit works, and how to keep it read-only. Use the builder below to produce a config you can paste into your app's MCP settings.

Filesystem MCP config builder

Type your folders and choose how to run the server. The JSON updates as you type and nothing leaves your browser.

Read-only mounting is documented for Docker. With npx the server can write inside the folders you list.

Config JSON

{
  "mcpServers": {
    "filesystem": {
      "command": "npx",
      "args": [
        "-y",
        "@modelcontextprotocol/server-filesystem",
        "/Users/you/Documents/shop-exports",
        "/Users/you/Documents/blog-drafts"
      ]
    }
  }
}

The 13 tools and what each can change

Read-only means the README marks the tool with readOnlyHint true. Destructive means it can overwrite or remove existing content.

Filesystem MCP server tools
ToolWhat it doesChanges files?
read_text_fileReads a file as UTF-8 text, optionally only the first or last N linesNo
read_media_fileReads an image, audio or other file as base64 with its MIME typeNo
read_multiple_filesReads several files at once; one failure does not stop the restNo
list_directoryLists a folder with [FILE] and [DIR] prefixesNo
list_directory_with_sizesSame listing with sizes, sortable by name or sizeNo
directory_treeReturns a nested JSON tree of a folderNo
search_filesGlob-style search with optional exclude patternsNo
get_file_infoSize, times, type and permissionsNo
list_allowed_directoriesShows which folders the server may useNo
create_directoryCreates a folder and any missing parentsYes, not destructive
write_fileCreates or overwrites a fileYes, destructive
edit_fileReplaces matched text, with a dryRun preview optionYes, destructive
move_fileMoves or renames; fails if the destination existsYes, destructive

Config examples

Run with npx, two folders

The folders after the package name become the allowed directories. Requires Node.js on your machine.

{
  "mcpServers": {
    "filesystem": {
      "command": "npx",
      "args": [
        "-y",
        "@modelcontextprotocol/server-filesystem",
        "/Users/you/Documents/shop-exports",
        "/Users/you/Documents/blog-drafts"
      ]
    }
  }
}

Run with Docker, one folder read-only

Folders are mounted under /projects. The ro flag stops the server writing to that folder.

{
  "mcpServers": {
    "filesystem": {
      "command": "docker",
      "args": [
        "run", "-i", "--rm",
        "--mount", "type=bind,src=/Users/you/Documents/shop-exports,dst=/projects/shop-exports,ro",
        "mcp/filesystem",
        "/projects"
      ]
    }
  }
}

VS Code workspace config (.vscode/mcp.json)

VS Code uses a servers key. ${workspaceFolder} limits the server to the project you have open.

{
  "servers": {
    "filesystem": {
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/server-filesystem", "${workspaceFolder}"]
    }
  }
}

Allowed directories and Roots, in plain words

There are two ways to tell the server which folders it may use. The first is to put folder paths after the package name in the config, which fixes the list until you restart. The second is Roots, a feature where the assistant app tells the server which folders are in play and can change that list while running.

The README calls Roots the recommended method. The detail that matters for safety: once your app's Roots are in force, an update with no valid roots revokes all access instead of falling back to the folders you typed.

Useful jobs for a site or store owner

Point it at a folder of exported product data and ask for a list of items missing descriptions. Point it at your blog drafts and ask for a summary of which posts mention an old price. Point it at a downloaded copy of your site and search for broken image names.

In each case the folder is a copy, not the live site, so a mistaken edit costs nothing. That habit is worth more than any setting.

How it works

  1. Type the folders you want the assistant to see, one per line, using full paths.
  2. Pick npx (needs Node.js) or Docker. Docker can mount folders read-only.
  3. Pick the config shape your app expects: most apps use mcpServers, VS Code uses servers.
  4. Copy the JSON into your app's MCP config file and restart the app so it starts the server.

Tips

Frequently asked questions

Can the filesystem MCP server read files outside the folders I list?

No. The README states that all filesystem operations are restricted to allowed directories. If the client sends Roots, those replace the command-line folders entirely, so the allowed list is whatever your app last supplied.

What happens if I start it with no folders at all?

If your app supports Roots, the server waits for the app to send them. If the app does not support Roots and you gave no folders, the server logs the reason, closes the connection and exits with status 1.

How do I make it read-only?

The README documents one way: run the Docker image and add ro to each bind mount, which makes that folder readonly to the server. Some apps also let you approve or block individual tools, which helps, but the mount is the firmer limit.

Can it delete files?

Its tool list has no delete tool. It can still destroy content, though: write_file overwrites existing files and move_file removes the source, so both are marked destructive in the README's annotation table.

Does it need internet access?

Not for its work. Every tool sets openWorldHint to false, meaning it only touches the local filesystem inside allowed folders. npx does download the package the first time it runs.

Related: What is an MCP server?, How to build an MCP server, Playwright MCP server, Self-hosted AI agent, Connect MCP in We.Inc.

Start for free or see all free tools. We.Inc is free to start, with no card needed. AI building is on paid plans from $20 a month.

More in Guides

We.Inc is an AI-powered website builder you can resell under your own brand. Launch a branded client dashboard, bill on Stripe Connect, and deliver AI-generated websites in minutes. White-label plans start at $99 a month for 25 client sites, with a 7-day free trial and no per-site fees.

Product

Who It's For

Features

Resources

Company

View Sitemap