Skip to main content
Glama

mcp-shell-server

by tumf

MCP シェル サーバー

モデルコンテキストプロトコル(MCP)を実装したセキュアシェルコマンド実行サーバー。このサーバーは、標準入力をサポートし、ホワイトリストに登録されたシェルコマンドのリモート実行を可能にします。

特徴

  • 安全なコマンド実行:ホワイトリストに登録されたコマンドのみ実行可能
  • 標準入力サポート: stdin経由でコマンドに入力を渡す
  • 包括的な出力: stdout、stderr、終了ステータス、実行時間を返します。
  • シェル演算子の安全性: シェル演算子 (;、&&、||、|) の後のコマンドを検証します。
  • タイムアウト制御: コマンドの最大実行時間を設定する

Claude.app の MCP クライアント設定

公開版

code ~/Library/Application\ Support/Claude/claude_desktop_config.json
{ "mcpServers": { "shell": { "command": "uvx", "args": [ "mcp-shell-server" ], "env": { "ALLOW_COMMANDS": "ls,cat,pwd,grep,wc,touch,find" } }, } }

ローカルバージョン

構成
code ~/Library/Application\ Support/Claude/claude_desktop_config.json
{ "mcpServers": { "shell": { "command": "uv", "args": [ "--directory", ".", "run", "mcp-shell-server" ], "env": { "ALLOW_COMMANDS": "ls,cat,pwd,grep,wc,touch,find" } }, } }
インストール

Smithery経由でインストール

Smithery経由で Claude Desktop の Shell Server を自動的にインストールするには:

npx -y @smithery/cli install mcp-shell-server --client claude

手動インストール

pip install mcp-shell-server

Smithery経由でインストール

Smithery経由で Claude Desktop の Shell Server を自動的にインストールするには:

npx -y @smithery/cli install mcp-shell-server --client claude

使用法

サーバーの起動

ALLOW_COMMANDS="ls,cat,echo" uvx mcp-shell-server # Or using the alias ALLOWED_COMMANDS="ls,cat,echo" uvx mcp-shell-server

ALLOW_COMMANDS (またはそのエイリアスであるALLOWED_COMMANDS )環境変数は、実行を許可するコマンドを指定します。コマンドはカンマで区切ることができ、前後にスペースを入れることもできます。

ALLOW_COMMANDS または ALLOWED_COMMANDS の有効な形式:

ALLOW_COMMANDS="ls,cat,echo" # Basic format ALLOWED_COMMANDS="ls ,echo, cat" # With spaces (using alias) ALLOW_COMMANDS="ls, cat , echo" # Multiple spaces

リクエスト形式

# Basic command execution { "command": ["ls", "-l", "/tmp"] } # Command with stdin input { "command": ["cat"], "stdin": "Hello, World!" } # Command with timeout { "command": ["long-running-process"], "timeout": 30 # Maximum execution time in seconds } # Command with working directory and timeout { "command": ["grep", "-r", "pattern"], "directory": "/path/to/search", "timeout": 60 }

応答フォーマット

成功した応答:

{ "stdout": "command output", "stderr": "", "status": 0, "execution_time": 0.123 }

エラー応答:

{ "error": "Command not allowed: rm", "status": 1, "stdout": "", "stderr": "Command not allowed: rm", "execution_time": 0 }

安全

サーバーはいくつかのセキュリティ対策を実装しています。

  1. コマンドホワイトリスト: 明示的に許可されたコマンドのみ実行可能
  2. シェル演算子の検証: シェル演算子 (;、&&、||、|) の後のコマンドもホワイトリストに対して検証されます。
  3. シェルインジェクションなし: コマンドはシェル解釈なしで直接実行されます

発達

開発環境の設定

  1. リポジトリをクローンする
git clone https://github.com/yourusername/mcp-shell-server.git cd mcp-shell-server
  1. テスト要件を含む依存関係をインストールする
pip install -e ".[test]"

テストの実行

pytest

APIリファレンス

リクエスト引数

分野タイプ必須説明
指示[]はいコマンドとその引数を配列要素として
標準入力いいえコマンドに渡される入力
ディレクトリいいえコマンド実行のための作業ディレクトリ
タイムアウト整数いいえ最大実行時間(秒)

応答フィールド

分野タイプ説明
標準出力コマンドからの標準出力
標準エラー出力コマンドからの標準エラー出力
状態整数終了ステータスコード
実行時間フロート実行にかかった時間(秒)
エラーエラー メッセージ (失敗した場合のみ表示)

要件

  • Python 3.11以上
  • mcp>=1.1.0

ライセンス

MITライセンス - 詳細はLICENSEファイルを参照

Install Server
A
security – no known vulnerabilities
A
license - permissive license
A
quality - confirmed to work

remote-capable server

The server can be hosted and run remotely because it primarily relies on remote services or has no dependency on the local environment.

モデルコンテキストプロトコル(MCP)を実装したセキュアシェルコマンド実行サーバー。このサーバーは、標準入力をサポートし、ホワイトリストに登録されたシェルコマンドのリモート実行を可能にします。

  1. 特徴
    1. Claude.app の MCP クライアント設定
      1. 公開版
      2. ローカルバージョン
      3. Smithery経由でインストール
      4. 手動インストール
      5. Smithery経由でインストール
    2. 使用法
      1. サーバーの起動
      2. リクエスト形式
      3. 応答フォーマット
    3. 安全
      1. 発達
        1. 開発環境の設定
        2. テストの実行
      2. APIリファレンス
        1. リクエスト引数
        2. 応答フィールド
      3. 要件
        1. ライセンス

          Related MCP Servers

          • A
            security
            A
            license
            A
            quality
            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.
            Last updated -
            9
            569
            228
            JavaScript
            MIT License
          • A
            security
            A
            license
            A
            quality
            A secure terminal execution server that enables controlled command execution with security features and resource limits via the Model Context Protocol (MCP).
            Last updated -
            1
            255
            6
            JavaScript
            MIT License
            • Apple
          • A
            security
            A
            license
            A
            quality
            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.
            Last updated -
            9
            346
            6
            JavaScript
            MIT License
            • Linux
            • Apple
          • A
            security
            F
            license
            A
            quality
            A secure server that implements the Model Context Protocol (MCP) to enable controlled execution of authorized shell commands with stdin support.
            Last updated -
            1
            Python

          View all related MCP servers

          MCP directory API

          We provide all the information about MCP servers via our MCP API.

          curl -X GET 'https://glama.ai/api/mcp/v1/servers/tumf/mcp-shell-server'

          If you have feedback or need assistance with the MCP directory API, please join our Discord server