This MCP server provides secure access to the local filesystem via the Model Context Protocol (MCP). - Name: File System - Description: Access to files and directories on the local file system - Read the complete contents of a file from the file system - Parameters: path (required): Path to the file to read - readmultiplefiles - Read the contents of multiple files in a single operation - Parameter
Add this skill
npx mdskills install mark3labs/mcp-filesystem-serverComprehensive filesystem MCP server with well-documented tools and multiple deployment options
1# MCP Filesystem Server23This MCP server provides secure access to the local filesystem via the Model Context Protocol (MCP).45## Components67### Resources89- **file://**10 - Name: File System11 - Description: Access to files and directories on the local file system1213### Tools1415#### File Operations1617- **read_file**18 - Read the complete contents of a file from the file system19 - Parameters: `path` (required): Path to the file to read2021- **read_multiple_files**22 - Read the contents of multiple files in a single operation23 - Parameters: `paths` (required): List of file paths to read2425- **write_file**26 - Create a new file or overwrite an existing file with new content27 - Parameters: `path` (required): Path where to write the file, `content` (required): Content to write to the file2829- **copy_file**30 - Copy files and directories31 - Parameters: `source` (required): Source path of the file or directory, `destination` (required): Destination path3233- **move_file**34 - Move or rename files and directories35 - Parameters: `source` (required): Source path of the file or directory, `destination` (required): Destination path3637- **delete_file**38 - Delete a file or directory from the file system39 - Parameters: `path` (required): Path to the file or directory to delete, `recursive` (optional): Whether to recursively delete directories (default: false)4041- **modify_file**42 - Update file by finding and replacing text using string matching or regex43 - Parameters: `path` (required): Path to the file to modify, `find` (required): Text to search for, `replace` (required): Text to replace with, `all_occurrences` (optional): Replace all occurrences (default: true), `regex` (optional): Treat find pattern as regex (default: false)4445#### Directory Operations4647- **list_directory**48 - Get a detailed listing of all files and directories in a specified path49 - Parameters: `path` (required): Path of the directory to list5051- **create_directory**52 - Create a new directory or ensure a directory exists53 - Parameters: `path` (required): Path of the directory to create5455- **tree**56 - Returns a hierarchical JSON representation of a directory structure57 - Parameters: `path` (required): Path of the directory to traverse, `depth` (optional): Maximum depth to traverse (default: 3), `follow_symlinks` (optional): Whether to follow symbolic links (default: false)5859#### Search and Information6061- **search_files**62 - Recursively search for files and directories matching a pattern63 - Parameters: `path` (required): Starting path for the search, `pattern` (required): Search pattern to match against file names6465- **search_within_files**66 - Search for text within file contents across directory trees67 - Parameters: `path` (required): Starting directory for the search, `substring` (required): Text to search for within file contents, `depth` (optional): Maximum directory depth to search, `max_results` (optional): Maximum number of results to return (default: 1000)6869- **get_file_info**70 - Retrieve detailed metadata about a file or directory71 - Parameters: `path` (required): Path to the file or directory7273- **list_allowed_directories**74 - Returns the list of directories that this server is allowed to access75 - Parameters: None7677## Features7879- Secure access to specified directories80- Path validation to prevent directory traversal attacks81- Symlink resolution with security checks82- MIME type detection83- Support for text, binary, and image files84- Size limits for inline content and base64 encoding8586## Getting Started8788### Installation8990#### Using Go Install9192```bash93go install github.com/mark3labs/mcp-filesystem-server@latest94```9596### Usage9798#### As a standalone server99100Start the MCP server with allowed directories:101102```bash103mcp-filesystem-server /path/to/allowed/directory [/another/allowed/directory ...]104```105106#### As a library in your Go project107108```go109package main110111import (112 "log"113 "os"114115 "github.com/mark3labs/mcp-filesystem-server/filesystemserver"116)117118func main() {119 // Create a new filesystem server with allowed directories120 allowedDirs := []string{"/path/to/allowed/directory", "/another/allowed/directory"}121 fs, err := filesystemserver.NewFilesystemServer(allowedDirs)122 if err != nil {123 log.Fatalf("Failed to create server: %v", err)124 }125126 // Serve requests127 if err := fs.Serve(); err != nil {128 log.Fatalf("Server error: %v", err)129 }130}131```132133### Usage with Model Context Protocol134135To integrate this server with apps that support MCP:136137```json138{139 "mcpServers": {140 "filesystem": {141 "command": "mcp-filesystem-server",142 "args": ["/path/to/allowed/directory", "/another/allowed/directory"]143 }144 }145}146```147148### Docker149150#### Running with Docker151152You can run the Filesystem MCP server using Docker:153154```bash155docker run -i --rm ghcr.io/mark3labs/mcp-filesystem-server:latest /path/to/allowed/directory156```157158#### Docker Configuration with MCP159160To integrate the Docker image with apps that support MCP:161162```json163{164 "mcpServers": {165 "filesystem": {166 "command": "docker",167 "args": [168 "run",169 "-i",170 "--rm",171 "ghcr.io/mark3labs/mcp-filesystem-server:latest",172 "/path/to/allowed/directory"173 ]174 }175 }176}177```178179If you need changes made inside the container to reflect on the host filesystem, you can mount a volume. This allows the container to access and modify files on the host system. Here's an example:180181```json182{183 "mcpServers": {184 "filesystem": {185 "command": "docker",186 "args": [187 "run",188 "-i",189 "--rm",190 "--volume=/allowed/directory/in/host:/allowed/directory/in/container",191 "ghcr.io/mark3labs/mcp-filesystem-server:latest",192 "/allowed/directory/in/container"193 ]194 }195 }196}197```198199## License200201See the [LICENSE](LICENSE) file for details.202
Full transparency — inspect the skill content before installing.