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.
| Item | Value |
|---|---|
| npm package | @modelcontextprotocol/server-filesystem |
| Docker image | mcp/filesystem |
| Where it runs | On your own computer, started by your MCP app |
| Access limit | Allowed directories only, from arguments or Roots |
| Tools | 13, 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.
| Tool | What it does | Changes files? |
|---|---|---|
| read_text_file | Reads a file as UTF-8 text, optionally only the first or last N lines | No |
| read_media_file | Reads an image, audio or other file as base64 with its MIME type | No |
| read_multiple_files | Reads several files at once; one failure does not stop the rest | No |
| list_directory | Lists a folder with [FILE] and [DIR] prefixes | No |
| list_directory_with_sizes | Same listing with sizes, sortable by name or size | No |
| directory_tree | Returns a nested JSON tree of a folder | No |
| search_files | Glob-style search with optional exclude patterns | No |
| get_file_info | Size, times, type and permissions | No |
| list_allowed_directories | Shows which folders the server may use | No |
| create_directory | Creates a folder and any missing parents | Yes, not destructive |
| write_file | Creates or overwrites a file | Yes, destructive |
| edit_file | Replaces matched text, with a dryRun preview option | Yes, destructive |
| move_file | Moves or renames; fails if the destination exists | Yes, 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
- Type the folders you want the assistant to see, one per line, using full paths.
- Pick npx (needs Node.js) or Docker. Docker can mount folders read-only.
- Pick the config shape your app expects: most apps use mcpServers, VS Code uses servers.
- Copy the JSON into your app's MCP config file and restart the app so it starts the server.
Tips
- Share the smallest folder that does the job, such as one content folder, never your whole home directory.
- Run it through Docker with read-only mounts when the assistant only needs to read.
- Ask the assistant to run list_allowed_directories first so you can see exactly what it was given.
- Use the dry run option of edit_file before letting changes land on files you care about.
- Keep a backup or version history of anything you let the assistant write to.
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.
Build your site free or see all free tools. On We.Inc you can build your site free, with no card and no trial needed to start. AI building is on paid plans from $19 a month.
More in Guides
- Firebase Pricing
- Firebase Security Rules Examples
- Food Website Examples: Restaurants, Cafes, Caterers and Food Trucks | How-to Guide
- Framer Motion Examples: 25 Live React Animations
- Franchise Location Pages: How to Make Each One Worth Ranking | How-to Guide
- Can You Get a Free Domain Name? An Honest Breakdown | How-to Guide
- Free Next.js Templates, Checked for Licence and Upkeep
- React vs Vue vs Svelte vs Astro vs Next.js, with the Same App
Product
Who It's For
- For Agencies
- For Freelancers
- For Hosting Providers
- For SaaS Platforms
- For Startups
- For Financial Services
- For Healthcare
Features
Resources
- Blog
- Help Center
- Free Business Tools
- Free UI Components
- Website Templates
- Template Collections
- Website Examples
- Guides
- Comparisons
- Alternatives
- Best Lists
- Reviews
- Pricing Guides
- Use Cases
- Glossary & Guides
- Integrations
- Developers
- Benchmark
- Windows App