SM

spences10/mcp-wsl-exec

开发工具

本页由 AI 翻译,技术细节请以原文为准。 查看原文

26 stars 10 forks 质量 85 趋势 20MIT

一款用于与Linux子系统(WSL)交互的模型上下文协议(MCP)服务器。提供只读信息收集和安全命令执行能力。

概览

一款用于与Linux子系统(WSL)交互的模型上下文协议(MCP)服务器。提供只读信息收集和安全命令执行能力。 - 你正在使用 - 你需要与你的 WSL 环境交互 - 你想为 Claude 提供 WSL 上下文(系统信息、进程、文件等) - 你用的是(它有原生bash权限)- 你用的是Linux/macOS(用原生工具代替)- 你只需要Windows的PowerShell/CMD(用不同的MCP服务器) - 🖥️ 获取系统信息(操作系统、内核、主机名)- 📁 浏览目录内容 - 💾 检查磁盘使用情况 - ⚙️ 列出环境变量 - 🔄 监控正在运行的进程 - 🔒 WSL 环境中的安全命令执行 - ⚡ 内置安全功能:- 危险命令检测 - 命令确认系统 - 路径穿越防止 - 命令净化 - 📁 工作目录支持 - ⏱️ 命令超时功能 - 🛡️ 防止壳注入 这台服务器需要配置......

概述(AI 翻译)

一个适用于Windows + Claude桌面的模型上下文协议(MCP)服务器 用户与Linux子系统(WSL)交互。提供 既有只读信息收集,也包括安全命令执行 能力。

⚠️ 重要:谁应该使用这个?

** ✅ 如果:你应该使用这个

  • 你用的是Windows上的Claude Desktop
  • 你需要与你的WSL环境交互
  • 你想为 Claude 提供 WSL 上下文(系统信息、进程, 文件等)

** ❌ 如果你真的不需要这个:**

  • 你用的是Claude代码(它有原生bash权限)
  • 你用的是Linux/macOS(用原生工具代替)
  • 你只需要Windows PowerShell/CMD(使用不同的MCP服务器)

特色

📊 信息收集(只读)

  • 🖥️ 获取系统信息(操作系统、内核、主机名)
  • 📁 浏览目录内容
  • 💾 检查磁盘使用情况
  • ⚙️ 列表环境变量
  • 🔄 监控正在运行的进程

🔧 命令执行(安全执行)

  • 🔒 WSL 环境中的安全命令执行
  • ⚡ 内置安全功能:
  • 危险命令检测
  • 命令确认系统
  • 路径穿越预防
  • 命令消毒
  • 📁 工作目录支持

本页由 AI 翻译,技术细节请以原文为准。

README

以下为原文 README 节选,完整内容请查看原文。

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

在 GitHub 查看完整 README

安装

npx -y mcp-wsl-exec
新手?先看 mcpskill.org 教程 →

配置

{ "mcpServers": { "mcp-wsl-exec": { "command": "npx", "args": ["-y", "mcp-wsl-exec"] } } }