by mark3labs
Provides secure, programmatic access to the local filesystem via the Model Context Protocol, enabling read, write, copy, move, delete, and search operations with built‑in path validation and MIME type detection.
Enables applications to interact with the host's filesystem through a standardized protocol, exposing a rich set of file and directory actions while enforcing security checks such as traversal protection and symlink validation.
go install github.com/mark3labs/mcp-filesystem-server@latest
mcp-filesystem-server /allowed/dir [/additional/allowed/dir ...]
github.com/mark3labs/mcp-filesystem-server/filesystemserver
, create a server with filesystemserver.NewFilesystemServer(allowedDirs)
and call Serve()
.docker run -i --rm ghcr.io/mark3labs/mcp-filesystem-server:latest /allowed/dir
Q: How are directories restricted? A: The server is started with a list of allowed root directories; any operation outside these roots is rejected.
Q: Can I handle large binary files? A: Yes, binary files are supported; large files are streamed or base64‑encoded according to configurable size limits.
Q: Does the server follow symbolic links?
A: Symlinks are resolved, but the final target must still reside within an allowed directory unless follow_symlinks
is explicitly enabled for the tree
tool.
Q: How do I deploy with Docker and still access host files?
A: Mount host paths into the container using the --volume
flag and pass the container‑side path as the allowed directory.
Q: Is authentication built‑in? A: Authentication is outside the core server; secure deployment (e.g., TLS termination, firewall rules) should be used to restrict access.
This MCP server provides secure access to the local filesystem via the Model Context Protocol (MCP).
read_file
path
(required): Path to the file to readread_multiple_files
paths
(required): List of file paths to readwrite_file
path
(required): Path where to write the file, content
(required): Content to write to the filecopy_file
source
(required): Source path of the file or directory, destination
(required): Destination pathmove_file
source
(required): Source path of the file or directory, destination
(required): Destination pathdelete_file
path
(required): Path to the file or directory to delete, recursive
(optional): Whether to recursively delete directories (default: false)modify_file
path
(required): Path to the file to modify, find
(required): Text to search for, replace
(required): Text to replace with, all_occurrences
(optional): Replace all occurrences (default: true), regex
(optional): Treat find pattern as regex (default: false)list_directory
path
(required): Path of the directory to listcreate_directory
path
(required): Path of the directory to createtree
path
(required): Path of the directory to traverse, depth
(optional): Maximum depth to traverse (default: 3), follow_symlinks
(optional): Whether to follow symbolic links (default: false)search_files
path
(required): Starting path for the search, pattern
(required): Search pattern to match against file namessearch_within_files
path
(required): Starting directory for the search, substring
(required): Text to search for within file contents, depth
(optional): Maximum directory depth to search, max_results
(optional): Maximum number of results to return (default: 1000)get_file_info
path
(required): Path to the file or directorylist_allowed_directories
go install github.com/mark3labs/mcp-filesystem-server@latest
Start the MCP server with allowed directories:
mcp-filesystem-server /path/to/allowed/directory [/another/allowed/directory ...]
package main
import (
"log"
"os"
"github.com/mark3labs/mcp-filesystem-server/filesystemserver"
)
func main() {
// Create a new filesystem server with allowed directories
allowedDirs := []string{"/path/to/allowed/directory", "/another/allowed/directory"}
fs, err := filesystemserver.NewFilesystemServer(allowedDirs)
if err != nil {
log.Fatalf("Failed to create server: %v", err)
}
// Serve requests
if err := fs.Serve(); err != nil {
log.Fatalf("Server error: %v", err)
}
}
To integrate this server with apps that support MCP:
{
"mcpServers": {
"filesystem": {
"command": "mcp-filesystem-server",
"args": ["/path/to/allowed/directory", "/another/allowed/directory"]
}
}
}
You can run the Filesystem MCP server using Docker:
docker run -i --rm ghcr.io/mark3labs/mcp-filesystem-server:latest /path/to/allowed/directory
To integrate the Docker image with apps that support MCP:
{
"mcpServers": {
"filesystem": {
"command": "docker",
"args": [
"run",
"-i",
"--rm",
"ghcr.io/mark3labs/mcp-filesystem-server:latest",
"/path/to/allowed/directory"
]
}
}
}
If you need changes made inside the container to reflect on the host filesystem, you can mount a volume. This allows the container to access and modify files on the host system. Here's an example:
{
"mcpServers": {
"filesystem": {
"command": "docker",
"args": [
"run",
"-i",
"--rm",
"--volume=/allowed/directory/in/host:/allowed/directory/in/container",
"ghcr.io/mark3labs/mcp-filesystem-server:latest",
"/allowed/directory/in/container"
]
}
}
}
See the LICENSE file for details.
Please log in to share your review and rating for this MCP.
Explore related MCPs that share similar capabilities and solve comparable challenges
by zed-industries
A high‑performance, multiplayer code editor designed for speed and collaboration.
by modelcontextprotocol
Model Context Protocol Servers
by modelcontextprotocol
A Model Context Protocol server for Git repository interaction and automation.
by modelcontextprotocol
A Model Context Protocol server that provides time and timezone conversion capabilities.
by cline
An autonomous coding assistant that can create and edit files, execute terminal commands, and interact with a browser directly from your IDE, operating step‑by‑step with explicit user permission.
by continuedev
Enables faster shipping of code by integrating continuous AI agents across IDEs, terminals, and CI pipelines, offering chat, edit, autocomplete, and customizable agent workflows.
by upstash
Provides up-to-date, version‑specific library documentation and code examples directly inside LLM prompts, eliminating outdated information and hallucinated APIs.
by github
Connects AI tools directly to GitHub, enabling natural‑language interactions for repository browsing, issue and pull‑request management, CI/CD monitoring, code‑security analysis, and team collaboration.
by daytonaio
Provides a secure, elastic infrastructure that creates isolated sandboxes for running AI‑generated code with sub‑90 ms startup, unlimited persistence, and OCI/Docker compatibility.