- Shell Execution MCP Server
Shell Execution MCP Server
Shell Execution MCP Server for Claude and other MCP-compatible AI assistants
Content
Shell Execution MCP Server
A Model Context Protocol (MCP) server that provides persistent shell command execution capabilities for Claude and other MCP-compatible AI assistants.
Features
- Persistent Shell Session: Maintains state between commands in the same session
- Background Execution: Run commands in the background with proper process management
- Cross-Platform: Works on macOS, Linux, and Windows with the appropriate shell
- Timeout Control: Configure command execution timeouts to prevent hanging
- Session Reset: Ability to reset the shell session if needed
Installation
# Clone the repository
git clone https://github.com/samihalawa/mcp-server-shell-exec.git
cd mcp-server-shell-exec
# Install dependencies
npm install
# Build the server
npm run build
Usage
Starting the Server
npm start
Configuration
Add the server to your MCP configuration:
{
"servers": {
"shell-exec-server": {
"command": "/path/to/node",
"args": ["/path/to/mcp-server-shell-exec/build/index.js"],
"enabled": true,
"port": 3006,
"environment": {
"NODE_PATH": "/path/to/node_modules",
"PATH": "/usr/local/bin:/usr/bin:/bin"
}
}
}
}
Available Tools
execute-command
Execute a shell command in the persistent shell session.
Parameters:
command(string, required): The shell command to executerunInBackground(boolean, optional): Whether to run the command in the background. Default: falsetimeoutMs(number, optional): Timeout in milliseconds for the command. Default: 30000
Returns:
success(boolean): Whether the command executed successfullyoutput(string): Output from the command execution
reset-shell
Reset the shell session. This will kill the current session and start a new one.
Parameters: None
Returns:
success(boolean): Whether the shell was reset successfullymessage(string): Status message
Example Usage
-
Execute a simple command:
execute-command(command: "ls -la") -
Run a long-running command in the background:
execute-command(command: "sleep 60 && echo 'Done'", runInBackground: true) -
Execute a command with a custom timeout:
execute-command(command: "find / -name '*.js'", timeoutMs: 60000) -
Reset the shell session:
reset-shell()
How It Works
The server uses Node.js's node-pty package to create a pseudo-terminal that maintains state between commands. This allows for:
- Environment variables to persist between commands
- Working directory to remain consistent
- Background processes to continue running
- Interactive commands that require stdin/stdout
Requirements
- Node.js 14+
- node-pty package
- Compatible with Claude Desktop, Cursor, and other MCP-compatible applications
License
MIT
Recommend Servers
TraeBuild with Free GPT-4.1 & Claude 3.7. Fully MCP-Ready.
TimeA Model Context Protocol server that provides time and timezone conversion capabilities. This server enables LLMs to get current time information and perform timezone conversions using IANA timezone names, with automatic system timezone detection.
Serper MCP ServerA Serper MCP Server
WindsurfThe new purpose-built IDE to harness magic
AiimagemultistyleA Model Context Protocol (MCP) server for image generation and manipulation using fal.ai's Stable Diffusion model.
Howtocook Mcp基于Anduin2017 / HowToCook (程序员在家做饭指南)的mcp server,帮你推荐菜谱、规划膳食,解决“今天吃什么“的世纪难题;
Based on Anduin2017/HowToCook (Programmer's Guide to Cooking at Home), MCP Server helps you recommend recipes, plan meals, and solve the century old problem of "what to eat today"
Y GuiA web-based graphical interface for AI chat interactions with support for multiple AI models and MCP (Model Context Protocol) servers.
MCP AdvisorMCP Advisor & Installation - Use the right MCP server for your needs
DeepChatYour AI Partner on Desktop
BlenderBlenderMCP connects Blender to Claude AI through the Model Context Protocol (MCP), allowing Claude to directly interact with and control Blender. This integration enables prompt assisted 3D modeling, scene creation, and manipulation.
MiniMax MCPOfficial MiniMax Model Context Protocol (MCP) server that enables interaction with powerful Text to Speech, image generation and video generation APIs.
CursorThe AI Code Editor
Tavily Mcp
Zhipu Web SearchZhipu Web Search MCP Server is a search engine specifically designed for large models. It integrates four search engines, allowing users to flexibly compare and switch between them. Building upon the web crawling and ranking capabilities of traditional search engines, it enhances intent recognition capabilities, returning results more suitable for large model processing (such as webpage titles, URLs, summaries, site names, site icons, etc.). This helps AI applications achieve "dynamic knowledge acquisition" and "precise scenario adaptation" capabilities.
Playwright McpPlaywright MCP server
Jina AI MCP ToolsA Model Context Protocol (MCP) server that integrates with Jina AI Search Foundation APIs.
EdgeOne Pages MCPAn MCP service designed for deploying HTML content to EdgeOne Pages and obtaining an accessible public URL.
Amap Maps高德地图官方 MCP Server
ChatWiseThe second fastest AI chatbot™
Visual Studio Code - Open Source ("Code - OSS")Visual Studio Code
Baidu Map百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。