WSL Filesystem MCP server

Provides a bridge between Windows and Linux environments by enabling access to WSL filesystem operations, allowing seamless reading, writing, editing, and management of files within WSL distributions directly from Windows.
Back to servers
Setup instructions
Provider
Web-C
Release date
Apr 20, 2025
Language
TypeScript
Package
Stats
805 downloads
5 stars

The MCP server for WSL provides a specialized implementation of the Model Context Protocol for accessing and manipulating files in Windows Subsystem for Linux (WSL) environments. Unlike the original Filesystem MCP Server, this version leverages native Linux commands inside WSL for significantly faster file operations, particularly when dealing with large directory trees.

Installation

Prerequisites

  • Windows Subsystem for Linux (WSL) properly configured
  • At least one Linux distribution installed in WSL
  • Node.js (v18.0.0 or higher)

Installing via NPM

The package is available on npm as mcp-server-wsl-filesystem:

npm install -g mcp-server-wsl-filesystem

If you're developing with the server:

npm install
npm run build

Basic Usage

Run the server by specifying which WSL distribution to use (optional) and which directories to expose:

node dist/index.js [--distro=distribution_name] <allowed_directory> [additional_directories...]

Usage Examples

Access a specific WSL distribution:

node dist/index.js --distro=Ubuntu-20.04 /home/user/documents

Use the default WSL distribution:

node dist/index.js /home/user/documents

Configuration with Claude Desktop

Add the MCP server to your claude_desktop_config.json:

Using a specific WSL distribution:

{
  "mcpServers": {
    "wsl-filesystem": {
      "command": "npx",
      "args": [
        "-y",
        "mcp-server-wsl-filesystem",
        "--distro=Ubuntu-20.04",
        "/home/user/documents"
      ]
    }
  }
}

Using the default WSL distribution:

{
  "mcpServers": {
    "wsl-filesystem": {
      "command": "npx",
      "args": [
        "-y",
        "mcp-server-wsl-filesystem",
        "/home/user/documents"
      ]
    }
  }
}

Available Features

File Operations

  • Read Files: Read complete file contents or in parts for large files
  • Write Files: Create or overwrite files
  • Edit Files: Make selective edits with pattern matching
  • Directory Management: Create, list, and navigate directories
  • File Movement: Move or rename files/directories
  • Search Capabilities: Search by filename or content within files
  • Metadata Access: Get detailed file information

Example Tools

Reading Files

{
  "tool": "read_file",
  "args": {
    "path": "/home/user/documents/example.txt"
  }
}

Searching Within Files

{
  "tool": "search_in_files",
  "args": {
    "path": "/home/user/project",
    "pattern": "function main",
    "includePatterns": ["*.js", "*.ts"],
    "excludePatterns": ["node_modules"],
    "contextLines": 2
  }
}

Listing WSL Distributions

{
  "tool": "list_wsl_distributions"
}

Security Note

The server only allows operations within directories specified via the args parameter. Be careful when configuring which directories to expose, as the server will have read/write access to these locations.

How to install this MCP server

For Claude Code

To add this MCP server to Claude Code, run this command in your terminal:

claude mcp add-json "wsl-filesystem" '{"command":"npx","args":["-y","mcp-server-wsl-filesystem","/home/user/documents"]}'

See the official Claude Code MCP documentation for more details.

For Cursor

There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json file so that it is available in all of your projects.

If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json file.

Adding an MCP server to Cursor globally

To add a global MCP server go to Cursor Settings > Tools & Integrations and click "New MCP Server".

When you click that button the ~/.cursor/mcp.json file will be opened and you can add your server like this:

{
    "mcpServers": {
        "wsl-filesystem": {
            "command": "npx",
            "args": [
                "-y",
                "mcp-server-wsl-filesystem",
                "/home/user/documents"
            ]
        }
    }
}

Adding an MCP server to a project

To add an MCP server to a project you can create a new .cursor/mcp.json file or add it to the existing one. This will look exactly the same as the global MCP server example above.

How to use the MCP server

Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.

The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.

You can also explicitly ask the agent to use the tool by mentioning the tool name and describing what the function does.

For Claude Desktop

To add this MCP server to Claude Desktop:

1. Find your configuration file:

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Windows: %APPDATA%\Claude\claude_desktop_config.json
  • Linux: ~/.config/Claude/claude_desktop_config.json

2. Add this to your configuration file:

{
    "mcpServers": {
        "wsl-filesystem": {
            "command": "npx",
            "args": [
                "-y",
                "mcp-server-wsl-filesystem",
                "/home/user/documents"
            ]
        }
    }
}

3. Restart Claude Desktop for the changes to take effect

Want to 10x your AI skills?

Get a free account and learn to code + market your apps using AI (with or without vibes!).

Nah, maybe later