Filesystem MCP Server

Official

Scoped local file access — read, write, search and reorganise files in directories you explicitly allow.

Local serverstdioTypeScriptMIT 63.0k

What is the Filesystem MCP server?

The Filesystem MCP server is the workhorse of local AI assistance: it lets your assistant read, write, edit, move and search files — but only inside directories you explicitly allow at startup. That allowlist model is the whole design. Grant access to ~/Documents/projects and the model can work freely there while the rest of your disk simply doesn't exist to it.

The tool set is more thoughtful than a naive fs wrapper. read_multiple_files pulls a batch in one call, which matters for context efficiency. edit_file does targeted find-and-replace edits with a dry-run mode, so the assistant can propose a diff before touching anything. search_files recursively hunts filename patterns, directory_tree maps structures as JSON, and head/tail options on reads keep giant log files from flooding the context window.

What do people actually do with it? Organise the download-folder midden into dated subfolders. Batch-rename a photo dump. Read a project directory and write documentation. Refactor config files across a repo. Draft-edit-review loops on documents where the assistant does the typing and you keep approval. In shell-less clients like Claude Desktop, this server is file access — it's the difference between an assistant that talks about your files and one that works with them.

One habit worth keeping: grant the narrowest directories that cover the task, not your home folder. The allowlist is enforced honestly (symlink escapes are blocked), but write tools mean mistakes are possible within scope — version-control or back up anything precious first.

Habits that keep it predictable

  • Ask for edit_file in dry-run mode first. It returns a git-style diff of the proposed change, which is a far better review surface than a rewrite you never saw.
  • search_files matches names, not contents. Finding a string inside files means reading them, so narrow with a filename pattern or an exclude list before the assistant starts opening everything.
  • move_file refuses to clobber an existing destination while write_file overwrites silently — an asymmetry worth remembering during folder reorganisation.
  • Clients that support MCP Roots can hand the server directories at runtime, replacing the paths you passed on the command line. list_allowed_directories is the fastest way to see what is genuinely in scope.

What you can do with it

Folder housekeeping

Sort downloads, batch-rename files and impose order on chaotic directories.

Document workflows

The assistant drafts and edits files in place while you review diffs.

Project comprehension

Read a codebase or notes folder and produce summaries, docs or reorganisation plans.

Available tools

ToolWhat it does
read_text_file / read_multiple_filesRead one or many files, with head/tail options for big ones
write_fileCreate or overwrite a file
edit_fileTargeted find-and-replace edits with dry-run diffs
create_directory / move_fileMake folders, move and rename files
search_filesRecursive filename pattern search
directory_treeJSON tree view of a directory structure
get_file_infoSize, timestamps and permissions metadata
list_allowed_directoriesShow which roots the server may touch

How to install the Filesystem MCP server

{
  "mcpServers": {
    "filesystem": {
      "command": "npx",
      "args": [
        "-y",
        "@modelcontextprotocol/server-filesystem",
        "/Users/you/Documents/projects",
        "/Users/you/Desktop"
      ]
    }
  }
}

Every path listed after the package name becomes an allowed root. Grant narrowly.

Configuration

Node.js 18+. Access is limited to directories passed at startup (or granted via client Roots).

Example prompts to try

  • Organise my Downloads folder: group files by type into subfolders and report what you did.
  • Read every markdown file in this notes directory and build an index with one-line summaries.
  • Find all files mentioning 'API_KEY' under this project and list them with the matching lines.

Frequently asked questions

No — it can only touch directories you list at startup, and it blocks symlink tricks that point outside them. list_allowed_directories shows the active scope at any time.