microsoft

filesystem MCP Server

Community microsoft
Updated

Cross platform file system server

filesystem MCP Server

Cross platform file system server

This is a Model Context Protocol (MCP) server project.

Setup and Installation

Simply run:

make

To create the virtual environment and install dependencies.

Running the Server

Use the VSCode launch configuration, or run manually:

The server requires specifying at least one allowed directory (for security reasons).

For stdio transport, specify directories using the --allowed_directories argument:

uv run -m mcp_server_filesystem.start --allowed_directories /path1 /path2 /path3

For SSE transport, you can start the server without specifying directories:

uv run -m mcp_server_filesystem.start --transport sse --port 6060

Setting Allowed Directories

The server uses "allowed directories" for security purposes. There are two ways to configure them:

  1. Command line arguments: Using --allowed_directories parameter (required for stdio transport)
  2. Root configuration: For SSE transport, the server can use the roots defined by the client

When using the root configuration approach, the MCP client sets the accessible directories through the session's list_roots() mechanism so each allowed directory must be set in the client's root configuration.

Tools Available

read_file

Reads the contents of a specific file.

write_file

Writes content to a specified file path. Creates the file if it does not exist.

list_directory

Lists all files and subdirectories within a specified directory.

create_directory

Creates a new directory or ensures an existing one remains accessible.

edit_file

Edits the contents of a text file with specified replacements. Supports a dry run mode to preview changes without applying them.

search_files

Recursively searches for files matching a pattern across subdirectories.

get_file_info

Retrieves and displays detailed metadata about a specified file or directory.

read_multiple_files

Reads the content of multiple files simultaneously and returns their contents in a dictionary. Files not accessible are marked with error messages.

move_file

Moves or renames a file or directory from a source path to a target destination.

list_allowed_directories

Returns a list of directories that the server is permitted to access.

Client Configuration

To use this MCP server in your setup, consider the following configuration:

Stdio

{
  "mcpServers": {
    "mcp-server-filesystem": {
      "command": "uv",
      "args": ["run", "-m", "mcp_server_filesystem.start", "--allowed_directories", "/path1", "/path2"]
    }
  }
}

SSE

{
  "mcpServers": {
    "mcp-server-filesystem": {
      "command": "http://127.0.0.1:6060/sse",
      "args": ["/path1", "/path2"]
    }
  }
}

The args will be automatically joined with commas and added as a query parameter named 'args'.

Direct URL Configuration

If you prefer, you can also configure the URL directly with the args parameter already included:

{
  "mcpServers": {
    "mcp-server-filesystem": {
      "command": "http://127.0.0.1:6060/sse?args=/path1,/path2,/path3",
      "args": []
    }
  }
}

This approach is more verbose but might be preferable in some configurations.

MCP Server · Populars

MCP Server · New

    WordPress

    MCP Adapter

    An MCP adapter that bridges the Abilities API to the Model Context Protocol, enabling MCP clients to discover and invoke WordPress plugin, theme, and core abilities programmatically.

    Community WordPress
    HzaCode

    OneCite

    📚 An intelligent toolkit to automatically parse, complete, and format academic references, with Model Context Protocol (MCP) support.

    Community HzaCode
    cexll

    Codex MCP Tool

    Codex Mcp Server

    Community cexll
    wise-vision

    WiseVision ROS 2 MCP Server

    Advanced MCP Server ROS 2 bridging AI agents straight into robotics

    Community wise-vision
    aahl

    📈 AkTools MCP Server

    📈 提供股票、加密货币的数据查询和分析功能MCP服务器

    Community aahl