Shell Command Execution
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.
What is Shell Command Execution?
Shell Command Execution is a Model Context Protocol (MCP) server that allows AI assistants like Claude, Cursor, and VS Code to 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.
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.
This server falls under the Developer Tools category on MCPgee, the world's largest MCP server directory with 33,000+ servers.
Features
- run_command
Use Cases
Maintainer
Works with
Installation
NPM
npx -y mcp-shellManual Installation
npx -y mcp-shellConfiguration
Configuration Details
claude_desktop_config.json
Performance
Response Metrics
Resource Usage
How to Set Up and Use Shell Command Execution
mcp-shell-server is a secure MCP server that allows AI clients to execute shell commands on the host machine, but only commands you explicitly whitelist via the ALLOW_COMMANDS environment variable. It accepts an optional stdin input, a working directory, and a timeout per invocation, and returns stdout, stderr, exit status, and execution time. This makes it safe to give Claude the ability to run specific scripts or CLI tools without exposing the full shell.
Prerequisites
- Python 3.10 or later installed (for uvx/pip installation path)
- Node.js 18+ if using the npx installation path
- An MCP-compatible client such as Claude Desktop
- Knowledge of which shell commands you want to whitelist
Install the server via pip or uvx
The recommended way is to use uvx so the server runs in an isolated environment. Alternatively install globally with pip.
pip install mcp-shell-server
# or use uvx (no install needed):
uvx mcp-shell-serverDecide which commands to whitelist
Set the ALLOW_COMMANDS (or ALLOWED_COMMANDS) environment variable to a comma-separated list of the exact commands you want the AI to be able to run. Commands not in the list will be rejected.
export ALLOW_COMMANDS="ls,cat,pwd,grep,wc,touch,find"Add the server to Claude Desktop configuration
Edit claude_desktop_config.json to register the shell server. Pass your allowlist in the env block so it is set each time the server starts.
Restart Claude Desktop
After saving the config file, fully quit and relaunch Claude Desktop so it picks up the new server entry.
Verify the connection
Ask Claude to run one of your whitelisted commands. You should see the real stdout output returned in Claude's response.
Shell Command Execution Examples
Client configuration
This config registers mcp-shell-server via uvx and whitelists ls, cat, pwd, grep, wc, touch, and find.
{
"mcpServers": {
"shell": {
"command": "uvx",
"args": ["mcp-shell-server"],
"env": {
"ALLOW_COMMANDS": "ls,cat,pwd,grep,wc,touch,find"
}
}
}
}Prompts to try
Use Claude to run whitelisted commands as part of a workflow.
- "List all files in the /tmp directory"
- "Search for the word 'error' in /var/log/app.log"
- "Show me the current working directory and how many lines are in README.md"Troubleshooting Shell Command Execution
Claude returns 'command not allowed' for a command you think is whitelisted
Check for extra spaces in ALLOW_COMMANDS (e.g. 'ls , cat' is accepted but verify the exact command name matches). Also confirm the env block in claude_desktop_config.json is being read — restart Claude Desktop after any change.
Shell operators like && or | are being blocked
mcp-shell-server validates every command segment after |, &&, ||, and ; against the whitelist. Add all commands on both sides of the operator to ALLOW_COMMANDS.
The server fails to start with 'uvx: command not found'
Install uv first: 'curl -LsSf https://astral.sh/uv/install.sh | sh'. Alternatively replace the command with 'python' and args with ['-m', 'mcp_shell_server'] after a pip install.
Frequently Asked Questions about Shell Command Execution
What is Shell Command Execution?
Shell Command Execution is a Model Context Protocol (MCP) server that 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. It connects AI assistants to external tools and data sources through a standardized interface.
How do I install Shell Command Execution?
Install via npm with the command: npx -y mcp-shell. Then add the server configuration to your AI client's JSON config file (e.g., claude_desktop_config.json or .cursor/mcp.json).
Which AI clients work with Shell Command Execution?
Shell Command Execution works with all major MCP-compatible AI clients including Claude Desktop, Claude Code, Cursor, VS Code (GitHub Copilot), Windsurf, and Cline.
Is Shell Command Execution free to use?
Yes, Shell Command Execution is open source and available under the MIT License license. You can use it freely in both personal and commercial projects.
Shell Command Execution Alternatives — Similar Developer Tools Servers
Looking for alternatives to Shell Command Execution? Here are other popular developer tools servers you can use with Claude, Cursor, and VS Code.
Ecc
★ 188.2kThe agent harness performance optimization system. Skills, instincts, memory, security, and research-first development for Claude Code, Codex, Opencode, Cursor and beyond.
Javaguide
★ 155.8kJava 面试 & 后端通用面试指南,覆盖计算机基础、数据库、分布式、高并发、系统设计与 AI 应用开发
Gemini CLI
★ 104.5kA secure MCP server that wraps the Google Gemini CLI, allowing clients to query Gemini models using local OAuth sessions without requiring an API key. It provides tools for model interaction and diagnostics with built-in protection against command in
Awesome MCP Servers
★ 87.3k⭐ Curated list of Model Context Protocol (MCP) servers - tools that extend Claude Desktop, Cursor, Windsurf, and other MCP clients with custom capabilities.
MCP Servers
★ 86.0kModel Context Protocol Servers
CC Switch
★ 77.5kA cross-platform desktop All-in-One assistant for Claude Code, Codex, OpenCode, OpenClaw, Gemini CLI & Hermes Agent. Only official website: ccswitch.io
Browse More Developer Tools MCP Servers
Explore all developer tools servers available in the MCPgee directory. Each server includes setup guides for Claude, Cursor, and VS Code.
Set Up Shell Command Execution in Your Editor
Choose your AI client for step-by-step setup instructions.
Quick Config Preview
Add this to your claude_desktop_config.json or .cursor/mcp.json
Ready to use Shell Command Execution?
Browse our complete directory of 33,000+ MCP servers, read setup guides for your editor, and start building with the Model Context Protocol.