SuperAPI AI Directory

mcp-filesystem-server

mcp-filesystem-server is a Model Context Protocol (MCP) server implemented in the Go language that provides secure access to the local filesystem. Through the MCP protocol, it exposes a series of file and directory operation tools to applications that support the protocol, including reading files, batch reading, writing, copying, moving, deleting, modifying, listing directories, creating directories, generating directory trees, searching for files, searching within file contents, obtaining file information, and listing allowed directories. The server emphasizes security, supporting the specification of allowed directories, path validation to prevent directory traversal attacks, symlink resolution with security checks, MIME type detection, and support for text, binary, and image files, while imposing size limits on inline content and base64 encoding. It can be started via the command line with allowed directories specified, can also be run with Docker, and supports mounting volumes so that modifications inside the container are reflected in the host filesystem.

Open website

About this tool

Purpose

mcp-filesystem-server is a Model Context Protocol (MCP) server implemented in Go, used to provide secure access to the local filesystem through the MCP protocol. It is intended for scenarios where applications that support MCP need to safely read and write local files and directories.

Main Capabilities

The server provides the following filesystem operation tools:

  • read_file: Reads the complete contents of a file. Parameters: path (required), the path of the file to read.
  • read_multiple_files: Reads the contents of multiple files in a single operation. Parameters: paths (required), the list of file paths to read.
  • write_file: Creates a new file or overwrites an existing file with new content. Parameters: path (required), the path of the file to write; content (required), the content to write to the file.
  • copy_file: Copies files and directories. Parameters: source (required), the source file or directory path; destination (required), the destination path.
  • move_file: Moves or renames files and directories. Parameters: source (required), the source file or directory path; destination (required), the destination path.
  • delete_file: Deletes a file or directory from the filesystem. Parameters: path (required), the path of the file or directory to delete; recursive (optional), whether to recursively delete directories (default: false).
  • modify_file: Updates a file by finding and replacing text through string matching or regular expressions. Parameters: path (required), the path of the file to modify; find (required), the text to search for; replace (required), the text to replace with; all_occurrences (optional), whether to replace all matches (default: true); regex (optional), whether to treat the find pattern as a regular expression (default: false).
  • list_directory: Gets a detailed list of all files and directories under the specified path. Parameters: path (required), the directory path to list.
  • create_directory: Creates a new directory or ensures that a directory exists. Parameters: path (required), the directory path to create.
  • tree: Returns a hierarchical JSON representation of the directory structure. Parameters: path (required), the directory path to traverse; depth(optional), maximum traversal depth (default: 3); follow_symlinks (optional), whether to follow symbolic links (default: false).
  • search_files: recursively searches for files and directories matching a pattern. Parameters: path (required), the starting path for the search; pattern (required), the search pattern to match against file names.
  • search_within_files: searches for text within the contents of files in a directory tree. Parameters: path (required), the starting directory for the search; substring (required), the text to search for in file contents; depth (optional), the maximum directory search depth; max_results (optional), the maximum number of results to return (default: 1000).
  • get_file_info: retrieves detailed metadata for a file or directory. Parameters: path (required), the path to the file or directory.
  • list_allowed_directories: returns the list of directories that this server is allowed to access. Parameters: none.

Security Features

  • Secure access to specified directories
  • Path validation to prevent directory traversal attacks
  • Symlink resolution with security checks
  • MIME type detection
  • Support for text, binary, and image files
  • Size limits for inline content and base64 encoding

Usage

Start the MCP server with the allowed directories.

Integrate with MCP-supporting applications: this server can be integrated with applications that support MCP.

Run the Filesystem MCP server with Docker: the server can be run with Docker.

Integrate the Docker image with MCP-supporting applications: the Docker image can be integrated with applications that support MCP.

If changes made inside the container need to be reflected on the host filesystem, a volume can be mounted. This allows the container to access and modify files on the host system.

Applicable Scenarios

Suitable for scenarios where applications that support MCP need to securely access, read, write, search, and manage local files and directories, such as performing file operations, content retrieval, and directory structure viewing within a controlled directory scope.

Limitations

The materials do not provide specific installation commands, configuration examples, pricing, platform support scope, or performance metrics; this information is not currently available.