
Filesystem
@modelcontextprotocol
Model Context Protocol Servers
概要
What is Filesystem?
Filesystem is a Node.js server that implements the Model Context Protocol (MCP) for filesystem operations. It enables AI assistants to read, write, and manage files and directories on the local machine within configurable sandboxed directories. Published as @modelcontextprotocol/server-filesystem, it is intended for developers who want to give MCP clients controlled filesystem access.
How to use Filesystem?
Install via npm or run using npx or Docker. Specify allowed directories as command-line arguments when starting the server. Alternatively, use MCP Roots for dynamic directory updates without restarting the server. Example for Claude Desktop or VS Code uses JSON configuration with npx -y @modelcontextprotocol/server-filesystem followed by allowed directory paths.
Key features of Filesystem
- Read and write text and media files
- Create, list, and delete directories
- Move or rename files and directories
- Search files recursively using glob patterns
- Get detailed file metadata and directory trees
- Dynamic directory access control via MCP Roots
Use cases of Filesystem
- Editing source code files in a project directory
- Organizing files by creating and moving directories
- Reading image or audio files for AI processing
- Searching for files matching specific patterns
- Previewing file edits with dry-run mode before applying changes
FAQ from Filesystem
How does directory access control work?
Directories can be specified at startup via command-line arguments or dynamically via MCP Roots. Roots completely replace any server-side allowed directories when provided. If neither is available, the server throws an error.
What happens if no directories are specified?
If the server starts without command-line arguments and the client does not support the roots protocol (or provides empty roots), the server will throw an error during initialization. At least one allowed directory is required to operate.
Can I preview edits before applying them?
Yes, the edit_file tool supports a dryRun parameter. When set to true, it returns a diff of changes without modifying the file. The README recommends always using dryRun first.
What runtime and dependencies are required?
The server is a Node.js application published on npm. It requires Node.js to run and has no external runtime dependencies beyond standard npm packages.
Where do files and data actually live?
All operations are restricted to the allowed directories specified by the user. The server never accesses the internet or external systems; it only works on the local filesystem within those sandboxed paths.