WSL Exec

WSL Exec acts as a bridge between an AI assistant and a Windows user's Linux subsystem. It essentially gives an LLM like Claude a pair of hands to peek inside and interact with the Linux environment running on a Windows machine. Instead of the user manually copying file paths or terminal output into a chat window, this tool allows the AI to directly explore directories, check system stats, and understand the technical context of the Linux environment it is helping to manage. Beyond just looking around, this MCP server enables the execution of active commands within the WSL environment. It provides a suite of seven specialized tools that allow an AI to perform tasks such as monitoring running processes, checking disk usage, and retrieving environment variables. This creates a much more fluid workflow for developers who need their AI to help diagnose system issues, manage files, or navigate complex directory structures without the friction of manual intervention. For more complex automation, the server handles command execution with a heavy emphasis on security and validation. It features a built-in safety engine that detects potentially destructive operations—such as file deletions, permission changes, or package updates—and requires a specific confirmation ID before the AI can proceed. By implementing path traversal prevention, command sanitization, and execution timeouts, it provides a hardened interface for AI-driven terminal interaction. This makes it an essential utility for Windows-based developers who want to leverage the power of an LLM to automate and manage their WSL-based development pipelines securely.

Category: Cloud & Infrastructure

Tags: automation, linux, terminal, windows, wsl

Visit WSL Exec

How to install and configure WSL Exec

1. Installation The server can be run directly using npx without a manual global installation. For development purposes, the following steps are provided: 1. Clone the repository. 2. Install dependencies: pnpm install 3. Build the project: pnpm build 4. Run in development mode: pnpm dev

2. Configuration To use this server with an MCP client, add the following JSON to your settings file (e.g., claude_desktop_config.json or Cline MCP settings): json { "mcpServers": { "mcp-wsl-exec": { "command": "npx", "args": ["-y", "mcp-wsl-exec"] } } }

3. Available Tools The server provides 7 MCP tools divided into Information Gathering and Command Execution: Information Gathering (Read-Only) * get_system_info: Get system information (OS version, kernel, hostname). * Parameters: None * get_directory_info: Get directory contents and file information. * Parameters: path (string, optional), details (boolean, optional). * get_disk_usage: Get disk space information. * Parameters: path (string, optional). * get_environment: Get environment variables. * Parameters: filter (string, optional). * list_processes: List running processes. * Parameters: filter (string, optional). Command Execution (Potentially Destructive) * execute_command: Execute a command in WSL with safety checks and validation. * Parameters: command (string, required), working_dir (string, optional), timeout (number, optional). * Note: Dangerous commands will flag a requirement for confirmation. * confirm_command: Confirm execution of a dangerous command flagged by safety checks. * Parameters: confirmation_id (string, required), confirm (boolean, required).

4. Example Prompts (No specific usage prompts were provided in the source content.)

What you can do with WSL Exec

Use Case 1: Troubleshooting Linux-Based Development Environments Problem: A developer is building a web application that runs inside WSL (e.g., a Node.js or Python backend), but it’s failing to start. Because the developer is using Claude Desktop on Windows, they normally have to jump back and forth between the AI chat and the WSL terminal to check logs, environment variables, and active processes. Solution: The WSL Exec MCP allows Claude to directly inspect the WSL environment. Claude can check if the database service is running, verify that the .env variables are correctly loaded, and read the latest error logs without the user leaving the chat interface. Example: Claude uses list_processes to see if redis-server is active, then uses get_environment to check the DATABASE_URL, and finally uses execute_command with tail -n 50 app.log to identify the specific stack trace.

Use Case 2: Guided System Maintenance and Package Installation Problem: A user needs to install a specific set of dependencies or tools (like Docker, Go, or specialized libraries) in their WSL distribution but is unfamiliar with Linux command-line syntax or is worried about running dangerous commands that might break their setup. Solution: This MCP provides a "human-in-the-loop" safety mechanism. Claude can prepare the necessary apt or dnf commands. Because these are flagged as "potentially destructive," the server forces a confirm_command step, ensuring the user sees exactly what will happen before the system-level changes are applied. Example: Claude generates an update command: sudo apt-get update && sudo apt-get install -y build-essential. The MCP flags this as "dangerous," providing a confirmation_id. The user reviews the command in the Claude UI and clicks "confirm," triggering the installation.

Use Case 3: Managing WSL Storage and Disk Cleanup Problem: WSL virtual disk files (ext4.vhdx) frequently grow in size, and users often run out of space without knowing which specific directories are the culprits. Navigating the Linux filesystem via Windows File Explorer is slow and doesn't always show accurate disk usage for hidden directories (like .npm or .cache). Solution: The MCP provides specialized tools like get_disk_usage and get_directory_info to perform a "health check" on the WSL filesystem. Claude can analyze the output to pinpoint large, unnecessary files and suggest cleanup commands. Example: Claude runs get_disk_usage to see which partition is full, then uses get_directory_info with details: true on `

var/logand~/.cache`. It identifies 5GB of old logs and asks the user for permission to run…

Key facts

  • Open Source
  • https://github.com/spences10/mcp-wsl-exec
  • Cloud & Infrastructure, Developer Tools & Code Intelligence, Files, Documents & PDFs
  • automation, linux, terminal, windows, wsl

Part of MCP Servers

Related MCP servers

  • MCP KQL Server — MCP KQL Server is an MCP server that connects AI assistants to Azure Data Explorer clusters using Azure CLI authentication.…
  • MCP LaTeX Server — MCP LaTeX Server is an MCP server that provides tools for creating, editing, validating, and compiling LaTeX documents directly through…
  • MCP JSON — MCP JSON is an MCP server collection that bundles tools for file system operations, Google search, browser-based web automation, and…
  • MCP Jupyter Complete — MCP Jupyter Complete is an MCP server that provides tools for manipulating Jupyter notebook files through position-based cell operations and…
  • MCP LSP Go — MCP LSP Go is an MCP server that connects AI assistants to the official Go Language Server Protocol implementation, gopls,…
  • MCP Manager — MCP Manager is an MCP server management tool that connects directly to your Claude Desktop environment, enabling users to discover,…

What is WSL Exec?

WSL Exec is an open-source Model Context Protocol server that bridges Windows-based AI clients and the Windows Subsystem for Linux. It allows tools like Claude Desktop to run bash commands, read directories, inspect processes, and retrieve Linux system metrics directly from your Windows desktop.

Which MCP clients work with WSL Exec?

It is designed for clients running on Windows that support MCP server configurations, specifically Claude Desktop and Cline. Users on native Linux, macOS, or those using Claude Code do not need this server because they already have native shell access.

How does WSL Exec handle dangerous commands?

The server includes dangerous command detection for operations involving file removal, permission changes, system reboots, and package managers. When detected, the server issues a confirmation identifier and halts execution until the client explicitly validates the action using the confirmation tool.

Is WSL Exec open source?

Yes, WSL Exec is an open-source project distributed under the MIT license. You can view the code, report issues, and contribute directly through its GitHub repository.

  • AI Tools
  • Categories
  • Industries
  • CLI Coding Agents
  • MCP Servers
  • MCP Categories