Agentic Filesystem MCP
Agentic Filesystem MCP Server
Agentic Filesystem MCP Server is a secure, highly capable Model Context Protocol (MCP) server written in Rust. It exposes a comprehensive suite of filesystem operations as tools for AI agents.
Built with security and AI-context limits in mind, it utilizes capability-based security to strictly sandbox operations to allowed directories and includes built-in pagination, line-numbering, and search features to optimize LLM token usage.
🔑 Key Features
Secure by Default: Uses cap-std to sandbox all filesystem access. Agents cannot traverse outside the explicitly provided root directories, preventing path traversal vulnerabilities.
LLM-Optimized: Features like pagination (
limit/offset), exact string replacement (edit), and line numbering prevent context window overflow when working with large files or directories.Smart Searching: Both
grepandglobtools natively respect.gitignorefiles and hidden directories.Media Support: Seamlessly handles both text and media files.
Related MCP server: Filesystem MCP Server
🎬 Demo
https://github.com/user-attachments/assets/d573ffe7-0038-439a-89a0-4742408da15f
📦 Installation
Download the latest release from Releases.
🛠️ Usage
Start the server by providing the root directory or mount points you want the agent to have access to.
agentic-filesystem-mcp [OPTIONS]Options:
--root <ROOT_PATH>: A single root path the server will serve and sandbox. Mutually exclusive with--mount.--mount <MOUNT_POINT> <ROOT_PATH>: One or more mount points, each mapping a virtual path to a root directory. Can be specified multiple times. Mutually exclusive with--root.
Path Resolution Examples
Using --root
The --root option sets a single directory as the root of the server. The agent accesses files directly via their relative paths within this directory. You can also use relative paths, such as ., to serve your current working directory.
Example: Serving the current directory
agentic-filesystem-mcp --root .If your current directory contains main.py and src/index.ts, the agent accesses them as:
main.pysrc/index.ts
Example: Serving an absolute path
agentic-filesystem-mcp --root /var/www/my-appIf /var/www/my-app contains app.js and components/Button.tsx, they are accessible as:
app.jscomponents/Button.tsx
Using --mount
The --mount option maps physical directories to virtual mount points, allowing you to securely expose multiple distinct directories to the agent at once.
Example: Multiple distinct mounts
agentic-filesystem-mcp --mount frontend /var/www/react-app --mount backend /opt/api-serverIf /var/www/react-app contains package.json and /opt/api-server contains main.py, the agent accesses them as:
frontend/package.jsonbackend/main.py
Example: Nested mount points
You can specify highly nested virtual paths as mount points and safely overlap them to build complex, unified virtual file trees.
agentic-filesystem-mcp \
--mount workspaces/frontend /home/user/projects/web \
--mount workspaces/backend/main-api /home/user/projects/server \
--mount workspaces/backend/worker /home/user/projects/cronIn this example, the agent sees a single virtual workspaces directory and accesses the files like this:
workspaces/frontend/index.htmlworkspaces/backend/main-api/app.pyworkspaces/backend/worker/tasks.py
Tools
read
Reads the contents of a file. Supports text files and media files
Inputs:
path(string): File locationtype(string): The type of content to read.textfor text files,mediafor media fileslimit(number, optional, default: 100): Maximum number of lines to read, for text filesoffset(number, optional, default: 0): Number of lines to skip before reading, for text filesshow_line_numbers(boolean, optional, default: true): Whether to prepend 1-indexed line numbers, for text files
write
Creates new file or overwrites existing
Inputs:
path(string): File locationcontent(string): The complete content to write to the file
Auto-creates parent directories — any missing intermediate directories in the path are created
edit
Make selective edits using exact string replacement
Inputs:
path(string): File locationold_string(string): Text to search for (must match exactly including whitespace)new_string(string): Text to replace withreplace_all(boolean, optional, default: false): Whether to replace all occurrences
If
replace_allisfalse/omitted andold_stringmatches more than once, the tool fails without making any changes
grep
Search file contents using regular expressions
Inputs:
pattern(string): The regex pattern to search forpath(string, optional, default: "."): Directory or file to search inglob(string, optional): Glob pattern to filter files (e.g.,*.{ts,tsx})output_mode(string, optional, default:content): One ofcontent,files_with_matches,countbefore_context(number, optional, default: 0): Lines before each match (requires output_mode=content)after_context(number, optional, default: 0): Lines after each match (requires output_mode=content)limit(number, optional, default: 100): Maximum number of lines to returnoffset(number, optional, default: 0): Number of lines to skipmultiline(boolean, optional, default: false): Enable multiline modeshow_line_numbers(boolean, optional, default: true): Show line numbers (requires output_mode=content)
Results are ordered by file modification time
Natively respects
.gitignorerules and hidden files/directoriesBinary files are skipped
glob
Search for files or directories matching a glob pattern
Inputs:
pattern(string): Glob pattern to match (e.g.,*.{ts,tsx})path(string, optional, default: "."): Directory to search inlimit(number, optional, default: 100): Maximum number of resultsoffset(number, optional, default: 0): Number of results to skip
Results are sorted by modification time
Natively respects
.gitignorerules and hidden files/directories
mkdir
Create new directory or ensure it exists
Inputs:
path(string): Directory locationparents(boolean, optional, default: false): Create parent directories as needed (equivalent tomkdir -p). Iftrue, no error is returned if the directory already exists
move
Move or rename files and directories
Inputs:
src_path(string): Source pathdst_path(string): Destination path (must include the target file/directory name, not just the destination folder)
Overwrites an existing destination of the same name if it exists
copy
Copy a file or directory to a new location
Inputs:
src_path(string): Source pathdst_path(string): Destination path (must include the target file/directory name, not just the destination folder)recursive(boolean, optional, default: false): MUST be set totruewhen copying a directory, otherwise the operation will fail
Fails if the destination path already exists
File copies preserve the source file's permissions
Recursive copies preserve the directory tree, file and directory permissions, and symlinks
remove
Remove a file or directory
Inputs:
path(string): Path to the file or directory to removerecursive(boolean, optional, default: false): MUST be set totrueto remove a non-empty directory
stat
Get information about a file or directory
Inputs:
path(string): The path of the file or directory to get information about
Includes file type, size, creation time, modification time, access time, and permissions
Reports symlinks without following them
Usage with Claude Desktop
Add this to your claude_desktop_config.json:
{
"mcpServers": {
"filesystem": {
"command": "/path/to/agentic-filesystem-mcp",
"args": [
"--root",
"/path/to/my/favorite/directory"
]
}
}
}Usage with VS Code
Add this to your mcp.json:
{
"servers": {
"filesystem": {
"command": "/path/to/agentic-filesystem-mcp",
"args": [
"--root",
"/path/to/my/favorite/directory"
]
}
}
}🔐 Security Architecture
This server relies heavily on cap_std::fs::Dir. Root directories are opened as "ambient directories" and all subsequent tool executions are mapped to these capability objects.
If an agent attempts to access /etc/passwd or ../../../../ssh/id_rsa while the server was restricted to ./my_project, the operation will fail at the sandbox level. Symlinks are safely evaluated and resolved relative by the sandbox.
📜 License
This project is released under the MIT License.
Available Tools
10 toolscopyB
Copies a file or directory to a new location.
IMPORTANT: This operation fails if the destination path already exists.
Inputs: dst_path (required), src_path (required), recursive.
editA
Performs exact string replacement in a file. Useful for making partial changes to an existing file.
Inputs: path (required), new_string (required), old_string (required), replace_all.
globA
Searches for files or directories matching a glob pattern and returns them sorted by modification time.
Inputs: pattern (required), path, limit, offset.
grepB
Searches file contents using regular expressions.
Inputs: pattern (required), glob, path, limit, +6 more.
mkdirA
Creates a new directory.
IMPORTANT: The write tool automatically creates missing parent directories. You DO NOT need to call mkdir prior to writing a new file with the write tool.
Inputs: path (required), parents.
moveB
Moves or renames a file or directory.
IMPORTANT: If the destination path already exists, it will be overwritten. Always verify the destination path before calling.
Inputs: dst_path (required), src_path (required).
readB
Reads the contents of a file. Supports text files and media files.
Inputs: path (required), type (required), limit, offset, +1 more.
removeA
Removes a file or directory.
IMPORTANT: This action is permanent. Always verify the path before calling.
Inputs: path (required), recursive.
statA
Gets information about a file or directory, including its file type, size, creation time, modification time, access time, and permissions.
Inputs: path (required).
writeA
Writes a file, automatically creating any missing parent directories. Completely overwrites the file if one already exists.
IMPORTANT: Because it overwrites entirely, ensure you have the complete file context before modifying existing files. For partial changes to existing files, prefer using the edit tool.
Inputs: path (required), content (required).
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 10 tools
Each tool performs a uniquely identifiable filesystem operation with no overlap: remove, copy, edit, glob, grep, mkdir, move, read, stat, and write are clearly distinct. Even edit and write are differentiated by partial vs full overwrite, and move vs copy are precise.
All tool names are single lowercase imperative verbs (remove, copy, edit, etc.), forming a consistent pattern. Abbreviations like mkdir and stat are conventional and do not break the overall coherence.
Ten tools is well within the ideal 3–15 range and each tool serves a fundamental filesystem need. The scope is appropriate for a dedicated filesystem MCP server without bloat or redundancy.
The set covers the core lifecycle: read, write, edit, delete, copy, move, create directory, and stat. A dedicated directory listing tool is missing, but glob can substitute. Minor gap but manageable overall.
Maintenance
Related MCP Connectors
Nifty's MCP server — exposes tasks, projects, messages, and files as tools for AI agents.
Remote MCP server exposing your Node Command fleet (files, shell, processes, browser) to AI hosts.
Cloud-hosted MCP server for durable AI memory
Agent-native MCP server over the public saagarpatel.dev corpus. Read-only, stateless.
Related MCP Servers
- FlicenseAqualityBmaintenanceNode.js server implementing Model Context Protocol (MCP) for filesystem operations.70141,222,611 npm92,139-
- AlicenseNot gradedqualityDmaintenanceGo server implementing Model Context Protocol (MCP) for filesystem operations.699MIT
- AlicenseNot gradedqualityDmaintenanceA secure, production-grade MCP server that provides filesystem operations, AST math evaluation, and system diagnostics for LLM agents.MIT
- AlicenseNot gradedqualityCmaintenanceAn MCP server that gives AI agents file system access: read, write, search, hash, directory trees — 12 tools, zero dependencies, pure Python stdlib.MIT