WSL Exec
Execute commands securely in Windows Subsystem for Linux (WSL).
mcp-wsl-exec
A Model Context Protocol (MCP) server for Windows + Claude Desktop users to interact with Windows Subsystem for Linux (WSL). Provides both read-only information gathering and secure command execution capabilities.
⚠️ Important: Who Should Use This?
✅ You SHOULD use this if:
- You're using Claude Desktop on Windows
- You need to interact with your WSL environment
- You want to provide WSL context to Claude (system info, processes, files, etc.)
❌ You DON'T need this if:
- You're using Claude Code (it has native bash access)
- You're on Linux/macOS (use native tools instead)
- You only need Windows PowerShell/CMD (use a different MCP server)
Features
📊 Information Gathering (Read-Only)
- 🖥️ Get system information (OS, kernel, hostname)
- 📁 Browse directory contents
- 💾 Check disk usage
- ⚙️ List environment variables
- 🔄 Monitor running processes
🔧 Command Execution (With Safety)
- 🔒 Secure command execution in WSL environments
- ⚡ Built-in safety features:
- Dangerous command detection
- Command confirmation system
- Path traversal prevention
- Command sanitization
- 📁 Working directory support
- ⏱️ Command timeout functionality
- 🛡️ Protection against shell injection
Configuration
This server requires configuration through your MCP client. Here are examples for different environments:
Cline Configuration
Add this to your Cline MCP settings:
{
"mcpServers": {
"mcp-wsl-exec": {
"command": "npx",
"args": ["-y", "mcp-wsl-exec"]
}
}
}
Claude Desktop Configuration
Add this to your Claude Desktop configuration:
{
"mcpServers": {
"mcp-wsl-exec": {
"command": "npx",
"args": ["-y", "mcp-wsl-exec"]
}
}
}
API
The server provides 7 MCP tools:
Information Gathering (Read-Only) 📊
These tools provide context about your WSL environment without making changes:
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): Directory path (defaults to current directory)details(boolean, optional): Show detailed information (permissions, sizes, etc.)
get_disk_usage
Get disk space information.
Parameters:
path(string, optional): Specific path to check (defaults to all filesystems)
get_environment
Get environment variables.
Parameters:
filter(string, optional): Filter pattern to search for specific variables
list_processes
List running processes.
Parameters:
filter(string, optional): Filter by process name
Command Execution (Potentially Destructive) 🔧
Use these tools when you need to make changes or run custom commands:
execute_command
Execute a command in WSL with safety checks and validation.
Parameters:
command(string, required): Command to executeworking_dir(string, optional): Working directory for command executiontimeout(number, optional): Timeout in milliseconds
Note: Dangerous commands will require confirmation via confirm_command.
confirm_command
Confirm execution of a dangerous command that was flagged by safety checks.
Parameters:
confirmation_id(string, required): Confirmation ID received from execute_commandconfirm(boolean, required): Whether to proceed with the command execution
Safety Features
Dangerous Command Detection
The server maintains a list of potentially dangerous commands that require explicit confirmation before execution, including:
- File system operations (rm, rmdir, mv)
- System commands (shutdown, reboot)
- Package management (apt, yum, dnf)
- File redirections (>, >>)
- Permission changes (chmod, chown)
- And more...
Command Sanitization
All commands are sanitized to prevent:
- Shell metacharacter injection
- Path traversal attempts
- Home directory references
- Dangerous command chaining
Development
Setup
- Clone the repository
- Install dependencies:
pnpm install
- Build the project:
pnpm build
- Run in development mode:
pnpm dev
Publishing
The project uses changesets for version management. To publish:
- Create a changeset:
pnpm changeset
- Version the package:
pnpm changeset version
- Publish to npm:
pnpm release
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
License
MIT License - see the LICENSE file for details.
Acknowledgments
- Built on the Model Context Protocol
- Designed for secure WSL command execution
Related Servers
Scout Monitoring MCP
sponsorPut performance and error data directly in the hands of your AI assistant.
Alpha Vantage MCP Server
sponsorAccess financial market data: realtime & historical stock, ETF, options, forex, crypto, commodities, fundamentals, technical indicators, & more
Code Assistant
A Rust-based CLI tool for code-related tasks, operating as an MCP server.
Stata-MCP
Perform regression analysis using Stata with the help of an LLM. Requires a local Stata installation and an external LLM API key.
Code Snippet Image
Generate beautiful, shareable images from code snippets with syntax highlighting and multiple themes.
Authenticator App MCP Server
A secure MCP server for AI agents to interact with the Authenticator App for 2FA codes and passwords.
Cashfree MCP Server
Integrate AI tools and agents with Cashfree's Payment Gateway, Payouts, and SecureID APIs.
Claude Google Apps Script MCP Guide
Integrate Claude AI with Google Apps Script to automate tasks in Google Sheets and Gmail.
Keycloak MCP Server
An MCP server for Keycloak administration, offering over 30 tools to manage users, realms, clients, roles, and more from AI assistants.
GenSpec MCP Server
Converts a USER-STORIES.md file into README, ROADMAP, and SYSTEM-ARCHITECTURE documents for the GenSpec workflow.
SVG to PNG MCP Server
A server that converts SVG code to PNG images using the cairosvg library.
Md2svg
Converts Markdown text to SVG images.