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
  • Cloud & Infrastructure, Developer Tools & Code Intelligence, Files, Documents & PDFs
  • automation, linux, terminal, windows, wsl

Part of MCP Servers

Related MCP servers

  • MCP KQL Server — Execute KQL queries using Azure authentication. Requires Azure CLI login.
  • MCP LaTeX Server — Create, edit, and manage LaTeX files. Requires an external LaTeX distribution like MiKTeX, TeX Live, or MacTeX.
  • MCP JSON — A collection of servers for file system operations, Google search, web automation, and executing terminal commands.
  • MCP Jupyter Complete — A server for Jupyter notebook manipulation with position-based operations and VS Code integration.
  • MCP LSP Go — An MCP server that connects AI assistants to Go's Language Server Protocol (LSP) for advanced code analysis.
  • MCP Manager — A full-stack application for managing Model Context Protocol (MCP) servers for Claude Desktop with a modern web interface.
  • AI Tools
  • Categories
  • Industries
  • CLI Coding Agents
  • MCP Servers
  • MCP Categories