- Explore MCP Servers
- mcp-wsl-exec
Mcp Wsl Exec
What is Mcp Wsl Exec
mcp-wsl-exec is a Model Context Protocol (MCP) server designed for executing commands in Windows Subsystem for Linux (WSL) environments, ensuring secure command execution with built-in safety features.
Use cases
Use cases for mcp-wsl-exec include executing scripts in WSL, automating tasks that require command execution with safety checks, and managing server environments where command security is critical.
How to use
To use mcp-wsl-exec, configure it in your MCP client settings by adding the command and arguments as specified in the README. You can execute commands using the ‘execute_command’ API and confirm dangerous commands with ‘confirm_command’.
Key features
Key features include secure command execution, dangerous command detection, command confirmation system, path traversal prevention, command sanitization, working directory support, command timeout functionality, detailed command output formatting, error handling, and protection against shell injection.
Where to use
mcp-wsl-exec is suitable for developers and system administrators who need to execute commands securely in WSL environments, particularly in scenarios requiring safety checks and command validation.
Clients Supporting MCP
The following are the main client software that supports the Model Context Protocol. Click the link to visit the official website for more information.
Overview
What is Mcp Wsl Exec
mcp-wsl-exec is a Model Context Protocol (MCP) server designed for executing commands in Windows Subsystem for Linux (WSL) environments, ensuring secure command execution with built-in safety features.
Use cases
Use cases for mcp-wsl-exec include executing scripts in WSL, automating tasks that require command execution with safety checks, and managing server environments where command security is critical.
How to use
To use mcp-wsl-exec, configure it in your MCP client settings by adding the command and arguments as specified in the README. You can execute commands using the ‘execute_command’ API and confirm dangerous commands with ‘confirm_command’.
Key features
Key features include secure command execution, dangerous command detection, command confirmation system, path traversal prevention, command sanitization, working directory support, command timeout functionality, detailed command output formatting, error handling, and protection against shell injection.
Where to use
mcp-wsl-exec is suitable for developers and system administrators who need to execute commands securely in WSL environments, particularly in scenarios requiring safety checks and command validation.
Clients Supporting MCP
The following are the main client software that supports the Model Context Protocol. Click the link to visit the official website for more information.
Content
mcp-wsl-exec
A Model Context Protocol (MCP) server for executing commands in
Windows Subsystem for Linux (WSL) environments. This server provides
secure command execution with built-in safety features and validation.
Features
- 🔒 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
- 🔍 Detailed command output formatting
- ❌ Error handling and validation
- 🛡️ 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 implements two MCP tools:
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
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
Dev Tools Supporting MCP
The following are the main code editors that support the Model Context Protocol. Click the link to visit the official website for more information.










