Skip to main content
Glama

Bash MCP (Master Control Program)

by yannbam

Bash MCP(マスターコントロールプログラム)

Claude がセキュリティ保護機能を使用して bash コマンドを安全に実行できるようにする TypeScript アプリケーション。

特徴

  • 制御された環境でbashコマンドを実行する
  • ステートレスとステートフル(対話型)の両方のコマンド実行をサポート
  • セキュリティ対策:
    • ホワイトリストに登録されたコマンド
    • ホワイトリストに登録されたディレクトリ
    • コマンド検証
    • 出力のサニタイズ
  • 対話型コマンドのセッション管理
  • 包括的なログ記録

インストール

npm install npm run build

構成

設定はconfig/default.jsonに保存されます。以下の項目をカスタマイズできます。

  • 許可されたコマンド
  • 許可されたディレクトリ
  • セッション設定
  • セキュリティ設定
  • ログ設定

構成例:

{ "allowedCommands": ["ls", "cat", "echo", "pwd"], "allowedDirectories": ["/tmp", "/home"], "session": { "timeout": 300, "maxActiveSessions": 5, "defaultMode": "stateless" }, "security": { "validateCommandsStrictly": true, "sanitizeOutput": true, "maxOutputSize": 1048576, "commandTimeout": 30 }, "logging": { "level": "info", "file": "logs/bash-mcp.log", "maxSize": 10485760, "maxFiles": 5 } }

使用法

シンプルなコマンド実行

import { executeCommand } from 'bash-mcp'; const result = await executeCommand('ls -la', { cwd: '/home/user' }); console.log(result.output);

インタラクティブセッション

import { initBashMCP } from 'bash-mcp'; const mcp = await initBashMCP(); // Create a session const session = mcp.createSession('/home/user'); const sessionId = session.sessionId; // Execute a command in the session const result1 = await mcp.executeCommand('ls -la', { sessionId }); console.log(result1.output); // Send input to the session const result2 = await mcp.sendInput({ sessionId, input: 'echo "Hello, world!"' }); console.log(result2.output); // Close the session when done mcp.closeSession(sessionId);

セキュリティに関する考慮事項

この MCP はセキュリティを考慮して設計されていますが、次の点が重要です。

  • 許可されたコマンドとディレクトリのリストを可能な限り制限する
  • 定期的に構成を確認し更新する
  • ログを監視して不審なアクティビティがないか確認する
  • MCPとその依存関係を最新の状態に保つ

発達

建物

npm run build

リンティングとフォーマット

リンティングの問題を確認するには:

npm run lint

リンティングとフォーマットの問題を自動的に修正するには:

./fix-lint.sh

または手動で:

npm run lint:fix # Fix linting issues npm run format # Format code

テスト

npm test
-
security - not tested
F
license - not found
-
quality - not tested

local-only server

The server can only run on the client's local machine because it depends on local resources.

ホワイトリスト化されたコマンド、ディレクトリ、包括的なログ記録などのセキュリティ保護機能を使用して、Claude が bash コマンドを安全に実行できるようにする TypeScript アプリケーション。

  1. 特徴
    1. インストール
      1. 構成
        1. 使用法
          1. シンプルなコマンド実行
          2. インタラクティブセッション
        2. セキュリティに関する考慮事項
          1. 発達
            1. 建物
            2. リンティングとフォーマット
            3. テスト

          Related MCP Servers

          • A
            security
            A
            license
            A
            quality
            A secure shell command execution server implementing the Model Context Protocol (MCP). This server allows remote execution of whitelisted shell commands with support for stdin input.
            Last updated -
            1
            74
            Python
            MIT License
            • Apple
          • A
            security
            A
            license
            A
            quality
            A secure server for executing terminal commands within predefined paths, allowing safe interaction by Large Language Models with operating system environments.
            Last updated -
            1
            11
            3
            JavaScript
            MIT License
            • Apple
            • Linux
          • -
            security
            F
            license
            -
            quality
            A secure server that allows LLM applications like Claude to execute whitelisted system commands with user confirmation and comprehensive security features.
            Last updated -
            Python
            • Linux
            • Apple
          • A
            security
            F
            license
            A
            quality
            Provides a secure, isolated JavaScript execution environment with configurable time and memory limits for safely running code from Claude.
            Last updated -
            1
            5
            JavaScript
            • Apple

          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/yannbam/bash-mcp'

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