mcp-wsl-exec
The mcp-wsl-exec server allows for secure execution of commands within Windows Subsystem for Linux (WSL) environments with built-in safety features and validation.
Execute Commands: Run commands in WSL with optional timeout and working directory settings
Security Features: Implement dangerous command detection, command sanitization, path traversal prevention, and shell injection protection
Confirmation System: Manage execution of flagged commands requiring confirmation
Error Handling: Provide validation and detailed output formatting
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@mcp-wsl-exec list files in my home directory"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
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)
Related MCP server: Windows CLI 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 Validation
Commands are executed through bash -c, so normal shell syntax such
as pipes, quotes, redirects, and command chaining is preserved. The
server validates empty/null-byte inputs, quotes arguments used by
built-in tools, and requires confirmation for potentially dangerous
commands.
Development
Setup
Clone the repository
Install dependencies:
pnpm installBuild the project:
pnpm buildRun in development mode:
pnpm devPublishing
The project uses changesets for version management. To publish:
Create a changeset:
pnpm changesetVersion the package:
pnpm changeset versionPublish to npm:
pnpm releaseContributing
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
Available Tools
7 toolsconfirm_commandConfirm dangerous command executionCDestructive
Confirm dangerous command execution
Inputs: confirmation_id (required), confirm (required).
execute_commandExecute a command in WSL (use read-only tools when possible)CDestructive
Execute a command in WSL (use read-only tools when possible)
Inputs: command (required), working_dir, timeout.
get_directory_infoGet directory contents and infoCRead-only
Get directory contents and info
Inputs: path, details.
get_disk_usageGet disk space informationCRead-only
Get disk space information
Inputs: path.
get_environmentGet WSL environment variablesCRead-only
Get WSL environment variables
Inputs: filter.
get_system_infoGet WSL system informationCRead-only
Get WSL system information
Inputs: no named parameters.
list_processesList running processes in WSLCRead-only
List running processes in WSL
Inputs: filter.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 7 tools
Each tool has a clearly distinct purpose: confirm_command handles safety checks, execute_command runs commands, get_directory_info lists files, get_disk_usage shows storage, get_environment retrieves variables, get_system_info provides system details, and list_processes shows running processes. There is no overlap or ambiguity between these functions.
All tools follow a consistent verb_noun pattern with snake_case (e.g., confirm_command, execute_command, get_directory_info). The naming is uniform throughout, using 'get_' for retrieval operations and clear action-object pairs.
With 7 tools, the server is well-scoped for WSL execution and system monitoring. Each tool serves a specific and necessary function, covering command execution, file management, system diagnostics, and process handling without being overly sparse or bloated.
The toolset provides strong coverage for WSL operations, including command execution, file system inspection, system monitoring, and environment management. A minor gap exists in file manipulation (e.g., create/delete files) or network-related tools, but core workflows are well-supported.
Maintenance
Related MCP Connectors
Security scanner for MCP servers. Detect vulnerabilities, prompt injection, and tool poisoning.
MCP server for Superserve sandboxes: create, exec, and manage Firecracker microVMs
Security scanner for AI agents and MCP servers: injection, jailbreak, tool abuse.
Termalin's hosted MCP server. Claude, ChatGPT or any MCP client runs commands, moves files over SFTP, queries databases and reads server metrics and monitoring alerts on your servers, keylessly through Termalin Connectors: no SSH key is handed over and no inbound port is opened. Per-host command policy and an audit log. Needs a termal.in Pro or Team account (new accounts start with a 14-day Pro trial).
Related MCP Servers
- AlicenseBqualityDmaintenanceA secure MCP server for executing whitelisted shell commands with resource and timeout controls, designed for integration with Claude and other MCP-compatible LLMs.20389 npm7MIT
- AlicenseBqualityFmaintenanceA Model Context Protocol server that provides secure command-line access to Windows systems, allowing MCP clients like Claude Desktop to safely execute commands in PowerShell, CMD, and Git Bash shells with configurable security controls.9419 npm265MIT
- AlicenseAqualityDmaintenanceAn MCP server that enables secure execution of shell commands across Windows, macOS, and Linux with built-in whitelisting and approval mechanisms for enhanced security.968 npm23MIT
- AlicenseBqualityCmaintenanceA secure MCP server for shell operations, terminal management, and process control, enabling AI assistants to safely execute commands and manage interactive sessions.13158 npm6MIT