Skip to main content
MCP server CX Codex

MCP stdio ShellGuard — Claude Code MCP server: shell-injection defence

Adds an allowlist, sandbox limits and replay detection around shell calls in MCP servers, plus a CLI that audits source files for risky patterns.

Install into Claude Code · Platform CLI All methods and platforms ↓
claude mcp add stdio-shellguard -- npx -y mcp-stdio-shellguard
Open on GitHub

What MCP stdio ShellGuard does

MCP stdio ShellGuard targets the attack class where an MCP server passes raw user input into a shell command. It ships as three layers you can adopt one at a time.

The library layer gives you guardExec and guardSpawn as replacements for child_process calls. Nothing runs until you register a tool with AllowlistRegistry, naming the executable and the argument patterns it accepts. Sandbox profiles cap runtime, output size and file descriptors; a replay window flags the same invocation twice. You can tighten limits per call, never loosen them past the profile.

The audit CLI mcp-shellguard-audit scan <path> parses the AST and reports 12 rule hits, from a missing timeout to input interpolated straight into exec. Exit code 1 means findings, which makes it usable as a CI gate. Node.js 20 or newer and @modelcontextprotocol/sdk ^1.29.0 are required, so an older runtime won't start the server at all.

What it helps with

  • find template literals that pipe user input into exec
  • block commands outside a registered tool list
  • cap runtime and output size of spawned processes
  • spot the same command invoked twice
  • gate a CI pipeline on shell-call audit findings

Example prompts for the agent

  • Scan ./src for shell-injection patterns and return the report as markdown
  • Register a git-log tool for /usr/bin/git that only accepts log --oneline -n
  • Check whether this command with this hash already ran in the replay window

How to install MCP stdio ShellGuard

Platform CLI

claude mcp add stdio-shellguard -- npx -y mcp-stdio-shellguard

Step by step, with commands for each platform: How to add an MCP server to Claude Code, Codex, Cursor, VS Code, Gemini CLI and more

Questions about MCP stdio ShellGuard

How to install MCP stdio ShellGuard in Claude Code?

Run claude mcp add stdio-shellguard -- npx -y mcp-stdio-shellguard.

What does MCP stdio ShellGuard do?

It wraps shell calls with an allowlist, sandbox profiles and replay tracking, and provides a CLI that audits MCP server sources for injection risks.

Which Node.js version does it need?

Node.js 20 or newer, along with @modelcontextprotocol/sdk ^1.29.0.

Similar MCP servers

All MCP servers for Security →

Project sponsors

Companies that keep this analytics open
Gold sponsor

Impressions, clicks and code copies — open statistics. We keep the numbers public for the same reason NeBlask itself is public. Become a sponsor