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
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 devclaude_desktop_config.json or Cline MCP settings): json { "mcpServers": { "mcp-wsl-exec": { "command": "npx", "args": ["-y", "mcp-wsl-exec"] } } }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)..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.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.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…
Part of MCP Servers