Shell Command Execution

v1.0.0Developer Toolsstable

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.

aibashgollmmcp
Share:
174
Stars
0
Downloads
0
Weekly
0/5

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

Execute whitelisted shell commands
Secure remote execution
Standard input support
tumf

Maintainer

LicenseMIT License
Languagepython
Versionv1.0.0
UpdatedMay 11, 2026
Statushealthy
Maintenanceactive

Works with

ClaudeOpenAIwindowsmacoslinux

Installation

NPM

npx -y mcp-shell

Manual Installation

npx -y mcp-shell

Configuration

Configuration Details

Config File

claude_desktop_config.json

Performance

Response Metrics

Response Time< 200ms
ThroughputMedium

Resource Usage

Memory UsageLow
CPU UsageLow

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
1

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-server
2

Decide 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"
3

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.

4

Restart Claude Desktop

After saving the config file, fully quit and relaunch Claude Desktop so it picks up the new server entry.

5

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.

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.

Quick Config Preview

{ "mcpServers": { "mcp-shell": { "command": "npx", "args": ["-y", "mcp-shell"] } } }

Add this to your claude_desktop_config.json or .cursor/mcp.json

Read the full setup guide →

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.

33,000+ ServersFree & Open SourceStep-by-Step Guides