Shell Executor
Execute shell commands safely on a remote server.
Shell Executor MCP Server
A Model Context Protocol (MCP) server that provides safe shell command execution capabilities for AI agents and tools like VS Code Copilot.
Features
- Safe Command Execution: Whitelist-based command filtering
- Comprehensive Tool Set: Support for file operations, text processing, development tools, and system utilities
- MCP Compatible: Full Model Context Protocol support
- Easy Integration: Simple JSON-RPC interface over stdio
Installation
Option 1: Direct Usage
git clone https://github.com/yourusername/shell-executor-mcp.git
cd shell-executor-mcp
pip install -e .
Option 2: Install from PyPI (when published)
pip install shell-executor-mcp
VS Code Integration
1. Global Configuration
Add to your VS Code settings.json or MCP configuration:
{
"mcpServers": {
"shell-executor": {
"command": "python",
"args": ["/path/to/shell-executor-mcp/src/mcp_server.py"],
"env": {
"MCP_API_TOKEN": "your-secret-token"
}
}
}
}
2. Workspace Configuration
Create .vscode/mcp_servers.json in your workspace:
{
"shell-executor": {
"command": "python",
"args": ["${workspaceFolder}/path/to/mcp_server.py"],
"env": {
"MCP_API_TOKEN": "your-secret-token"
}
}
}
3. Using with VS Code Copilot
Once configured, Copilot can discover and use the shell executor through MCP:
@shell-executor execute ls -la
@shell-executor execute git status
@shell-executor execute cargo build
Manual Testing
Start the server:
python src/mcp_server.py
Send test requests:
- Initialize:
{"jsonrpc": "2.0", "id": 1, "method": "initialize", "params": {"protocolVersion": "2024-11-05", "capabilities": {}, "clientInfo": {"name": "test", "version": "1.0.0"}}}
- List tools:
{"jsonrpc": "2.0", "id": 2, "method": "tools/list", "params": {}}
- Execute command:
{"jsonrpc": "2.0", "id": 3, "method": "tools/call", "params": {"name": "execute_command", "arguments": {"command": "echo", "args": ["Hello World"]}}}
Supported Commands
File System
ls,cat,head,tail,find,tree,wc,du,dffile,stat,pwd
Text Processing
grep,sed,awk,sort,uniq,cut,tr
Development
git,npm,yarn,pip,python,node,cargo,makerustc,go,java,javac
System Info
ps,uptime,whoami,id,uname,which
Network
curl,wget,ping,dig,nslookup
Archives
tar,zip,unzip,gzip,gunzip
Utilities
echo,date,cal,bc,expr,basename,dirname- Hash tools:
md5,sha256sum,shasum
Security
- Commands are filtered through a whitelist
- 30-second execution timeout
- No destructive operations (rm, mv, cp) allowed
- No privilege escalation (sudo, su) allowed
- Environment variables can be controlled
Configuration
Set environment variables:
MCP_API_TOKEN: Authentication token (default: "MYSECRET")
License
MIT License - see LICENSE file for details.
Related Servers
Scout Monitoring MCP
sponsorPut performance and error data directly in the hands of your AI assistant.
Alpha Vantage MCP Server
sponsorAccess financial market data: realtime & historical stock, ETF, options, forex, crypto, commodities, fundamentals, technical indicators, & more
Bazel MCP Server
Exposes the Bazel build system to AI agents, enabling them to build, query, test, and manage dependencies.
ComfyUI MCP Server
An image generation server that connects to a local ComfyUI instance via its API, supporting dynamic workflows.
Flowise
Integrate with the Flowise API to create predictions and manage chatflows and assistants.
MCP All Servers
A collection of reference implementations for the Model Context Protocol (MCP), showcasing servers built with TypeScript and Python SDKs.
MCP VSCode Cline
A guide for using the Cline VSCode extension to interact with Model Context Protocol (MCP) servers.
DevRev MCP Server
Access DevRev's APIs to manage work items, parts, search, and user information.
MCP Neurolora
An intelligent server for code analysis, collection, and documentation generation using the OpenAI API.
Binary Ninja
A Binary Ninja plugin, MCP server, and bridge that seamlessly integrates Binary Ninja with your favorite MCP client.
Clix MCP Server
Clix MCP Server for assisting Clix SDK/API integrations with semantic search across Clix docs and SDK source (iOS, Android, Flutter, React Native).
PackageLens MCP
Lets your coding agent (such as Claude, Cursor, Copilot, Gemini or Codex) search package registries across multiple ecosystems (npm, PyPI, RubyGems, Crates.io, Packagist, Hex) and fetch package context (README, downloads, GitHub info, usage snippets)