by mark3labs
MCP Filesystem Server is a Go-based server that implements the Model Context Protocol (MCP) to provide secure and controlled access to the local filesystem, allowing applications to perform various file and directory operations through a standardized protocol.
MCP Filesystem Server is a Go-based server that implements the Model Context Protocol (MCP) to provide secure and controlled access to the local filesystem. It allows applications to perform various file and directory operations through a standardized protocol.
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"
]
}
}
}
read_file, read_multiple_files, write_file, copy_file, move_file, delete_file, and modify_file.list_directory, create_directory, and tree (hierarchical JSON representation).search_files, search_within_files, get_file_info, and list_allowed_directories.Q: What is the Model Context Protocol (MCP)? A: MCP is a protocol designed for secure and standardized communication between different services and applications, especially for accessing resources like the filesystem.
Q: How does MCP Filesystem Server ensure security? A: It employs secure access to specified directories, path validation to prevent directory traversal attacks, and symlink resolution with security checks.
Q: Can I use MCP Filesystem Server with Docker? A: Yes, you can run it as a Docker container and even mount volumes to allow the container to access and modify files on the host system.
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.
Discover more MCP servers with similar functionality and use cases
by zed-industries
Provides real-time collaborative editing powered by Rust, enabling developers to edit code instantly across machines with a responsive, GPU-accelerated UI.
by cline
Provides autonomous coding assistance directly in the IDE, enabling file creation, editing, terminal command execution, browser interactions, and tool extension with user approval at each step.
by continuedev
Provides continuous AI assistance across IDEs, terminals, and CI pipelines, offering agents, chat, inline editing, and autocomplete to accelerate software development.
by github
Enables AI agents, assistants, and chatbots to interact with GitHub via natural‑language commands, providing read‑write access to repositories, issues, pull requests, workflows, security data and team activity.
by block
Automates engineering tasks by installing, executing, editing, and testing code using any large language model, providing end‑to‑end project building, debugging, workflow orchestration, and external API interaction.
by RooCodeInc
An autonomous coding agent that lives inside VS Code, capable of generating, refactoring, debugging code, managing files, running terminal commands, controlling a browser, and adapting its behavior through custom modes and instructions.
by lastmile-ai
A lightweight, composable framework for building AI agents using Model Context Protocol and simple workflow patterns.
by firebase
Provides a command‑line interface to manage, test, and deploy Firebase projects, covering hosting, databases, authentication, cloud functions, extensions, and CI/CD workflows.
by gptme
Empowers large language models to act as personal AI assistants directly inside the terminal, providing capabilities such as code execution, file manipulation, web browsing, vision, and interactive tool usage.