mcp-shell
mcp-shell
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:latestDesde el código fuente:
git clone https://github.com/sonirico/mcp-shell && cd mcp-shell
make install
mcp-shellRelated 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 productionPara personalizar la política, apunta a un YAML de configuración:
export MCP_SHELL_SEC_CONFIG_FILE=/path/to/security.yaml
mcp-shellModo 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: trueModo 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: trueConé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 |
| string | Comando de shell a ejecutar (obligatorio) |
| 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 |
| Ruta al YAML de seguridad (anula los valores seguros integrados por defecto) |
| Establecer |
| Nombre del servidor (por defecto: "mcp-shell 🐚") |
| debug, info, warn, error, fatal |
| json, console |
| 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 imageSeguridad
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.
This server cannot be installed
Maintenance
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
- FlicenseNot gradedqualityNot gradedmaintenanceA secure and pluggable MCP server to run terminal commands on your local machine or cloud server — remotely, safely, and with LLMs or agentic clients.
- AlicenseNot gradedqualityFmaintenanceA secure MCP server for shell operations, terminal management, and process control, enabling AI assistants to safely execute commands and manage interactive sessions.1435MIT
- AlicenseNot gradedqualityCmaintenanceUniversal MCP server that wraps any CLI tool, enabling AI assistants to run commands via natural language.MIT
- AlicenseAqualityBmaintenanceAn MCP server that enables AI clients to execute shell, Python, and Node commands on the local machine across platforms.31MIT
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.
Appeared in Searches
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
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