Command Executor

by sunwood-ai-labs

Not rated
GitHub

About

Execute pre-approved shell commands securely on a server.

Details

Author
sunwood-ai-labs
Categories
Developer Tools, Infrastructure, Other, Cloud Service, Security

Setup

Install Command Executor in your MCP client (Claude Desktop, Cursor, Windsurf, and others).

Repository: https://github.com/sunwood-ai-labs/command-executor-mcp-server

Follow the installation instructions in the repository README, then restart your MCP client.

Execute pre-approved shell commands securely on a server.

A Model Context Protocol server for executing pre-approved commands securely.

https://github.com/user-attachments/assets/ed763a12-b685-4e0b-b9a5-bc948a590f51

- Secure command execution with pre-approved command list
- Configurable allowed commands through environment variables
- Built with TypeScript and MCP SDK
- Communication via stdio for seamless integration
- Error handling and security validations
- Real-time command output streaming

By default, the following commands are allowed:

You can customize the allowed commands by setting theALLOWED_COMMANDSenvironment variable:

export ALLOWED_COMMANDS=git,ls,mkdir,python

To use with Claude Desktop, add the server config:

~/Library/Application Support/Claude/claude_desktop_config.json
%APPDATA%/Claude/claude_desktop_config.json
{ "mcpServers": { "command-executor": { "command": "/path/to/command-executor/build/index.js" } } }

The command-executor server implements several security measures:

- Only explicitly allowed commands can be executed
- Default list is restrictive and security-focused
- Commands are validated by prefix to prevent injection

- Command prefix validation prevents command injection
- No shell execution for improved security
- Environment variables are properly sanitized

- Comprehensive error handling for unauthorized commands
- Clear error messages for debugging
- Failed commands don't crash the server

- Server runs in its own environment
- Environment variables can be controlled
- Limited system access

command-executor/ ├─ src/ │ └─ index.ts # Main server implementation ├─ build/ │ └─ index.js # Compiled JavaScript ├─ assets/ │ └─ header.svg # Project header image └─ package.json # Project configuration

Since MCP servers communicate over stdio, debugging can be challenging. We recommend using theMCP Inspector:

The Inspector will provide a URL to access debugging tools in your browser.

- command(string, required): The command to execute

{ "name": "execute_command", "arguments": { "command": "git status" } }
{ "content": [ { "type": "text", "text": "On branch main\nNothing to commit, working tree clean" } ] }
{ "content": [ { "type": "text", "text": "Command execution failed: Command not allowed" } ], "isError": true }

The server provides detailed error messages for various scenarios:

{ "code": "InvalidParams", "message": "Command not allowed: [command]. Allowed commands: git, ls, mkdir, cd, npm, npx, python" }
{ "content": [ { "type": "text", "text": "Command execution failed: [error message]" } ], "isError": true }

- Fork the repository
- Create your feature branch
- Commit your changes
- Push to the branch
- Create a new Pull Request

This project is licensed under the MIT License - see the LICENSE file for details.

This is a web browser that enables your coding agent, such as Claude Code, to visit websites on your behalf and assist you in identifying bugs or creating UI test cases.

A secure MCP server for executing controlled command-line operations with comprehensive security features.

A secure MCP server for executing terminal commands with controlled directory access and command permissions.

A high-performance MCP server for the headless terminal (ht), implemented in Rust.

A secure bridge for LLMs to safely execute command-line tools via the Model Context Protocol (MCP).

Execute shell commands with permission notifications.

Execute pre-configured and secure shell commands via a Go-based MCP server.

Securely execute shell commands with whitelisting, resource limits, and timeout controls for LLMs.

Executes secure shell commands with configurable directory, shell, and timeout validation.

Boost security in your dev lifecycle via SAST, SCA, Secrets & IaC scanning with Cycode.

No reviews yet — be the first

Sign in to leave a review

Use Google, GitHub, or an email account so ratings stay tied to real people.

Email sign in

No reviews posted yet.