Home / MCP / Filesystem MCP Server

Filesystem MCP Server

Provides filesystem operations to read, write, move, list, and search files within allowed directories.

javascript
Installation
Add the following to your MCP client configuration file.

Configuration

View docs
{
    "mcpServers": {
        "filesystem_mcp": {
            "command": "node",
            "args": [
                "/path/to/filesystem-server/build/index.js",
                "/path/to/allowed/dir1",
                "/path/to/allowed/dir2"
            ]
        }
    }
}

A Model Context Protocol (MCP) server that provides filesystem operations. It lets you read, write, move, list, and search files and directories within allowed paths, making it easy to automate file management from your MCP client while enforcing a strict security boundary.

How to use

You interact with the filesystem MCP server through a client that supports MCP operations. You can read files, write or overwrite content, create directories, list directory contents, move files, search recursively, and retrieve metadata. All operations are constrained to the directories you specify when you start the server, ensuring your file access stays within safe boundaries.

How to install

Prerequisites: you need Node.js installed on your system. You can verify Node.js and npm by running node -v and npm -v in your terminal.

Step 1: Install dependencies and build the project.

Step 2: Start the server with one or more allowed directories. Supply the full paths to the directories you want the server to access.

MCP configuration

{
  "mcpServers": {
    "filesystem": {
      "command": "node",
      "args": [
        "/path/to/filesystem-server/build/index.js",
        "/path/to/allowed/dir1",
        "/path/to/allowed/dir2"
      ],
      "disabled": false,
      "autoApprove": []
    }
  }
}

Security

The server only allows operations within directories specified via command-line arguments when you start it. Any request outside those paths is rejected to protect your data.

Notes and tips

If you need to manage multiple directories, pass them all on the startup command line in the order you prefer. Keep your allowed paths organized to prevent accidental writes outside the intended scope.

Available filesystem operations

  • read_file: Read complete contents of a file (UTF-8) by supplying path
  • read_multiple_files: Read multiple files concurrently without aborting on a single failure
  • write_file: Create a new file or overwrite an existing one (path and content)
  • create_directory: Create a directory (including parents) or ensure it exists
  • list_directory: List directory contents with [FILE] or [DIR] prefixes
  • move_file: Move or rename files and directories (destination must not already exist)
  • search_files: Recursively search for files/directories from a starting path with a case-insensitive pattern
  • get_file_info: Retrieve size, timestamps, type, and permissions for a path
  • list_allowed_directories: Return all directories the server is allowed to read/write

Available tools

read_file

Read complete contents of a file (UTF-8) by supplying the path.

read_multiple_files

Read multiple files concurrently; a failed read does not abort the entire operation.

write_file

Create a new file or overwrite an existing one using the provided path and content.

create_directory

Create a new directory or ensure it exists, including any required parent directories.

list_directory

List directory contents with a [FILE] or [DIR] prefix for each item.

move_file

Move or rename files and directories; the destination must not already exist.

search_files

Recursively search for files or directories from a starting path using a case-insensitive pattern.

get_file_info

Return detailed metadata for a path, including size, creation/modification/access times, type, and permissions.

list_allowed_directories

Return all directories the server is permitted to read/write.