コマンド実行者 MCP サーバー
事前に承認されたコマンドを安全に実行するためのモデル コンテキスト プロトコル サーバー。
🎥 デモ
https://github.com/user-attachments/assets/ed763a12-b685-4e0b-b9a5-bc948a590f51
✨ 特徴
事前承認されたコマンドリストによる安全なコマンド実行
環境変数を通じて許可されるコマンドを設定可能
TypeScriptとMCP SDKで構築
シームレスな統合のためのstdio経由の通信
エラー処理とセキュリティ検証
リアルタイムコマンド出力ストリーミング
🚀 インストール
依存関係をインストールします:
サーバーを構築します。
自動リビルドを使用した開発の場合:
⚙️ 構成
🔒 許可されたコマンド
デフォルトでは、次のコマンドが許可されます。
ギット
ls
mkdir
CD
npm
npx
パイソン
ALLOWED_COMMANDS環境変数を設定することで、許可されるコマンドをカスタマイズできます。
🔌 クロード デスクトップ統合
Claude Desktop で使用するには、サーバー設定を追加します。
MacOSの場合:
Windowsの場合:
設定例:
🛡️ セキュリティに関する考慮事項
コマンド実行サーバーは、いくつかのセキュリティ対策を実装しています。
事前承認済みコマンドリスト
明示的に許可されたコマンドのみ実行できます
デフォルトのリストは制限的でセキュリティに重点を置いています
コマンドはプレフィックスによって検証され、インジェクションを防止します
コマンド検証
コマンドプレフィックス検証によりコマンドインジェクションを防止
セキュリティ強化のためシェル実行なし
環境変数は適切にサニタイズされている
エラー処理
不正なコマンドに対する包括的なエラー処理
デバッグのためにエラーメッセージをクリアする
失敗したコマンドはサーバーをクラッシュさせません
環境分離
サーバーは独自の環境で実行されます
環境変数を制御できる
システムアクセスの制限
💻 開発
📁 プロジェクト構造
🐛 デバッグ
MCPサーバーはstdio経由で通信するため、デバッグが困難になる場合があります。MCP Inspectorの使用をお勧めします。
インスペクターは、ブラウザでデバッグ ツールにアクセスするための URL を提供します。
🛠️ ツールAPI
サーバーは次の単一のツールを提供します:
実行コマンド
事前に承認されたコマンドを実行します。
パラメータ:
command(文字列、必須): 実行するコマンド
リクエスト例:
応答例:
エラー応答:
❌ エラー処理
サーバーは、さまざまなシナリオに対して詳細なエラー メッセージを提供します。
不正なコマンド
{ "code": "InvalidParams", "message": "Command not allowed: [command]. Allowed commands: git, ls, mkdir, cd, npm, npx, python" }実行失敗
{ "content": [ { "type": "text", "text": "Command execution failed: [error message]" } ], "isError": true }
🤝 貢献する
リポジトリをフォークする
機能ブランチを作成する
変更をコミットする
ブランチにプッシュする
新しいプルリクエストを作成する
📄 ライセンス
このプロジェクトは MIT ライセンスに基づいてライセンスされています - 詳細については LICENSE ファイルを参照してください。
Related MCP Servers
- -security-license-qualityA comprehensive Model Context Protocol server implementation that enables AI assistants to interact with file systems, databases, GitHub repositories, web resources, and system tools while maintaining security and control.Last updated -361
- Asecurity-licenseAqualityA secure Model Context Protocol server that allows AI models to safely interact with Windows command-line functionality, enabling controlled execution of system commands, project creation, and system information retrieval.Last updated -87MIT License
- -security-license-qualityA Model Context Protocol server that provides secure curl command execution capabilities, allowing AI assistants to make HTTP requests with configurable parameters and built-in security protections.Last updated -1
- Asecurity-licenseAqualityA Model Context Protocol server that enables AI assistants to communicate with each other using Inter-Process Communication, featuring natural language commands and cross-platform compatibility.Last updated -9107MIT License