Filesystem Operations
STDIONode.js server implementing MCP for filesystem operations with comprehensive permission controls.
Node.js server implementing MCP for filesystem operations with comprehensive permission controls.
Node.js server implementing Model Context Protocol (MCP) for filesystem operations with comprehensive permission controls and enhanced functionality.
Note: The server will only allow operations within directories specified via args
and according to the configured permissions.
file://system
: File system operations interfaceread_file
path
(string)read_multiple_files
paths
(string[])create_file
path
(string): File locationcontent
(string): File contentcreate
permissionmodify_file
path
(string): File locationcontent
(string): New file contentedit
permissionedit_file
path
(string): File to editedits
(array): List of edit operations
oldText
(string): Text to search for (exact match)newText
(string): Text to replace withdryRun
(boolean): Preview changes without applying (default: false)edit
permissioncreate_directory
path
(string)create
permissionlist_directory
path
(string)directory_tree
path
(string)move_file
source
(string): Source pathdestination
(string): Destination pathmove
permissiondelete_file
path
(string)delete
permissiondelete_directory
path
(string): Directory to deleterecursive
(boolean): Whether to delete contents (default: false)delete
permissionsearch_files
path
(string): Starting directorypattern
(string): Search patternexcludePatterns
(string[]): Exclude patterns (glob format supported)find_files_by_extension
path
(string): Starting directoryextension
(string): File extension to findexcludePatterns
(string[]): Optional exclude patternsget_file_info
path
(string)get_permissions
list_allowed_directories
xml_to_json
xmlPath
(string): Source XML filejsonPath
(string): Destination JSON fileoptions
(object): Optional settings
ignoreAttributes
(boolean): Skip XML attributes (default: false)preserveOrder
(boolean): Maintain property order (default: true)format
(boolean): Pretty print JSON (default: true)indentSize
(number): JSON indentation (default: 2)read
permission for XML filecreate
or edit
permission for JSON filexml_to_json_string
xmlPath
(string): Source XML fileoptions
(object): Optional settings
ignoreAttributes
(boolean): Skip XML attributes (default: false)preserveOrder
(boolean): Maintain property order (default: true)read
permission for XML filexml_query
path
(string): Path to the XML filequery
(string, optional): XPath query to executestructureOnly
(boolean, optional): Return only tag structuremaxBytes
(number, optional): Maximum bytes to read (default: 1MB)includeAttributes
(boolean, optional): Include attribute info (default: true)//tagname
//tagname[@attr="value"]
//tagname/text()
xml_structure
path
(string): Path to the XML filedepth
(number, optional): How deep to analyze (default: 2)includeAttributes
(boolean, optional): Include attribute analysismaxBytes
(number, optional): Maximum bytes to read (default: 1MB)The server implements a comprehensive security model with granular permission controls:
args
Default Behavior: If no permission flags are specified, the server runs in read-only mode. To enable any write operations, you must use either --full-access
or specific --allow-*
flags.
Add appropriate configuration to either claude_desktop_config.json
(for Claude Desktop) or .cursor/mcp.json
(for Cursor):
In .cursor/mcp.json
:
{ "mcpServers": { "my-filesystem": { "command": "node", "args": [ "/path/to/mcp-filesystem/dist/index.js", "~/path/to/allowed/directory", "--full-access" ] } } }
For Claude Desktop with Docker:
{ "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", "--readonly", // For read-only access "--no-follow-symlinks", // Optional: prevent symlink following "/projects" ] } } }
For either Claude Desktop or Cursor with NPX:
{ "mcpServers": { "filesystem": { "command": "npx", "args": [ "-y", "@modelcontextprotocol/server-filesystem", "--full-access", // For full read/write access "/Users/username/Desktop", "/path/to/other/allowed/dir" ] } } }
You can configure the server with various permission combinations:
"args": [ "/path/to/mcp-filesystem/dist/index.js", "~/path/to/allowed/directory", "--readonly" // Read-only mode ]
"args": [ "/path/to/mcp-filesystem/dist/index.js", "~/path/to/allowed/directory", "--full-access", // Full read/write access "--no-follow-symlinks" // Don't follow symlinks ]
"args": [ "/path/to/mcp-filesystem/dist/index.js", "~/path/to/allowed/directory", "--allow-create", // Selective permissions "--allow-edit" // Only allow creation and editing ]
Note: --readonly
takes precedence over all other permission flags, and --full-access
enables all operations unless --readonly
is specified.
When specifying multiple directories, permission flags apply globally to all directories:
"args": [ "/path/to/mcp-filesystem/dist/index.js", "~/first/directory", // Both directories have the same "~/second/directory", // permission settings (read-only) "--readonly" ]
If you need different permission levels for different directories, create multiple server configurations:
{ "mcpServers": { "readonly-filesystem": { "command": "node", "args": [ "/path/to/mcp-filesystem/dist/index.js", "~/sensitive/directory", "--readonly" ] }, "writeable-filesystem": { "command": "node", "args": [ "/path/to/mcp-filesystem/dist/index.js", "~/sandbox/directory", "--full-access" ] } } }
npx -y @modelcontextprotocol/server-filesystem --readonly /path/to/dir
npx -y @modelcontextprotocol/server-filesystem --full-access /path/to/dir
npx -y @modelcontextprotocol/server-filesystem --allow-create --allow-edit /path/to/dir
npx -y @modelcontextprotocol/server-filesystem --full-access --no-follow-symlinks /path/to/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.