tumf/mcp-shell-server

View on GitHub ↗

Secure MCP server for whitelisted shell command execution with stdin, argv pipelines, timeouts, and structured audit logging.

186 ★47 forksPythonUpdated 20d ago

What you need to know

Secure shell command execution MCP server that runs only whitelisted commands with stdin support and hardened argument validation

Install

pip install mcp-shell-server

Usage

  • Set ALLOW_COMMANDS="ls,cat,echo" and run uvx mcp-shell-server
  • Call the shell tool with command, stdin, directory, and timeout arguments

Key features

  • Argv-based command execution without shell-string interpretation
  • Standard input support and comprehensive stdout/stderr/status/time output
  • Safe pipeline support preserving argv segments
  • Server-side timeout and output byte caps
  • Contained redirection and a minimal child environment
  • Structured audit logging with secret redaction

Best for

Letting AI agents run a controlled set of shell commands

Caveats

  • Allowlist is not a full sandbox - run inside an OS/container sandbox for hostile workloads
  • Default argument hardening rejects exec-capable vectors like find -exec and git config overrides
Platforms: Linux · macOS · WindowsClients: Claude · Any MCP client

Reviewed 2026-08-11

Topics

audit-logcommand-whitelistmcpmodel-context-protocolsecurityshell
Stars
186★
Forks
47
Language
Python
License
MIT
Created
2024-12-10
Last push
2026-08-15