Shell MCP Server

MCP server for safe shell command execution.

README.md

Shell MCP Server

MCP (Model Context Protocol) server for safe shell command execution.

Features

  • 🔒 Security - Restricted to workspace directory
  • ⏱️ Timeout enforcement - Prevents hanging commands
  • 📝 Command history - Track all executed commands
  • 📦 Environment isolation - Controlled env vars
  • 📊 Output limits - Prevent memory issues

Tools

execute

Execute a shell command with safety controls.

{
  "command": "ls -la",
  "cwd": "/root/.openclaw/workspace",
  "timeout": 30000,
  "env": { "MY_VAR": "value" }
}

Parameters:

  • command (required) - Command to execute
  • cwd - Working directory (default: /root/.openclaw/workspace)
  • timeout - Timeout in ms (default: 30000, max: 120000)
  • env - Environment variables object

history

Get command execution history.

{
  "limit": 50
}

clearHistory

Clear command history.

{}

Usage

Direct

cd /root/.openclaw/workspace/shell-mcp-server
npm start

With MCP config (mcporter)

{
  "type": "stdio",
  "command": "node",
  "args": ["/root/.openclaw/workspace/shell-mcp-server/index.js"]
}

With Claude Code CLI

claude --mcp-config shell-mcp-server.json

Install

cd /root/.openclaw/workspace/shell-mcp-server
npm install

Test

npm test

Security Notes

  • Commands are restricted to /root/.openclaw/workspace and subdirectories
  • Output is limited to 1MB per command
  • Maximum timeout is 2 minutes
  • History is saved to .shell-history.json

Tools 3

executeExecute a shell command with safety controls.
historyGet command execution history.
clearHistoryClear command history.

Try it

List all files in the current directory to see what I'm working with.
Run a grep search for 'TODO' in the current workspace directory.
Show me the last 10 commands I executed using the shell server.
Clear my command execution history.

Frequently Asked Questions

What are the key features of Shell MCP Server?

Restricted access to workspace directory for security. Timeout enforcement to prevent hanging commands. Command history tracking and management. Controlled environment variable isolation. Output size limits to prevent memory issues.

What can I use Shell MCP Server for?

Automating file system operations within a restricted project folder. Running build scripts or tests directly from the Claude interface. Auditing command execution history for development workflows. Safely executing shell commands without risking system-wide access.

How do I install Shell MCP Server?

Install Shell MCP Server by running: cd /root/.openclaw/workspace/shell-mcp-server && npm install

What MCP clients work with Shell MCP Server?

Shell MCP Server works with any MCP-compatible client including Claude Desktop, Claude Code, Cursor, and other editors with MCP support.

Turn this server into reusable context

Keep Shell MCP Server docs, env vars, and workflow notes in Conare so your agent carries them across sessions.

Open Conare