Home / MCP / MCP WSL Exec Server

MCP WSL Exec Server

Provides read-only WSL context and safe command execution for Windows users running Claude Desktop.

typescript
Installation
Add the following to your MCP client configuration file.

Configuration

View docs
{
    "mcpServers": {
        "mcp_wsl_exec": {
            "command": "npx",
            "args": [
                "-y",
                "mcp-wsl-exec"
            ]
        }
    }
}

This MCP server lets you securely run commands in your Windows Subsystem for Linux (WSL) from Claude Desktop on Windows, while also gathering context about your WSL environment. It supports read-only information queries and controlled, safe command execution with built-in protections.

How to use

You interact with the MCP server through your MCP client. Use the information gathering tools to inspect your WSL environment without making changes, and use the command execution tool to run commands in WSL with safety checks. For dangerous operations, the server will require explicit confirmation before proceeding.

How to install

Prerequisites: you need Node.js and npm installed on your system. You will also use your MCP client to connect to the server.

Install the project dependencies and build the server locally, then run in development mode.

Install dependencies using pnpm (the project commonly uses pnpm for development):

pnpm install

Build the project:

pnpm build

Run in development mode:

pnpm dev

Configure your MCP client to connect to this server using the provided MCP configuration examples.

Configuration and safety notes

Configuration blocks shown here are used by your MCP client to connect to the server. Use these exact snippets in your client configuration.

{
	"mcpServers": {
		"mcp-wsl-exec": {
			"command": "npx",
			"args": ["-y", "mcp-wsl-exec"]
		}
	}
}
{
	"mcpServers": {
		"mcp-wsl-exec": {
			"command": "npx",
			"args": ["-y", "mcp-wsl-exec"]
		}
	}
}

Security and safety features

The server provides built-in safety features for command execution, including detection of dangerous commands, a command confirmation system, path traversal prevention, and command sanitization. Commands can specify a working directory and a timeout to prevent runaway processes. Shell injection is prevented through input sanitization and careful handling of user-provided data.

Troubleshooting notes

If you encounter connection issues, verify that your MCP client is configured with the correct server name and that the command and arguments match the server’s supported configuration. Ensure Node.js and npm are installed, and that you have run the build steps before starting in development mode.

Available tools

get_system_info

Retrieves OS version, kernel, hostname, and other system details.

get_directory_info

Returns directory contents and file information for a given path.

get_disk_usage

Provides disk space usage for specified paths or all filesystems.

get_environment

Lists environment variables, with optional filtering.

list_processes

Reports currently running processes, with optional name filtering.

execute_command

Executes a command in WSL with safety checks and optional timeout, requiring confirmation for dangerous commands.

confirm_command

Confirms execution of a dangerous command that was flagged by safety checks.