Skip to main content
Glama

MCP Shell Server

by mkusaka

Servidor de shell MCP

Un servidor que utiliza el Protocolo de Contexto de Modelo (MCP) para ejecutar comandos de shell. Funciona como un puente que permite a los agentes de IA ejecutar comandos de shell de forma segura.

Características

  • Ejecutar comandos de shell (soporte de una sola línea y de varias líneas)
  • Soporte para varios shells (bash, zsh, fish, powershell, cmd, etc.)
  • Manejo y registro detallado de errores
  • Compatible con MCP Inspector

Instalación

Desde npm (como usuario)

# Using npm npm install -g @mkusaka/mcp-shell-server # Using yarn yarn global add @mkusaka/mcp-shell-server # Using pnpm pnpm add -g @mkusaka/mcp-shell-server

Desde la fuente (para desarrollo)

# Clone the repository git clone https://github.com/mkusaka/mcp-shell-server.git cd mcp-shell-server # Install dependencies pnpm install # Build the project pnpm build

Configuración de MCP

Configuración del cursor

Agregue lo siguiente a su archivo de configuración de Cursor ( ~/.cursor/config.json ):

{ "mcpServers": { "shell": { "command": "npx", "args": ["-y", "@mkusaka/mcp-shell-server"] } } }

Integración de Cline

Cline es una extensión de VS Code que permite usar servidores MCP con Claude AI. Para configurar este servidor de shell MCP con Cline:

  1. Abra el archivo de configuración de Cline MCP:
    • macOS: ~/Library/Application Support/Code/User/globalStorage/saoudrizwan.claude-dev/settings/cline_mcp_settings.json
    • Windows: %APPDATA%/Code/User/globalStorage/saoudrizwan.claude-dev/settings/cline_mcp_settings.json
    • Linux: ~/.config/Code/User/globalStorage/saoudrizwan.claude-dev/settings/cline_mcp_settings.json
  2. Agregue la configuración MCP del servidor shell:
    { "mcpServers": { "shell": { "command": "npx", "args": ["-y", "@mkusaka/mcp-shell-server"], "disabled": false, "autoApprove": [] } } }
    Alternativamente, si desea utilizar un paquete instalado localmente:
    { "mcpServers": { "shell": { "command": "node", "args": ["/path/to/mcp-shell-server/dist/index.js"], "disabled": false, "autoApprove": [] } } }

Configuración de reglas

Añade lo siguiente a las reglas o indicaciones de tu asistente de IA:

You have MCP Shell tools at your disposal. Follow these rules regarding Shell tool usage: 1. ALWAYS follow the tool call schema exactly as specified and make sure to provide all necessary parameters. 2. **NEVER refer to tool names when speaking to me.** For example, instead of saying 'I need to use the shell_exec tool to run this command', just say 'I'll run that command for you'. 3. Only use Shell tools when they are necessary. If my task is general or you already know the answer, just respond without calling tools. 4. When I ask you to execute shell commands, use the appropriate tool to: - Run single-line commands - Run multi-line commands (using heredoc syntax when appropriate) - Execute file operations, git commands, or system utilities - Provide system information when relevant 5. Always be careful with shell commands that might modify the system, and explain what the command will do before executing it. 6. If a shell command produces an error, explain what went wrong in simple terms and suggest ways to fix it.

Uso

Ejecución directa

node dist/index.js # or as an executable ./dist/index.js

Modo de desarrollo

pnpm dev

Pruebas con MCP Inspector

pnpm inspect

Argumentos de la línea de comandos

-s, --shell <shell> Specify the path to the shell to use -w, --working-dir <directory> Specify the working directory for command execution -h, --help Display help message -V, --version Display version information

Referencia de herramientas

shell_exec

Ejecuta comandos en el shell especificado.

Parámetros:

  • command (cadena, obligatorio): el comando de shell a ejecutar
  • workingDir (cadena, opcional): el directorio de trabajo donde ejecutar el comando. Debe estar bajo $HOME.

Referencia de recursos

El servidor proporciona la siguiente información del sistema como recursos:

nombre de host

Devuelve el nombre de host del sistema.

URI: hostname://

plataforma

Devuelve la plataforma del sistema operativo.

URI: platform://

caparazón

Devuelve la ruta del shell que utiliza el servidor.

URI: shell://

nombre de usuario

Devuelve el nombre de usuario actual.

URI: username://

información del sistema

Devuelve información completa del sistema en formato JSON, que incluye:

  • nombre de host
  • plataforma
  • caparazón
  • nombre de usuario
  • Número de CPU
  • Memoria total
  • Memoria libre
  • Tiempo de actividad del sistema

Ejemplos de uso

Ejecución de comandos básicos
{ "name": "shell_exec", "parameters": { "command": "echo Hello, World!" } }
Ejecución de comandos multilínea (Heredoc)
{ "name": "shell_exec", "parameters": { "command": "cat << EOF | grep 'example'\nThis is an example text.\nAnother line without the keyword.\nEOF" } }

Desarrollo

Estructura del proyecto

src/ ├── index.ts # Main entry point └── shell-server/ ├── index.ts # Shell server implementation └── lib/ └── logger.ts # Logging configuration

Explotación florestal

Los registros se escriben en el archivo mcp-shell.log .

Licencia

Instituto Tecnológico de Massachusetts (MIT)

Install Server
A
security – no known vulnerabilities
A
license - permissive license
A
quality - confirmed to work

local-only server

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

Un servidor que utiliza el Protocolo de contexto de modelo (MCP) para permitir que los agentes de IA ejecuten de forma segura comandos de shell en un sistema host.

  1. Características
    1. Instalación
      1. Desde npm (como usuario)
      2. Desde la fuente (para desarrollo)
    2. Configuración de MCP
      1. Configuración del cursor
      2. Integración de Cline
      3. Configuración de reglas
    3. Uso
      1. Ejecución directa
      2. Modo de desarrollo
      3. Pruebas con MCP Inspector
    4. Argumentos de la línea de comandos
      1. Referencia de herramientas
        1. shell\_exec
      2. Referencia de recursos
        1. nombre de host
        2. plataforma
        3. caparazón
        4. nombre de usuario
        5. información del sistema
        6. Ejemplos de uso
      3. Desarrollo
        1. Estructura del proyecto
        2. Explotación florestal
      4. Licencia

        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
        • -
          security
          A
          license
          -
          quality
          A Model Context Protocol (MCP) server that allows AI models to safely access and interact with local file systems, enabling reading file contents, listing directories, and retrieving file metadata.
          Last updated -
          47
          1
          JavaScript
          MIT License
          • Linux
        • -
          security
          A
          license
          -
          quality
          A secure, container-based implementation of the Model Context Protocol (MCP) that provides sandboxed environments for AI systems to safely execute code, run commands, access files, and perform web operations.
          Last updated -
          9
          Python
          Apache 2.0
          • Linux
        • A
          security
          A
          license
          A
          quality
          A server that enables AI assistants to execute terminal commands and retrieve outputs via the Model Context Protocol (MCP).
          Last updated -
          3
          6
          Python
          MIT License
          • Apple
          • Linux

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

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