home / mcp / filesystem mcp server

Filesystem MCP Server

Go server implementing Model Context Protocol (MCP) for filesystem operations.

Installation
Add the following to your MCP client configuration file.

Configuration

View docs
{
  "mcpServers": {
    "mark3labs-mcp-filesystem-server": {
      "command": "mcp-filesystem-server",
      "args": [
        "/path/to/allowed/directory",
        "/another/allowed/directory"
      ]
    }
  }
}

The MCP Filesystem Server provides secure access to your local filesystem through the Model Context Protocol, letting you read, write, move, copy, delete, and query files and directories with built‑in safety checks. It exposes a rich set of tools for common filesystem operations while guarding against traversal attacks and handling different MIME types.

How to use

You access the Filesystem MCP server from an MCP client by starting the server locally or by running it inside a container, then connecting your client to the provided MCP endpoint. The server offers a comprehensive suite of file and directory operations that you can call from your MCP-enabled app. Use the server to read file contents, list directories, search for files, modify text, and perform safe file transfers while benefiting from path validation and symlink safety checks.

How to install

Prerequisites: ensure you have Go installed if you want to build from sources, or use the prebuilt MCP server binary via the provided execution commands.

Step 1: Install the server as a standalone executable.

Go install approach (if you are building from source or using the Go toolchain):

go install github.com/mark3labs/mcp-filesystem-server@latest

Additional configuration and starting tips

Run the server with one or more allowed directories. The server enforces path validation and resolves symlinks securely.

Starting as a standalone server with one or more allowed paths:

mcp-filesystem-server /path/to/allowed/directory [/another/allowed/directory ...]

Docker usage

You can run the MCP Filesystem Server inside Docker for isolation and portability.

Docker run example:

docker run -i --rm ghcr.io/mark3labs/mcp-filesystem-server:latest /path/to/allowed/directory

Configure MCP client connections

If you integrate with a client using MCP, you can configure a connection that launches the server and points to the allowed directories. The following example shows how you might define a connection in MCP client configuration to start the server with the required paths.

{
  "mcpServers": {
    "filesystem": {
      "command": "mcp-filesystem-server",
      "args": ["/path/to/allowed/directory", "/another/allowed/directory"]
    }
  }
}

Available tools

read_file

Read the complete contents of a file from the file system with a required path parameter.

read_multiple_files

Read contents of multiple files in a single operation by providing a list of file paths.

write_file

Create a new file or overwrite an existing file with new content, given a path and content.

copy_file

Copy files and directories from a source path to a destination path.

move_file

Move or rename files and directories from a source path to a destination path.

delete_file

Delete a file or directory, with an optional recursive flag for directories.

modify_file

Update a file by finding and replacing text, with optional regex and replacement scope.

list_directory

Get a detailed listing of all files and directories within a specified directory.

create_directory

Create a new directory or ensure it exists at the given path.

tree

Return a hierarchical JSON representation of a directory structure, with options for depth and following symlinks.

search_files

Recursively search for files and directories that match a given pattern starting from a path.

search_within_files

Search for text within file contents across directory trees with optional depth and result limits.

get_file_info

Retrieve detailed metadata about a specific file or directory.

list_allowed_directories

Return the list of directories this server is configured to access.