MCP Shell Server
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-serverDesde 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 buildConfiguració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:
Abra el archivo de configuración de Cline MCP:
macOS:
~/Library/Application Support/Code/User/globalStorage/saoudrizwan.claude-dev/settings/cline_mcp_settings.jsonWindows:
%APPDATA%/Code/User/globalStorage/saoudrizwan.claude-dev/settings/cline_mcp_settings.jsonLinux:
~/.config/Code/User/globalStorage/saoudrizwan.claude-dev/settings/cline_mcp_settings.json
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.jsModo de desarrollo
pnpm devPruebas con MCP Inspector
pnpm inspectArgumentos 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 informationReferencia de herramientas
shell_exec
Ejecuta comandos en el shell especificado.
Parámetros:
command(cadena, obligatorio): el comando de shell a ejecutarworkingDir(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 configurationExplotación florestal
Los registros se escriben en el archivo mcp-shell.log .
Licencia
Instituto Tecnológico de Massachusetts (MIT)
Available Tools
1 toolshell_execC
Executes commands in the specified shell with detailed error handling and output capture
Inputs: command (required), workingDir.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 1 tool
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.
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.
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.
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
Related MCP Connectors
Remote MCP server exposing your Node Command fleet (files, shell, processes, browser) to AI hosts.
MCP server for building and testing AI agents with multi-model experimentation and insights.
A comprehensive Model Context Protocol (MCP) server that enables AI assistants to interact with yo…
An MCP server that provides agents access to the KeldynAI platform
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceA Model Context Protocol server that allows LLMs to execute shell commands and receive their output in a controlled manner.7MIT
- FlicenseBqualityDmaintenanceA Model Context Protocol server that allows secure execution of pre-approved commands, enabling AI assistants to safely interact with the user's system.122-
- AlicenseCqualityDmaintenanceA server that enables AI assistants to execute terminal commands and retrieve outputs via the Model Context Protocol (MCP).326MIT
- AlicenseCqualityDmaintenanceA secure server that implements the Model Context Protocol (MCP) to enable controlled execution of authorized shell commands with stdin support.1MIT