Skip to main content
Glama

Bash MCP (Master Control Program)

by yannbam

Bash MCP (Programa de control maestro)

Una aplicación TypeScript que le permite a Claude ejecutar comandos bash de forma segura con medidas de seguridad.

Características

  • Ejecutar comandos bash en un entorno controlado
  • Soporte para ejecución de comandos tanto con estado como sin estado (interactivos)
  • Medidas de seguridad:
    • Comandos incluidos en la lista blanca
    • Directorios incluidos en la lista blanca
    • Validación de comandos
    • Sanitización de salida
  • Gestión de sesiones para comandos interactivos
  • Registro completo

Instalación

npm install npm run build

Configuración

La configuración se almacena en config/default.json . Puedes personalizarla:

  • Comandos permitidos
  • Directorios permitidos
  • Configuración de la sesión
  • Configuración de seguridad
  • Configuración de registro

Ejemplo de configuración:

{ "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 } }

Uso

Ejecución de comandos simples

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

Sesiones interactivas

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);

Consideraciones de seguridad

Este MCP está diseñado teniendo en cuenta la seguridad, pero es importante:

  • Mantenga la lista de comandos y directorios permitidos lo más restrictiva posible
  • Revisar y actualizar periódicamente la configuración
  • Supervisar los registros para detectar actividad sospechosa
  • Mantenga el MCP y sus dependencias actualizados

Desarrollo

Edificio

npm run build

Pelusa y formato

Para comprobar si hay problemas de pelusa:

npm run lint

Para corregir automáticamente problemas de pelusa y formato:

./fix-lint.sh

O manualmente:

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

Pruebas

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.

Una aplicación TypeScript que le permite a Claude ejecutar comandos bash de forma segura con medidas de seguridad que incluyen comandos incluidos en la lista blanca, directorios y registro completo.

  1. Características
    1. Instalación
      1. Configuración
        1. Uso
          1. Ejecución de comandos simples
          2. Sesiones interactivas
        2. Consideraciones de seguridad
          1. Desarrollo
            1. Edificio
            2. Pelusa y formato
            3. Pruebas

          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