MCP Filesystem Server
Provides containerized deployment of the MCP server, with support for mounting host directories as read-only or read-write volumes, allowing secure file operations from within Docker containers.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@MCP Filesystem Server list the files in my Documents folder"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
:bookmark: About
MCP Filesystem Server provides secure filesystem access for AI models through the Model Context Protocol. It enforces strict path validation and only allows access to predefined directories.
Related MCP server: MCP Filesystem Server
:computer: Technologies
:wrench: Tools
:package: Installation
:heavy_check_mark: Prerequisites
The following software must be installed:
Node.js (>=18.0.0)
pnpm (>=8.0.0)
Docker (optional)
Docker Compose (optional)
:arrow_down: Cloning the repository
$ git clone https://github.com/gabrielmaialva33/mcp-filesystem.git
$ cd mcp-filesystem:arrow_forward: Running the application
Local Development
# Install dependencies
$ pnpm install
# Build the application
$ pnpm build
# Run the server (specify directory to allow access to)
$ pnpm start /path/to/allowed/directory
# Or use configuration file
$ pnpm start --config=config.jsonUsing NPM Package
# Install globally
$ npm install -g @gabrielmaialva33/mcp-filesystem
# Run the server
$ mcp-filesystem /path/to/allowed/directory
# Or use with npx (no installation needed)
$ npx @gabrielmaialva33/mcp-filesystem /path/to/allowed/directory
# Create a sample configuration file
$ npx @gabrielmaialva33/mcp-filesystem --create-config=config.jsonUsing Docker
# Build the Docker image
$ docker build -t gabrielmaialva33/mcp-filesystem .
# Run using Docker
$ docker run -i --rm -v /path/to/data:/data:ro gabrielmaialva33/mcp-filesystem /data
# Use with config file
$ docker run -i --rm -v /path/to/config.json:/app/config.json -v /path/to/data:/data gabrielmaialva33/mcp-filesystem --config=/app/config.jsonUsing Docker Compose
# Create a data directory
$ mkdir -p data
# Start the server
$ docker-compose up -d:gear: Usage
Using with Claude Desktop
Claude Desktop can be configured to use this MCP server for filesystem access. Add the following to your
claude_desktop_config.json:
Using Local Installation (Recommended)
{
"mcpServers": {
"filesystem": {
"command": "mcp-filesystem",
"args": [
"/Users/gabrielmaia/Documents",
"/Users/gabrielmaia/Desktop",
"/Users/gabrielmaia/Downloads"
]
}
}
}Make sure to make the executable available globally:
# Make the binary executable
chmod +x /Users/gabrielmaia/.nvm/versions/node/v22.14.0/bin/mcp-filesystemUsing NPX
{
"mcpServers": {
"filesystem": {
"command": "npx",
"args": [
"-y",
"@gabrielmaialva33/mcp-filesystem",
"/Users/username/Desktop",
"/path/to/other/allowed/dir"
]
}
}
}Using Docker
Note: When using Docker, all directories must be mounted to /projects by default. Adding the ro flag will make the
directory read-only.
{
"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",
"gabrielmaialva33/mcp-filesystem",
"/projects"
]
}
}
}Available Tools
The MCP Filesystem Server provides these tools:
File System Operations
read_file: Read a file's content
read_multiple_files: Read multiple files at once
write_file: Create or overwrite a file
edit_file: Make precise edits with diff preview
create_directory: Create directories recursively
list_directory: List directory contents
directory_tree: Get a recursive tree view
move_file: Move or rename files
search_files: Find files matching patterns
get_file_info: Get file metadata
list_allowed_directories: See accessible directories
System & Network Operations
get_metrics: View server performance metrics (v0.3.0+)
execute_command: Execute system commands securely (v0.3.1+)
curl_request: Execute HTTP requests to external APIs (coming in v1.2.0)
Using curl_request Tool (Coming in v1.2.0)
The curl_request tool will allow you to make HTTP requests to external APIs:
// Example: Making a GET request with authentication
curl_request({
url: 'https://api.example.com/data',
method: 'GET',
headers: {
Authorization: 'Bearer your_token_here',
},
})
// Example: POST request with JSON data
curl_request({
url: 'https://api.example.com/create',
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
data: '{"name":"Example","value":123}',
})See the docs/curl-tool-examples.md file for more detailed examples.
:sparkles: Features
Core Features
Secure Access: Strict path validation prevents unauthorized access
File Operations: Read, write, edit, and move files
Directory Operations: Create, list, get tree views, and search directories
Metadata Access: View file and directory information
Command Execution: Securely execute system commands with strict validation
Docker Support: Easy deployment with Docker and Docker Compose
New Features in v0.3.0
Structured Logging: Detailed logging with different levels (debug, info, warn, error)
Performance Metrics: Track operation counts, errors, and execution times
Configuration Management: Support for JSON configuration files
Path Caching: Improved performance for frequently accessed paths
Improved Error Handling: Specialized error types with structured information
File Size Validation: Prevent loading excessively large files
CLI Improvements: Help command, version info, and config generation
Configuration Options
You can create a configuration file using:
$ mcp-filesystem --create-config=config.jsonExample configuration:
{
"allowedDirectories": ["/path/to/allowed/dir1", "/path/to/allowed/dir2"],
"logLevel": "info",
"logFile": "/path/to/logs/mcp-filesystem.log",
"serverName": "secure-filesystem-server",
"serverVersion": "0.3.0",
"cache": {
"enabled": true,
"maxSize": 1000,
"ttlMs": 60000
},
"metrics": {
"enabled": true,
"reportIntervalMs": 60000
},
"security": {
"maxFileSize": 10485760,
"allowSymlinks": true,
"validateRealPath": true
}
}:writing_hand: Author
License
Available Tools
16 toolsbash_executeB
Execute a Bash command directly with output capture. More flexible than execute_command but still with security restrictions. Allows for direct access to Bash functionality.
Inputs: command (required), env, timeout, workingDir.
bash_pipeB
Execute a sequence of Bash commands piped together. Allows for powerful command combinations with pipes. Results include both stdout and stderr.
Inputs: commands (required), env, timeout, workingDir.
create_directoryA
Create a new directory or ensure a directory exists. Can create multiple nested directories in one operation. If the directory already exists, this operation will succeed silently. Perfect for setting up directory structures for projects or ensuring required paths exist. Only works within allowed directories.
Inputs: path (required).
curl_requestB
Execute a curl request to an external HTTP API. Allows specifying URL, method, headers, and data. Useful for integrating with external services via HTTP.
Inputs: url (required), data, followRedirects, headers, +3 more.
directory_treeA
Get a recursive tree view of files and directories as a JSON structure. Each entry includes 'name', 'type' (file/directory), and 'children' for directories. Files have no children array, while directories always have a children array (which may be empty). The output is formatted with 2-space indentation for readability. Only works within allowed directories.
Inputs: path (required).
edit_fileA
Make line-based edits to a text file. Each edit replaces exact line sequences with new content. Returns a git-style diff showing the changes made. Only works within allowed directories.
Inputs: edits (required), path (required), dryRun.
execute_commandB
Execute a system command with security restrictions. Validates commands for safety and provides detailed output. Limited to basic system operations with security checks.
Inputs: command (required), captureOutput, timeout, workingDir.
get_file_infoA
Retrieve detailed metadata about a file or directory. Returns comprehensive information including size, creation time, last modified time, permissions, and type. This tool is perfect for understanding file characteristics without reading the actual content. Only works within allowed directories.
Inputs: path (required).
get_metricsB
Returns performance metrics about server operations. Useful for monitoring and debugging.
Inputs: no named parameters.
list_allowed_directoriesA
Returns the list of directories that this server is allowed to access. Use this to understand which directories are available before trying to access files.
Inputs: no named parameters.
list_directoryA
Get a detailed listing of all files and directories in a specified path. Results clearly distinguish between files and directories with [FILE] and [DIR] prefixes. This tool is essential for understanding directory structure and finding specific files within a directory. Only works within allowed directories.
Inputs: path (required).
move_fileA
Move or rename files and directories. Can move files between directories and rename them in a single operation. If the destination exists, the operation will fail. Works across different directories and can be used for simple renaming within the same directory. Both source and destination must be within allowed directories.
Inputs: destination (required), source (required).
read_fileA
Read the complete contents of a file from the file system. Handles various text encodings and provides detailed error messages if the file cannot be read. Use this tool when you need to examine the contents of a single file. Only works within allowed directories.
Inputs: path (required), encoding.
read_multiple_filesA
Read the contents of multiple files simultaneously. This is more efficient than reading files one by one when you need to analyze or compare multiple files. Each file's content is returned with its path as a reference. Failed reads for individual files won't stop the entire operation. Only works within allowed directories.
Inputs: paths (required), encoding.
search_filesA
Recursively search for files and directories matching a pattern. Searches through all subdirectories from the starting path. The search is case-insensitive and matches partial names. Returns full paths to all matching items. Great for finding files when you don't know their exact location. Only searches within allowed directories.
Inputs: path (required), pattern (required), excludePatterns.
write_fileA
Create a new file or completely overwrite an existing file with new content. Use with caution as it will overwrite existing files without warning. Handles text content with proper encoding. Only works within allowed directories.
Inputs: content (required), path (required), encoding.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 16 tools
Most tools have distinct purposes, but there is some overlap between bash_execute, bash_pipe, and execute_command, which could cause confusion about when to use each. The descriptions help differentiate them, but the boundaries are not entirely clear, especially between bash_execute and execute_command.
All tool names follow a consistent snake_case pattern with clear verb_noun structures, such as create_directory, read_file, and search_files. There are no deviations in naming conventions, making the set predictable and easy to understand.
With 16 tools, the count is slightly high but reasonable for a filesystem server covering operations like file management, directory handling, and system commands. It includes essential tools without being overly bloated, though some consolidation might improve efficiency.
The tool set provides comprehensive coverage for filesystem operations, including CRUD for files and directories, metadata retrieval, searching, editing, and system command execution. There are no obvious gaps; agents can perform typical filesystem tasks without dead ends.
Maintenance
Related MCP Connectors
A comprehensive Model Context Protocol (MCP) server that enables AI assistants to interact with yo…
A Model Context Protocol server for Wix AI tools
Enable secure connectivity between Sentry issues and debugging data, and LLM clients, using a Model Context Protocol (MCP) server.
Remote MCP server exposing your Node Command fleet (files, shell, processes, browser) to AI hosts.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceA Model Context Protocol (MCP) server that allows AI models to safely access and interact with local file systems, enabling reading file contents, listing directories, and retrieving file metadata.10 npm10MIT
- AlicenseAqualityFmaintenanceA Model Context Protocol server that provides secure and intelligent interaction with files and filesystems, offering smart context management and token-efficient operations for working with large files and complex directory structures.2167MIT
- AlicenseAqualityDmaintenanceA Model Context Protocol server that provides AI agents with secure access to local filesystem operations, enabling reading, writing, and managing files through a standardized interface.10110 npm54Apache 2.0
- AlicenseAqualityDmaintenanceProvides secure filesystem access for AI models through the Model Context Protocol with strict path validation, file operations, directory management, and system command execution within predefined directories.1681 npmMIT