Skip to main content
Glama
mcp-wsl-exec
by spences10

mcp-wsl-exec

Windows Subsystem for Linux (WSL) 環境でコマンドを実行するためのモデルコンテキストプロトコル (MCP) サーバー。このサーバーは、組み込みの安全機能と検証機能により、安全なコマンド実行を提供します。

特徴

  • 🔒 WSL環境での安全なコマンド実行

  • ⚡ 内蔵の安全機能:

    • 危険なコマンドの検出

    • コマンド確認システム

    • パストラバーサル防止

    • コマンドサニタイズ

  • 📁 作業ディレクトリのサポート

  • ⏱️ コマンドタイムアウト機能

  • 🔍 詳細なコマンド出力フォーマット

  • ❌ エラー処理と検証

  • 🛡️ シェルインジェクションに対する保護

Related MCP server: Windows CLI MCP Server

構成

このサーバーはMCPクライアント経由で設定する必要があります。以下に、様々な環境における設定例を示します。

傾斜構成

Cline MCP 設定に以下を追加します:

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

クロードデスクトップ構成

Claude Desktop の構成にこれを追加します:

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

API

サーバーは 2 つの MCP ツールを実装します。

実行コマンド

安全性チェックと検証を伴って WSL でコマンドを実行します。

パラメータ:

  • command (文字列、必須): 実行するコマンド

  • working_dir (文字列、オプション): コマンド実行のための作業ディレクトリ

  • timeout (数値、オプション):ミリ秒単位のタイムアウト

確認コマンド

安全性チェックによってフラグが付けられた危険なコマンドの実行を確認します。

パラメータ:

  • confirmation_id (文字列、必須): execute_commandから受信した確認ID

  • confirm (ブール値、必須): コマンドの実行を続行するかどうか

安全機能

危険なコマンド検出

サーバーは、実行前に明示的な確認を必要とする潜在的に危険なコマンドのリストを保持しています。これには以下が含まれます。

  • ファイルシステム操作 (rm、rmdir、mv)

  • システムコマンド(シャットダウン、再起動)

  • パッケージ管理(apt、yum、dnf)

  • ファイルのリダイレクト (>, >>)

  • 権限の変更 (chmod、chown)

  • さらに…

コマンドサニタイズ

すべてのコマンドは、次のことを防ぐためにサニタイズされています。

  • シェルメタ文字インジェクション

  • パストラバーサルの試み

  • ホームディレクトリ参照

  • 危険なコマンド連鎖

発達

設定

  1. リポジトリをクローンする

  2. 依存関係をインストールします:

pnpm install
  1. プロジェクトをビルドします。

pnpm build
  1. 開発モードで実行:

pnpm dev

出版

このプロジェクトではバージョン管理に変更セットを使用しています。公開するには:

  1. 変更セットを作成します。

pnpm changeset
  1. パッケージのバージョン:

pnpm changeset version
  1. npm に公開:

pnpm release

貢献

貢献を歓迎します!お気軽にプルリクエストを送信してください。

ライセンス

MIT ライセンス - 詳細についてはLICENSEファイルを参照してください。

謝辞

Available Tools

7 tools
confirm_commandConfirm dangerous command executionC
Destructive

Confirm dangerous command execution

Inputs: confirmation_id (required), confirm (required).

execute_commandExecute a command in WSL (use read-only tools when possible)C
Destructive

Execute a command in WSL (use read-only tools when possible)

Inputs: command (required), working_dir, timeout.

get_directory_infoGet directory contents and infoC
Read-only

Get directory contents and info

Inputs: path, details.

get_disk_usageGet disk space informationC
Read-only

Get disk space information

Inputs: path.

get_environmentGet WSL environment variablesC
Read-only

Get WSL environment variables

Inputs: filter.

get_system_infoGet WSL system informationC
Read-only

Get WSL system information

Inputs: no named parameters.

list_processesList running processes in WSLC
Read-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

    B3.3/5.0

    Scored across 7 tools

    Disambiguation5/5

    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.

    Naming Consistency5/5

    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.

    Tool Count5/5

    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.

    Completeness4/5

    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

    ActivityInactive
    ResponsivenessOutdated data

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      B
      quality
      D
      maintenance
      A secure MCP server for executing whitelisted shell commands with resource and timeout controls, designed for integration with Claude and other MCP-compatible LLMs.
      20
      389 npm
      7
      MIT
    • A
      license
      B
      quality
      F
      maintenance
      A 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.
      9
      419 npm
      265
      MIT
    • A
      license
      A
      quality
      D
      maintenance
      An MCP server that enables secure execution of shell commands across Windows, macOS, and Linux with built-in whitelisting and approval mechanisms for enhanced security.
      9
      68 npm
      23
      MIT
    • A
      license
      B
      quality
      C
      maintenance
      A secure MCP server for shell operations, terminal management, and process control, enabling AI assistants to safely execute commands and manage interactive sessions.
      13
      158 npm
      6
      MIT