Skip to main content
Glama
sonirico

mcp-shell

by sonirico

mcp-shell

Trust Score glama

Servidor MCP que ejecuta comandos de shell. Tu LLM obtiene una herramienta; tú controlas qué se ejecuta y cómo.

Construido sobre mark3labs/mcp-go. Escrito en Go.


Ejecútalo

Docker (lo más fácil):

docker run -it --rm -v /tmp/mcp-workspace:/tmp/mcp-workspace sonirico/mcp-shell:latest

Desde el código fuente:

git clone https://github.com/sonirico/mcp-shell && cd mcp-shell
make install
mcp-shell

Related MCP server: MCP Shell Server

Configúralo

El modo seguro es el predeterminado. Sin archivo de configuración, mcp-shell arranca en modo seguro restringido a una lista blanca estrecha de utilidades de solo lectura (ls, cat, grep, find, head, tail, ...). Solo necesitas un archivo de configuración para ampliar o cambiar esa política. Para ejecutar sin restricciones, debes optar explícitamente:

MCP_SHELL_ALLOW_UNSAFE=true mcp-shell   # disables all validation - do not use in production

Para personalizar la política, apunta a un YAML de configuración:

export MCP_SHELL_SEC_CONFIG_FILE=/path/to/security.yaml
mcp-shell

Modo seguro (recomendado) — sin interpretación de shell, solo lista blanca de ejecutables:

security:
  enabled: true
  use_shell_execution: false
  allowed_executables:
    - ls
    - cat
    - grep
    - find
    - echo
  # WARNING: never add shell/language interpreters (bash, sh, python, perl,
  # ruby, node) or alias-capable tools (git) here - the interpreter executes
  # whatever it is handed, bypassing secure mode entirely. mcp-shell warns at
  # startup if it finds one.
  blocked_patterns:          # optional: restrict args on allowed commands
    - '(^|\s)remote\s+(-v|--verbose)(\s|$)'
  max_execution_time: 30s
  max_output_size: 1048576
  working_directory: /tmp/mcp-workspace
  audit_log: true

Modo heredado — ejecución de shell, lista blanca/negra por cadena de comando (vulnerable a inyección si no se tiene cuidado):

security:
  enabled: true
  use_shell_execution: true
  allowed_commands: [ls, cat, grep, echo]
  blocked_patterns: ['rm\s+-rf', 'sudo\s+']
  max_execution_time: 30s
  audit_log: true

Conéctalo

Claude Desktop — añade a tu configuración de MCP:

{
  "mcpServers": {
    "shell": {
      "command": "docker",
      "args": ["run", "--rm", "-i", "sonirico/mcp-shell:latest"],
      "env": { "MCP_SHELL_LOG_LEVEL": "info" }
    }
  }
}

Para una configuración personalizada, monta el archivo y establece la variable de entorno:

{
  "command": "docker",
  "args": ["run", "--rm", "-i", "-v", "/path/to/security.yaml:/etc/mcp-shell/security.yaml", "-e", "MCP_SHELL_SEC_CONFIG_FILE=/etc/mcp-shell/security.yaml", "sonirico/mcp-shell:latest"]
}

API de herramientas

Parámetro

Tipo

Descripción

command

string

Comando de shell a ejecutar (obligatorio)

base64

boolean

Codificar stdout/stderr como base64 (por defecto: false)

La respuesta incluye status, exit_code, stdout, stderr, command, execution_time y security_info opcional.


Variables de entorno

Variable

Descripción

MCP_SHELL_SEC_CONFIG_FILE

Ruta al YAML de seguridad (anula los valores seguros integrados por defecto)

MCP_SHELL_ALLOW_UNSAFE

Establecer true para desactivar toda validación y ejecutar sin restricciones (opt-in)

MCP_SHELL_SERVER_NAME

Nombre del servidor (por defecto: "mcp-shell 🐚")

MCP_SHELL_LOG_LEVEL

debug, info, warn, error, fatal

MCP_SHELL_LOG_FORMAT

json, console

MCP_SHELL_LOG_OUTPUT

stdout, stderr, file


Desarrollo

make install dev-tools   # deps + goimports, golines
make fmt test lint
make docker-build       # build image locally
make release            # binary + docker image

Seguridad

  • Predeterminado: Modo seguro, restringido a una lista blanca estrecha de utilidades de solo lectura. Sin intérpretes.

  • Modo seguro (use_shell_execution: false): el comando se analiza en un AST de shell y solo se acepta un único comando simple totalmente literal (sin tuberías, listas, sustitución, redirección ni globs); su ejecutable debe estar en la lista blanca. Los intérpretes (bash/sh/python) están denegados de forma estricta incluso si están en la lista blanca, y las políticas por herramienta son denegación por defecto: para binarios gobernados (git, find, sort, tar) solo se aceptan banderas explícitamente seguras y todo lo demás, incluidas banderas desconocidas o futuras de escape, se rechaza (git -c/config, find -exec/-fls, sort -o/--compress-program, tar -I/-C). Git se limita a subcomandos de solo lectura. Esta es una capa de rechazo temprano, no un sandbox.

  • Sin restricciones: Solo mediante MCP_SHELL_ALLOW_UNSAFE=true. Acceso completo; está bien para desarrollo local, peligroso en otros casos.

  • Docker: Se ejecuta como no root, basado en Alpine. Úsalo en producción. Idealmente combinado con un sandbox del sistema operativo (sistema de archivos de solo lectura, capacidades eliminadas) como defensa en profundidad.


Contribuciones

Haz un fork, crea una rama, ejecuta make fmt test y abre un PR.

A
license - permissive license
Not graded
quality - not tested
A
maintenance

Maintenance

Maintainers
<1hResponse time
7wRelease cycle
8Releases (12mo)
Commit activity
Issues opened vs closed

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Servers

  • F
    license
    Not graded
    quality
    Not graded
    maintenance
    A secure and pluggable MCP server to run terminal commands on your local machine or cloud server — remotely, safely, and with LLMs or agentic clients.
  • A
    license
    Not graded
    quality
    F
    maintenance
    A secure MCP server for shell operations, terminal management, and process control, enabling AI assistants to safely execute commands and manage interactive sessions.
    143
    5
    MIT
  • A
    license
    Not graded
    quality
    C
    maintenance
    Universal MCP server that wraps any CLI tool, enabling AI assistants to run commands via natural language.
    MIT

View all related MCP servers

Related MCP Connectors

  • Personal assistant MCP server with search, execute, packages, jobs, secrets, and integrations.

  • MCP server for AI dialogue using various LLM models via AceDataCloud

  • MCP server for secureFlows: token-free URL builders and integration-linting tools for AI agents.

View all MCP Connectors

Latest Blog Posts

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/sonirico/mcp-shell'

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