Filesystem MCP Server (modelcontextprotocol/servers) Verified Featured
Basic information
About Filesystem MCP Server
Learn how to use Python to read a file and manipulate local files safely through the Filesystem API.
Filesystem is a MCP server in the Other category listed in the AddMCP.net directory, published by anthropic. It exposes 14 tools, including read_file, read_text_file, read_media_file, read_multiple_files and more. Supported transport: stdio. Runtime: TypeScript. The repository has 88,148 GitHub stars. Source code is hosted on github.com. Related topics: access-control, file-operations, filesystem, official, other.
Setup
{
"mcpServers": {
"filesystem": {
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-filesystem",
"."
]
}
}
}
{
"mcpServers": {
"filesystem": {
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-filesystem",
"."
]
}
}
}
{
"servers": {
"filesystem": {
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-filesystem",
"."
]
}
}
}
Filesystem MCP Server (modelcontextprotocol/servers) config
Add this server to your MCP-compatible client using the configuration below.
{
"mcpServers": {
"filesystem": {
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-filesystem",
"."
]
}
}
}
Filesystem MCP Server (modelcontextprotocol/servers) tools
- read_file — Read the complete contents of a file as text. DEPRECATED: Use read_text_file instead.
- read_text_file — Read the complete contents of a file from the file system as text. Handles various text encodings and provides detailed error messages if the file cannot be read. Use this tool when you need to examine the contents of a single file. Use the 'head' parameter to read only the first N lines of a file, or the 'tail' parameter to read only the last N lines of a file. Operates on the file as text regardless of extension. Only works within allowed directories.
- read_media_file — Read an image or audio file. Returns the base64 encoded data and MIME type. Only works within allowed directories.
- read_multiple_files — Read the contents of multiple files simultaneously. This is more efficient than reading files one by one when you need to analyze or compare multiple files. Each file's content is returned with its path as a reference. Failed reads for individual files won't stop the entire operation. Only works within allowed directories.
- write_file — Create a new file or completely overwrite an existing file with new content. Use with caution as it will overwrite existing files without warning. Handles text content with proper encoding. Only works within allowed directories.
- edit_file — Make line-based edits to a text file. Each edit replaces exact line sequences with new content. Returns a git-style diff showing the changes made. Only works within allowed directories.
- create_directory — Create a new directory or ensure a directory exists. Can create multiple nested directories in one operation. If the directory already exists, this operation will succeed silently. Perfect for setting up directory structures for projects or ensuring required paths exist. Only works within allowed directories.
- list_directory — Get a detailed listing of all files and directories in a specified path. Results clearly distinguish between files and directories with [FILE] and [DIR] prefixes. This tool is essential for understanding directory structure and finding specific files within a directory. Only works within allowed directories.
- list_directory_with_sizes — Get a detailed listing of all files and directories in a specified path, including sizes. Results clearly distinguish between files and directories with [FILE] and [DIR] prefixes. This tool is useful for understanding directory structure and finding specific files within a directory. Only works within allowed directories.
- directory_tree — Get a recursive tree view of files and directories as a JSON structure. Each entry includes 'name', 'type' (file/directory), and 'children' for directories. Files have no children array, while directories always have a children array (which may be empty). The output is formatted with 2-space indentation for readability. Only works within allowed directories.
- move_file — Move or rename files and directories. Can move files between directories and rename them in a single operation. If the destination exists, the operation will fail. Works across different directories and can be used for simple renaming within the same directory. Both source and destination must be within allowed directories.
- search_files — Recursively search for files and directories matching a pattern. The patterns should be glob-style patterns that match paths relative to the working directory. Use pattern like '*.ext' to match files in current directory, and '**/*.ext' to match files in all subdirectories. Returns full paths to all matching items. Great for finding files when you don't know their exact location. Only searches within allowed directories.
- get_file_info — Retrieve detailed metadata about a file or directory. Returns comprehensive information including size, creation time, last modified time, permissions, and type. This tool is perfect for understanding file characteristics without reading the actual content. Only works within allowed directories.
- list_allowed_directories — Returns the list of directories that this server is allowed to access. Subdirectories within these allowed directories are also accessible. Use this to understand which directories and their nested paths are available before trying to access files.
Overview
What is Filesystem?
Filesystem MCP Server is the reference filesystem MCP server from the Model Context Protocol project: a Node.js server that lets Claude and other MCP clients read, write, edit, move and search files, but only inside directories you allow.
It is published on npm as @modelcontextprotocol/server-filesystem and as the Docker image mcp/filesystem, from the official modelcontextprotocol/servers repository (MIT License). It runs locally over stdio, needs no API key, and every tool is marked as never reaching the internet or other external systems.
How to use Filesystem?
Prerequisites: Node.js (for npx) or Docker. No account or API key is needed. The one required input is at least one allowed directory, given either as command-line arguments or by the client through MCP Roots.
Allowed directories as command-line arguments:
mcp-server-filesystem /path/to/dir1 /path/to/dir2
MCP Roots is the recommended method: clients that support Roots send their workspace folders to the server, which replaces the command-line list with them and picks up changes at runtime through roots/list_changed, with no restart.
Claude Desktop
Add this to claude_desktop_config.json, listing the folders you want to expose:
{
"mcpServers": {
"filesystem": {
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-filesystem",
"/Users/username/Desktop",
"/path/to/other/allowed/dir"
]
}
}
}
On Windows, launch npx through cmd /c:
{
"mcpServers": {
"filesystem": {
"command": "cmd",
"args": [
"/c",
"npx",
"-y",
"@modelcontextprotocol/server-filesystem",
"/Users/username/Desktop",
"/path/to/other/allowed/dir"
]
}
}
}
With Docker, mount each directory under /projects. Adding ro makes a mount read-only for the server:
{
"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",
"mcp/filesystem",
"/projects"
]
}
}
}
VS Code
Run MCP: Open User Configuration from the Command Palette, or create .vscode/mcp.json in your workspace to share the setup. Note that VS Code uses a servers key:
{
"servers": {
"filesystem": {
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-filesystem",
"${workspaceFolder}"
]
}
}
}
The Docker variant mounts ${workspaceFolder} to /projects/workspace and passes /projects as the argument.
Claude Code and Cursor
The README does not include steps for these clients, but both run the same stdio command. In Claude Code:
claude mcp add filesystem -- npx -y @modelcontextprotocol/server-filesystem /path/to/allowed/dir
In Cursor, add the same mcpServers block shown for Claude Desktop to Cursor's mcp.json.
Key features of Filesystem
- Sandboxed access: every operation is restricted to the allowed directories, and
list_allowed_directoriesshows which ones are in force. - Dynamic access control through MCP Roots, so the allowed folders follow the client's workspace without a restart.
- Text and media reading:
read_text_filesupportshead/tailline limits, andread_media_filereturns images and audio as base64 content blocks with their MIME type. - Safe editing:
edit_filemakes targeted find-and-replace edits, keeps indentation and LF/CRLF line endings, returns a git-style diff, and supports adryRunpreview. - Glob-style search and a recursive JSON
directory_tree, both with exclude patterns. - MCP tool annotations that mark each tool as read-only, idempotent or destructive, so clients can ask for confirmation before risky writes.
- Docker read-only mounts (
ro) for folders the model may read but must not change.
Filesystem tools
The server exposes 13 tools in three groups:
- Reading:
read_text_file,read_media_fileandread_multiple_files(a failed read does not stop the rest of the batch). - Browsing and search:
list_directory,list_directory_with_sizes(sortable by name or size, with totals),directory_tree,search_files,get_file_info(size, times, type, permissions) andlist_allowed_directories. - Writing:
write_filecreates or overwrites a file,edit_fileapplies selective edits,create_directorycreates nested folders, andmove_filemoves or renames, failing if the destination already exists.
There is no delete tool. The README marks write_file, edit_file and move_file as destructive.
Use cases of Filesystem
- Editing code or docs in a project folder: "In ~/projects/site, rename every
getUsercall in src tofetchUserand show me the diff first." - Reviewing a folder: "List the largest files in ~/Downloads and tell me what they are."
- Organizing files: "Create a folder per year in ~/Documents/invoices and move each PDF into the right one."
- Reading images for analysis: "Open the screenshot in ~/Desktop/bug.png and describe the error."
- Finding files: "Search ~/notes for Markdown files about Kubernetes, excluding the archive folder."
- Building an MCP file system sandbox: giving a chat app the read-only context it needs to answer questions about local files.
Frequently asked questions
1 Is Filesystem MCP Server official?
Yes. It is a reference server in the modelcontextprotocol/servers repository, published on npm as @modelcontextprotocol/server-filesystem.
2 Is the filesystem MCP server free?
Yes. It is open source under the MIT License, runs locally and needs no API key or paid service.
3 How do I limit which folders the AI can access?
Pass the allowed directories as arguments, or let a Roots-capable client supply them. All operations are restricted to those paths. With Docker, mount only what you need and add ro for read-only access.
4 Can Filesystem MCP Server delete files?
No delete tool is exposed. However, write_file overwrites files, edit_file modifies them and move_file removes the source, so treat write access with care.
5 Can I preview edits before they are applied?
Yes. Set dryRun to true on edit_file to get a diff without changing the file. The README recommends doing this first.
6 Does it work with Claude Code, Cursor and VS Code?
Yes. It is a standard stdio MCP server. The README documents Claude Desktop and VS Code; Claude Code and Cursor can run the same npx command.
7 Is it local or remote?
Local. It runs on your machine over stdio and only touches the local file system within its allowed directories.
8 Can it read images and PDFs?
read_media_file returns images and audio as image or audio content, and any other file type as an embedded base64 resource.
Videos
Tutorials, guides, and showcases related to Filesystem MCP Server (modelcontextprotocol/servers). The player loads when you press play.
Videos belong to their creators. Relevance is approximate; check the channel and description before following setup steps.
Comments
No comments yet
Be the first to share feedback about this listing. Sign in to leave a comment.
Sign In