What is Filesystem MCP Server?
The Filesystem MCP Server is a Node.js implementation of the Model Context Protocol (MCP) designed for filesystem operations. It provides a secure and efficient way to interact with files and directories, allowing you to read, write, create, delete, and manage files and directories within specified directories. The server restricts operations to directories explicitly provided via arguments, ensuring controlled access and preventing unauthorized filesystem manipulation.
Key Features
- Secure Access Control: Operations are restricted to directories specified via
args
, ensuring controlled access. - Comprehensive File Management: Supports reading, writing, editing, moving, and deleting files and directories.
- Advanced Editing Capabilities: Features pattern matching, whitespace normalization, and Git-style diffs for precise file edits.
- Metadata Retrieval: Get detailed file and directory metadata including size, timestamps, and permissions.
- Search Functionality: Recursively search for files and directories with glob pattern support.
- Cross-Platform Compatibility: Works seamlessly on Windows, Linux, and macOS.
- Integration with Claude Desktop: Easily configure and use the server with Claude Desktop for streamlined workflows.
How to Use Filesystem MCP Server
Installation and Configuration
-
Using Docker:
- Mount directories to
/projects
and specify read-only flags if needed:{ "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", "mcp/filesystem", "/projects" ] } } }
- Mount directories to
-
Using NPX:
- Directly run the server with specified directories:
{ "mcpServers": { "filesystem": { "command": "npx", "args": [ "-y", "@modelcontextprotocol/server-filesystem", "/Users/username/Desktop", "/path/to/other/allowed/dir" ] } } }
- Directly run the server with specified directories:
-
Building from Source:
- Build the Docker image:
docker build -t mcp/filesystem -f src/filesystem/Dockerfile .
- Build the Docker image:
API Tools and Usage
- read_file: Read complete file contents with UTF-8 encoding.
{ "tool": "read_file", "input": { "path": "/projects/file.txt" } }