MCP Filesystem Server
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 Serverlist 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.
MCP Filesystem Server
An MCP (Model Context Protocol) server for filesystem operations with built-in security features.
Features
File Reading: Read text file contents
File Writing: Create or overwrite files
Directory Listing: List contents with details (name, type, size, modified date)
File Search: Search for files using regex patterns
File Information: Get detailed metadata for files/directories
Directory Creation: Create new directories
File Deletion: Delete files and directories (Downloads folder only for safety)
Related MCP server: MCP File Operations Server
Security
The server implements the following security measures:
Allowed Directories: Only allows access to specific directories:
~/Documents~/Downloads
Delete Restrictions: Delete operations are only allowed in
~/Downloadsfolder for safetyPath Validation: Prevents path traversal attacks
Size Limits: Files limited to 10MB for read operations
Depth Limits: Searches limited to 5 levels deep by default
Installation
# Install dependencies
npm install
# Compile TypeScript
npm run buildUsage
As a standalone MCP server
npm startIntegration with Claude Desktop
Build the project:
npm run buildUpdate your Claude Desktop configuration at:
macOS:
~/Library/Application Support/Claude/claude_desktop_config.jsonWindows:
%APPDATA%\Claude\claude_desktop_config.jsonLinux:
~/.config/Claude/claude_desktop_config.json
Add the server configuration:
{
"mcpServers": {
"filesystem": {
"command": "node",
"args": ["/absolute/path/to/MCP-test/dist/index.js"]
}
}
}Restart Claude Desktop
Available Tools
read_file
Reads the contents of a file.
Parameters:
path(string): Path to the file to read
Example:
{
"path": "~/Documents/test.txt"
}write_file
Writes content to a file.
Parameters:
path(string): Path to the filecontent(string): Content to write
Example:
{
"path": "~/Documents/test.txt",
"content": "Hello, World!"
}list_directory
Lists directory contents with details.
Parameters:
path(string): Path to the directory
Example:
{
"path": "~/Documents"
}search_files
Searches for files matching a regex pattern.
Parameters:
directory(string): Directory to search in (must be within allowed directories)pattern(string): Regex pattern to match file namesmaxDepth(number, optional): Maximum search depth (default: 5)
Example:
{
"directory": "~/Documents",
"pattern": "\\.txt$",
"maxDepth": 3
}get_file_info
Gets detailed information about a file or directory.
Parameters:
path(string): Path to the file or directory
Example:
{
"path": "~/Documents/test.txt"
}create_directory
Creates a new directory.
Parameters:
path(string): Path to the directory to create
Example:
{
"path": "~/Documents/new-folder"
}delete_file
Deletes a file or directory. Only works in Downloads folder for safety.
Parameters:
path(string): Path to the file or directory to delete (must be in Downloads)recursive(boolean, optional): If true, delete directories and their contents recursively (default: false)
Examples:
Delete a file:
{
"path": "~/Downloads/old-file.txt"
}Delete a directory and its contents:
{
"path": "~/Downloads/temp-folder",
"recursive": true
}Important Notes:
Delete operations are only allowed in the Downloads folder
Attempting to delete files in Documents or other locations will be denied
Directories require
recursive: trueparameter to be deletedDeleted files cannot be recovered
Development
# Compile in watch mode
npm run watch
# Compile once
npm run build
# Run after compiling
npm startProject Structure
MCP-test/
├── src/
│ └── index.ts # Main MCP server
├── dist/ # Compiled files (generated)
├── package.json
├── tsconfig.json
├── config.example.json # Configuration example
└── README.mdCustomization
To change allowed directories, edit the ALLOWED_DIRECTORIES constant in src/index.ts:
const ALLOWED_DIRECTORIES = [
path.join(os.homedir(), "Documents"),
path.join(os.homedir(), "Downloads"),
// Add more directories here
];To change the file size limit:
const MAX_FILE_SIZE = 10 * 1024 * 1024; // 10MBTroubleshooting
Server doesn't start
Verify you've compiled the project with
npm run buildVerify the path in the configuration is absolute and correct
"Access denied" when trying to access a file
Verify the file is within
~/Documentsor~/DownloadsCheck file permissions
"File too large"
Files are limited to 10MB by default
Modify
MAX_FILE_SIZEif you need larger files
License
MIT
This server cannot be deployed
Maintenance
Related MCP Connectors
Safe folder access for ChatGPT and Claude: read, write and search files, risky tools opt-in.
Manage files and folders directly from your workspace. Read and write files, list directories, cre…
Use your Mac, Windows or Linux computer from ChatGPT, Claude or Codex: files, commands, documents.
Securely search and manage workspace context files for AI agents and teams.
Related MCP Servers
- FlicenseAqualityDmaintenanceEnables secure filesystem operations with directory sandboxing and optional read-only mode. Supports file reading/writing, directory management, file searching, and text operations while restricting access to specified directories.12-
- FlicenseNot gradedqualityDmaintenanceEnables secure file management operations within a documents folder, including reading, writing, listing, deleting files and creating directories. Supports all file types with path validation to prevent access outside the designated documents directory.1-
- FlicenseNot gradedqualityDmaintenanceProvides secure file system operations for AI assistants including directory listing, file reading/writing, deletion, searching, and copying. Features safety controls like path validation, permission checks, and file size limits.-
- AlicenseNot gradedqualityDmaintenanceProvides secure, sandboxed filesystem operations including reading, writing, listing, searching, and managing files and directories within a configurable working directory with strict security controls.3MIT