command-executor MCP Server
A Model Context Protocol server for executing pre-approved commands securely.
🎥 Demo
https://github.com/user-attachments/assets/ed763a12-b685-4e0b-b9a5-bc948a590f51
✨ Features
- 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
🚀 Installation
Install dependencies:
Build the server:
For development with auto-rebuild:
⚙️ Configuration
🔒 Allowed Commands
By default, the following commands are allowed:
- git
- ls
- mkdir
- cd
- npm
- npx
- python
You can customize the allowed commands by setting the ALLOWED_COMMANDS
environment variable:
🔌 Claude Desktop Integration
To use with Claude Desktop, add the server config:
On MacOS:
On Windows:
Configuration example:
🛡️ Security Considerations
The command-executor server implements several security measures:
- Pre-approved Command List
- Only explicitly allowed commands can be executed
- Default list is restrictive and security-focused
- Commands are validated by prefix to prevent injection
- Command Validation
- Command prefix validation prevents command injection
- No shell execution for improved security
- Environment variables are properly sanitized
- Error Handling
- Comprehensive error handling for unauthorized commands
- Clear error messages for debugging
- Failed commands don't crash the server
- Environment Isolation
- Server runs in its own environment
- Environment variables can be controlled
- Limited system access
💻 Development
📁 Project Structure
🐛 Debugging
Since MCP servers communicate over stdio, debugging can be challenging. We recommend using the MCP Inspector:
The Inspector will provide a URL to access debugging tools in your browser.
🛠️ Tool API
The server provides a single tool:
execute_command
Executes a pre-approved command.
Parameters:
command
(string, required): The command to execute
Example Request:
Example Response:
Error Response:
❌ Error Handling
The server provides detailed error messages for various scenarios:
- Unauthorized Commands
- Execution Failures
🤝 Contributing
- Fork the repository
- Create your feature branch
- Commit your changes
- Push to the branch
- Create a new Pull Request
📄 License
This project is licensed under the MIT License - see the LICENSE file for details.
Un servidor de protocolo de contexto de modelo que permite la ejecución segura de comandos previamente aprobados, lo que permite que los asistentes de IA interactúen de forma segura con el sistema del usuario.
- 🎥 Demostración
- ✨ Características
- 🚀 Instalación
- ⚙️ Configuración
- 🛡️ Consideraciones de seguridad
- 💻 Desarrollo
- 🛠️ API de herramientas
- ❌ Manejo de errores
- 🤝 Contribuyendo
- 📄 Licencia
Related Resources
Related MCP Servers
- -securityFlicense-qualityA comprehensive Model Context Protocol server implementation that enables AI assistants to interact with file systems, databases, GitHub repositories, web resources, and system tools while maintaining security and control.Last updated -71
- AsecurityAlicenseAqualityA secure Model Context Protocol server that allows AI models to safely interact with Windows command-line functionality, enabling controlled execution of system commands, project creation, and system information retrieval.Last updated -86MIT License
- -securityFlicense-qualityA Model Context Protocol server that provides secure curl command execution capabilities, allowing AI assistants to make HTTP requests with configurable parameters and built-in security protections.Last updated -1
- AsecurityAlicenseAqualityA Model Context Protocol server that enables AI assistants to communicate with each other using Inter-Process Communication, featuring natural language commands and cross-platform compatibility.Last updated -989MIT License