home / mcp / wsl filesystem mcp server
filesystem MCP server for accessing WSL distributions from Windows
Configuration
View docs{
"mcpServers": {
"webconsulting-mcp-server-wsl-filesystem": {
"command": "npx",
"args": [
"-y",
"mcp-server-wsl-filesystem",
"--distro=Ubuntu-20.04",
"/home/user/documents"
]
}
}
}You can run the Filesystem MCP Server for WSL to securely access and manage files from Windows over the Windows Subsystem for Linux (WSL). It enables reading, writing, listing, and searching within WSL directories from your Windows environment, with support for multiple distributions and fast, native-like operations inside WSL.
Use this MCP server with your MCP client to access and manage files inside WSL distributions. You can point the server at one or more allowed directories and, if needed, specify a particular WSL distribution. The server handles operations such as reading file contents, listing directories, creating and moving files, and performing searches inside WSL.
Prerequisites you need before installing:
- Windows with WSL configured and at least one Linux distribution installed
- Node.js v18.x or higher installed on Windows
- npm (comes with Node.js) or npx available for package execution
- Git (optional, for cloning a repository if you prefer)Install the package locally and build the TypeScript sources, then run the server from the built artifacts.
# Install dependencies and build
npm install
npm run build
# Run the server for a specific distribution (example)
node dist/index.js --distro=Ubuntu-20.04 /home/user/documentsConfigure how you run the server from your MCP client. You can expose a single allowed directory or multiple directories, and you may choose to target a specific WSL distribution or use the default one.
If you prefer using a modern MCP client configuration, you can run the server via a package runner, such as npx, and point it at the built distribution with the appropriate arguments.
{
"mcpServers": {
"wsl-filesystem": {
"command": "npx",
"args": [
"-y",
"mcp-server-wsl-filesystem",
"--distro=Ubuntu-20.04",
"/home/user/documents"
]
}
}
}If you encounter issues connecting to WSL or accessing directories, verify that the specified paths exist in the WSL environment and that the distribution name matches one of your installed WSL distributions. Ensure your Windows user has appropriate permissions for the WSL paths you expose. If a distribution is not specified, the server will use the default WSL distribution.
The server supports multiple WSL distributions and can be run alongside other MCP servers on the same system. Remember to only expose directories that you want Windows clients to access, and exercise caution with write permissions.
Read complete contents of a file inside WSL; input is a path and the content is returned as UTF-8 text.
Read large files in parts of approximately 95,000 characters. Supports part navigation and returns the actual file size if a requested part does not exist.
Read multiple files in parallel from WSL; non-fatal failures are reported per-file without aborting the entire operation.
Create or overwrite a file inside WSL. Use with caution.
Perform selective edits with pattern matching, including multi-line matches and indentation preservation. Supports a dry-run mode and a Git-like diff preview.
Create or ensure the existence of a directory in WSL.
List directory contents with [FILE] or [DIR] prefixes.
Provide a recursive JSON tree view of a directory's contents.
Move or rename files or directories within the WSL filesystem.
Recursively search for items by name inside a path, supporting include/exclude patterns.
Recursively search for text patterns inside files, with options for case, regex, includes/excludes, and result context.
Return detailed metadata for a given path, including size, timestamps, type, and permissions.
List all directories that are accessible to the server.
List available WSL distributions and indicate the active one.