filesystem
Node.js server implementing Model Context Protocol (MCP) for filesystem operations.
Node.js server implementing Model Context Protocol (MCP) for filesystem operations.
Node.js server implementing Model Context Protocol (MCP) for filesystem operations.
Note: The server will only allow operations within directories specified via args
.
file://system
: File system operations interfacepath
(string)Reads complete file contents with UTF-8 encoding
read_multiple_files
paths
(string[])Failed reads won't stop the entire operation
write_file
Inputs:
path
(string): File locationcontent
(string): File contentedit_file
path
(string): File to editedits
(array): List of edit operationsoldText
(string): Text to search for (can be substring)newText
(string): Text to replace withdryRun
(boolean): Preview changes without applying (default: false)Best Practice: Always use dryRun first to preview changes before applying them
create_directory
path
(string)Succeeds silently if directory exists
list_directory
Input: path
(string)
move_file
source
(string)destination
(string)Fails if destination exists
search_files
path
(string): Starting directorypattern
(string): Search patternexcludePatterns
(string[]): Exclude any patterns. Glob formats are supported.Returns full paths to matches
get_file_info
path
(string)Returns:
list_allowed_directories
Add this to your claude_desktop_config.json
:
Note: you can provide sandboxed directories to the server by mounting them to /projects
. Adding the ro
flag will make the directory readonly by the server.
Note: all directories must be mounted to /projects
by default.
{
"mcpServers": {
"filesystem": {
"command": "docker",
"args": [
"run",
"-i",
"--rm",
"--mount", "type=bind,src=/Users/username/Desktop,dst=/projects/Desktop",
"--mount", "type=bind,src=/path/to/other/allowed/dir,dst=/projects/other/allowed/dir,ro",
"--mount", "type=bind,src=/path/to/file.txt,dst=/projects/path/to/file.txt",
"mcp/filesystem",
"/projects"
]
}
}
}
{
"mcpServers": {
"filesystem": {
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-filesystem",
"/Users/username/Desktop",
"/path/to/other/allowed/dir"
]
}
}
}
Docker build:
docker build -t mcp/filesystem -f src/filesystem/Dockerfile .
This MCP server is licensed under the MIT License. This means you are free to use, modify, and distribute the software, subject to the terms and conditions of the MIT License. For more details, please see the LICENSE file in the project repository.