Skip to main content
Glama
mkusaka
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

Related MCP server: Command Executor MCP Server

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)

Available Tools

1 tool
shell_execC

Executes commands in the specified shell with detailed error handling and output capture

ParametersJSON Schema
NameRequiredDescriptionDefault
commandYesThe shell command to execute in the configured shell environment
workingDirNoOptional working directory to execute the command in (must be under $HOME for security)

TDQS

C2.9/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It mentions 'detailed error handling and output capture' which adds some context beyond basic execution, but fails to address critical aspects like security implications, permission requirements, rate limits, or what happens when commands fail. For a shell execution tool with zero annotation coverage, this leaves significant gaps.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that front-loads the core purpose ('Executes commands in the specified shell') and adds value with secondary capabilities ('with detailed error handling and output capture'). Every word earns its place with zero waste.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the complexity of shell execution (security risks, variable outputs) and the absence of both annotations and an output schema, the description is insufficient. It doesn't explain return values, error formats, or security constraints beyond the schema's workingDir note. For a potentially dangerous tool with no structured safety indicators, more descriptive context is needed.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema already documents both parameters thoroughly. The description adds no additional parameter semantics beyond what's in the schema (e.g., no examples of command syntax, working directory constraints beyond security). The baseline score of 3 reflects adequate schema coverage without description enhancement.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose: 'Executes commands in the specified shell' with additional capabilities for 'detailed error handling and output capture'. It uses specific verbs ('executes', 'capture') and identifies the resource ('shell commands'). However, there are no sibling tools mentioned, so differentiation from alternatives cannot be evaluated.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives, prerequisites, or security considerations. It mentions 'detailed error handling and output capture' which implies some context, but offers no explicit when/when-not instructions or named alternatives.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections. Dates show when Glama detected each change.

  1. 1 tool updatev1.0.0
    • First observedshell_exec

TDQS

B3.1/5.0
Disambiguation5/5

With only one tool, there is no possibility of ambiguity or overlap between tools. The tool's purpose is clearly defined and distinct by default.

Naming Consistency5/5

A single tool inherently has perfect naming consistency, as there are no other tools to compare against. The name 'shell_exec' follows a clear verb_noun pattern.

Tool Count2/5

A single tool is generally too few for a server's purpose, as it limits functionality and may indicate an incomplete surface. However, for a simple shell execution server, it could be minimally viable but lacks breadth.

Completeness2/5

The tool provides basic shell command execution, but there are obvious gaps such as no tools for listing available commands, managing shell sessions, or handling file operations, making the surface severely incomplete for typical shell-related tasks.

Maintenance

ActivityInactive
ResponsivenessNo issues

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

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

Related MCP Connectors

Related MCP Servers

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

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