Filesystem MCP 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., "@Filesystem MCP Server list the files in my projects directory"
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.
Filesystem MCP Server (v0.1)
A simple MCP server for filesystem operations with directory sandboxing and read-only mode support.
Early version (0.1) - not thoroughly tested/reviewed, use with caution
Quick Start
Install dependencies:
git clone <repo_url>
uv syncRun the server:
# Normal mode - full filesystem access
uv run main.py /path/to/allowed/directory
# Read-only mode - no write operations
uv run main.py --read-only /path/to/allowed/directoryRelated MCP server: MCP File Server
Features
Directory sandboxing (operations restricted to allowed paths)
--read-onlyflag disables write operationsGitignore support for searches
Human-readable error messages
Usage Examples
Normal Mode
uv run main.py ~/projects
# Provides: create_file, delete_file, move_file, edit_file, create_directory + read toolsRead-Only Mode
uv run main.py --read-only ~/projects
# Provides only: read_text_file, list_directory, search_files, grep, directory_treeMultiple Directories
uv run main.py /home/user/docs /tmp/workspace
uv run main.py --read-only /var/log /etc/configAvailable Tools
Read Operations (always available):
read_text_file- Read file contentslist_directory- List directory contentsdirectory_tree- JSON directory structuresearch_files- Find files by patterngrep- Search text in filesread_multiple_files- Bulk file reading
Write Operations (disabled in --read-only):
create_file- Create new filesdelete_file- Delete filesmove_file- Move/rename filesedit_file- Edit file contentscreate_directory- Create directories
Dependencies
From pyproject.toml:
fastmcp>=2.11.2- MCP frameworkpathspec>=0.12.1- Gitignore patterns
Security Notes
All paths resolved with
Path.resolve()to prevent traversalOperations restricted to allowed directories only
Binary files rejected for text operations
Available Tools
12 toolscreate_directoryA
Create a directory, including any necessary parent directories.
Args: path (str): Directory path to create (absolute or relative to allowed directories)
Returns: str: Success message with created directory path, or error message if failed
Note: - Path must be within allowed directory roots - Creates parent directories if they don't exist - No error if directory already exists
Inputs: path (required). Returns: result
create_fileA
Create a new file with specified content.
Args: path (str): File path to create (absolute or relative to allowed directories) content (str): UTF-8 text content to write to the file
Returns: str: Success message with created file path, or error message if failed
Note: - Fails if the file already exists - Creates parent directories if they don't exist - Path must be within allowed directory roots
Inputs: path (required), content (required). Returns: result
delete_fileA
Delete a file from the filesystem.
Args: path (str): File path to delete (absolute or relative to allowed directories)
Returns: str: Success message with deleted file path, or error message if failed
Note: - Path must be within allowed directory roots - Fails if file doesn't exist or cannot be deleted
Inputs: path (required). Returns: result
directory_treeA
Generate a plain text tree structure of a directory.
Args: path (str): Directory path to generate tree for (absolute or relative to allowed directories)
Returns: str: Plain text representation of directory tree, or error message if failed
Inputs: path (required). Returns: result
edit_fileA
Apply multiple text replacements to a file and return a unified diff.
Args: path (str): File path to edit (absolute or relative to allowed directories) edits (List[Dict[str, str]]): List of edit operations, each with 'oldText' and 'newText' keys
Returns: str: Unified diff showing changes made, or error message if failed
Note: - Path must be within allowed directory roots - File must be a UTF-8 text file - Edits are applied sequentially in the order provided - Each 'oldText' must match exactly (first occurrence is replaced) - Returns unified diff format showing before/after changes - File is atomically updated using temporary file - If no changes made, returns 'No changes made.'
Inputs: path (required), edits (required). Returns: result
grepA
Search for text patterns inside files using regular expressions.
Args: dir (str): Directory to search in (absolute or relative to allowed directories) pattern (str): Regular expression pattern to search for in file contents exclude (str, optional): File pattern to exclude from search
Returns: str: Newline-separated matches in format 'path:lineNo: line', or error message if failed
Note: - Directory must be within allowed directory roots - Searches recursively through subdirectories - Only searches UTF-8 text files - Respects .gitignore files and skips common lock files - Each match shows file path, line number, and the matching line - Uses Python regular expression syntax
Inputs: dir (required), pattern (required), exclude. Returns: result
list_allowed_directoriesA
List all allowed directory roots for filesystem operations.
Returns: List[str]: Absolute paths of directories the server can read/write
Inputs: no named parameters. Returns: result
list_directoryA
List the contents of a directory with type annotations.
Args: path (str): Directory path to list (absolute or relative to allowed directories)
Returns: str: Newline-separated list of entries with '[DIR]' or '[FILE]' prefixes, or error message if failed
Note: - Path must be within allowed directory roots - Fails if path is not a directory - Entries are sorted alphabetically - Format: '[DIR] dirname' or '[FILE] filename'
Inputs: path (required). Returns: result
move_fileA
Move or rename a file from source to destination.
Args: src (str): Source file path (absolute or relative to allowed directories) dst (str): Destination file path (absolute or relative to allowed directories)
Returns: str: Success message with source and destination paths, or error message if failed
Note: - Both paths must be within allowed directory roots - Fails if destination already exists - Creates parent directories for destination if needed
Inputs: src (required), dst (required). Returns: result
read_multiple_filesA
Read multiple UTF-8 text files at once and return a mapping of paths to contents.
Args: paths (List[str]): List of file paths to read (absolute or relative to allowed directories)
Returns: Dict[str, str] | str: Dictionary mapping absolute file paths to their contents, or error message if any file fails
Note: - All paths must be within allowed directory roots - All files must be UTF-8 text files - If any file fails to read, entire operation returns error string - Returns dictionary for successful reads, string for errors
Inputs: paths (required). Returns: result
read_text_fileA
Read the contents of a UTF-8 text file, optionally within a line range.
Args: path (str): File path to read (absolute or relative to allowed directories) fromLine (int, optional): Starting line number (1-indexed, inclusive) toLine (int, optional): Ending line number (1-indexed, inclusive)
Returns: str: File contents as text, or error message if failed
Note: - Path must be within allowed directory roots - Only reads UTF-8 text files (binary files will return error) - If line range specified, returns only those lines - Line numbers are 1-indexed
Inputs: path (required), fromLine, toLine. Returns: result
search_filesA
Search for files by name pattern in a directory recursively.
Args: dir (str): Directory to search in (absolute or relative to allowed directories) pattern (str): Glob-style pattern to match file names (e.g., '.py', 'test_') exclude (str, optional): Glob-style pattern to exclude file names
Returns: List[str] | str: List of matching absolute file paths, or error message if failed
Note: - Directory must be within allowed directory roots - Searches recursively through subdirectories - Respects .gitignore files, and ignores hidden files and folders - Returns list for successful searches, string for errors
Inputs: dir (required), pattern (required), exclude. Returns: result
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 12 tools
Each tool has a clearly distinct purpose with no significant overlap. For example, create_directory vs. create_file, read_text_file vs. read_multiple_files, and search_files vs. grep all target different operations. The descriptions clearly differentiate their specific functions, making tool selection unambiguous.
All tool names follow a consistent verb_noun pattern with snake_case throughout, such as create_directory, list_directory, and read_text_file. This uniformity makes the tool set predictable and easy to navigate, with no deviations in naming conventions.
With 12 tools, the server provides a well-scoped set for filesystem operations, covering creation, deletion, reading, editing, searching, and listing. Each tool serves a specific and necessary function without redundancy, making the count appropriate for the domain.
The tool set offers comprehensive coverage for filesystem management, including CRUD operations (create, read, edit, delete), navigation (list, tree), and advanced features (search, grep, move). There are no obvious gaps; agents can perform all typical filesystem tasks without dead ends.
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…
Securely search and manage workspace context files for AI agents and teams.
Read and search folders on your own computer with explicit consent. Files are never uploaded.
Related MCP Servers
- 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
- FlicenseNot gradedqualityDmaintenanceProvides sandboxed access to local filesystem operations including directory and file management, content search with glob and regex patterns, and binary file support with configurable safety limits.-
- AlicenseNot gradedqualityCmaintenanceProvides safe filesystem access for AI clients with root confinement, read-only mode, and file operations like read, write, search, copy, move, delete.MIT