This MCP server allows you to securely execute commands in Windows Subsystem for Linux (WSL) environments through the Model Context Protocol. It provides comprehensive safety features including dangerous command detection, command confirmation systems, and protection against shell injection.
You can easily install and use the MCP-WSL-Exec server through the NPX package runner. No separate installation is required as the configuration uses NPX to run the server on demand.
Add this to your Cline MCP settings:
{
"mcpServers": {
"mcp-wsl-exec": {
"command": "npx",
"args": ["-y", "mcp-wsl-exec"]
}
}
}
Add this to your Claude Desktop configuration:
{
"mcpServers": {
"mcp-wsl-exec": {
"command": "npx",
"args": ["-y", "mcp-wsl-exec"]
}
}
}
The MCP-WSL-Exec server provides two main tools for command execution:
This tool allows you to execute commands in WSL with built-in safety checks.
Parameters:
command
(string, required): The command you want to executeworking_dir
(string, optional): Working directory for command executiontimeout
(number, optional): Timeout in millisecondsExample usage:
// Basic command execution
execute_command({ command: "ls -la" })
// With working directory
execute_command({ command: "ls -la", working_dir: "/home/user/projects" })
// With timeout
execute_command({ command: "sleep 10", timeout: 5000 })
If a command is flagged as potentially dangerous, you'll need to use this tool to confirm execution.
Parameters:
confirmation_id
(string, required): Confirmation ID received from execute_commandconfirm
(boolean, required): Whether to proceed with the command executionExample usage:
// Confirm a dangerous command
confirm_command({ confirmation_id: "abc123", confirm: true })
// Reject a dangerous command
confirm_command({ confirmation_id: "abc123", confirm: false })
The server automatically flags potentially dangerous commands that require explicit confirmation, including:
All commands undergo sanitization to prevent:
There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json
file so that it is available in all of your projects.
If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json
file.
To add a global MCP server go to Cursor Settings > MCP and click "Add new global MCP server".
When you click that button the ~/.cursor/mcp.json
file will be opened and you can add your server like this:
{
"mcpServers": {
"cursor-rules-mcp": {
"command": "npx",
"args": [
"-y",
"cursor-rules-mcp"
]
}
}
}
To add an MCP server to a project you can create a new .cursor/mcp.json
file or add it to the existing one. This will look exactly the same as the global MCP server example above.
Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.
The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.
You can also explictly ask the agent to use the tool by mentioning the tool name and describing what the function does.