mcp-server-wsl-filesystem
The Filesystem MCP Server for WSL is a Node.js server tailored for managing filesystem operations within the Windows Subsystem for Linux. It enhances the original Filesystem MCP Server by optimizing for performance using native Linux commands, offering seamless integration between Windows and WSL environments with advanced file handling and distribution support.
Filesystem MCP Server for WSL
Node.js server implementing the Model Context Protocol (MCP), specifically designed for filesystem operations in Windows Subsystem for Linux (WSL).
This project is a fork of the original Filesystem MCP Server but completely reimagined for WSL environments.
Unlike the original project, which handles generic file operations, this version focuses exclusively on seamless interaction between Windows and Linux distributions under WSL.
Features
- Access any WSL distribution from Windows
- Read/write files in WSL from Windows host
- Create/list/delete directories in WSL
- Move files/directories across WSL filesystem
- Search files within WSL
- Get file metadata from the WSL filesystem
- Support for multiple WSL distributions
API
Resources
wsl -d <distrib>
: Command for operations on WSL distributions
Tools
-
read_file
- Read complete contents of a file from WSL
- Input:
path
(string)
-
read_multiple_files
- Read multiple files simultaneously from WSL
- Input:
paths
(string[])
-
write_file
- Create or overwrite a file in WSL (use with caution)
- Inputs:
path
(string)content
(string)
-
edit_file
- Selective edits with advanced pattern matching and formatting
- Inputs:
path
(string)edits
(array of{ oldText, newText }
)
-
create_directory
- Create or ensure the existence of a directory in WSL
- Input:
path
(string)
-
list_directory
- List directory contents with
[FILE]
or[DIR]
prefixes - Input:
path
(string)
- List directory contents with
-
directory_tree
- Recursive JSON tree view of contents
- Input:
path
(string)
-
move_file
- Move or rename files/directories
- Inputs:
source
(string)destination
(string)
-
search_files
- Recursively search by name
- Inputs:
path
(string)pattern
(string)
-
get_file_info
- Detailed metadata
- Input:
path
(string)
Requirements
- Windows Subsystem for Linux (WSL) properly configured
- At least one Linux distribution installed in WSL
Usage
Before running the server, you need to build the TypeScript project:
Run the server by specifying which WSL distribution to use (optional) and which directories to expose:
Differences from original project
This fork adapts the original Filesystem MCP Server to work with WSL by:
- Replacing direct Node.js filesystem calls with WSL command executions
- Adding support for selecting specific WSL distributions
- Implementing path translation between Windows and Linux formats
- Enhancing file content handling for cross-platform compatibility
- Adding specialized tools for WSL management
License
This MCP server for WSL is licensed under the MIT License.