Secure Command Executor MCP Server
LocalAbout Secure Command Executor MCP Server
A command execution MCP server for teams that need to define and operate system commands with safety checks and audit logs. Commands can be managed from a configuration file or through management operations.
Key features
- 01Run configured system commands
- 02Confirm potentially dangerous commands
- 03Add, update, enable, or remove commands
- 04Daily log rotation and action tracking
- 05Filter command and log queries
Use cases
- 01Run approved system commands through an MCP client
- 02Require confirmation before dangerous operations
- 03Review command history and failures
- 04Update the available command set
MCP support
Exposes command execution, command management, and query operations to MCP clients. Dangerous commands can require confirmation.
Configuration
Local server config is the same for every client. Copy it into your client’s MCP config file.
We haven’t collected a package or remote endpoint for this server. Follow the instructions in the project README.
Tools
Local servers expose tools only once running on your machine, and the maintainer has not provided a tool list.
Details
From the project READMESecure Command Executor MCP Server
A robust command execution MCP service with daily log rotation, designed to securely manage and execute system commands with safety checks and logging. And this README.md is written by DeepSeek V3.
Features
- Command Execution: Execute system commands with optional arguments.
- Safety Checks: Warns and requires confirmation for dangerous commands.
- Command Management: Add, update, remove, enable, or disable commands.
- Logging: Daily log rotation with detailed action tracking.
- Query Tools: Query available commands and logs with filters.
Installation
-
Clone the repository:
git clone https://github.com/HappyAny/secure-command-executor-mcp-server.git cd secure-command-executor-mcp-server -
Install dependencies:
npm install minimist npm install @modelcontextprotocol/sdk npm install zod -
Configure the service:
- Modify
commands.jsonto define available commands. - Set environment variables (optional).
- Modify
Usage
Starting the Service
node index.js --file commands.json --logs logs --port 3000
MCP Setting
{
"mcpServers": {
"cmd-exec": {
"command": "node",
"args": [
"path_to_file/index.js",
"--file",
"path_to_file/commands.json",
"--logs",
"path_to_dict/logs"
]
}
}
}
Commands File
The commands.json file defines the available commands. Example:
[
{
"name": "dir",
"description": "List directory contents",
"example": "dir /w",
"dangerous": false,
"enabled": true,
"confirmationPrompt": "",
"consequences": ""
},
{
"name": "format",
"description": "Format disk drive",
"example": "format C:",
"dangerous": true,
"enabled": false,
"confirmationPrompt": "This will PERMANENTLY erase all data. Confirm?",
"consequences": "Permanent data loss"
}
]
API Endpoints
Execute a Command
curl -X POST http://localhost:3000/execute -H "Content-Type: application/json" -d '{"command": "dir", "args": "/w"}'
Query Commands
curl -X GET http://localhost:3000/queryCommands?filter=enabled&detailed=true
Manage Commands
curl -X POST http://localhost:3000/manageCommand -H "Content-Type: application/json" -d '{"action": "add", "name": "ping", "description": "Test network connection", "example": "ping example.com"}'
Query Logs
curl -X GET http://localhost:3000/queryLogs?limit=50&filter=failed
Configuration
-
Environment Variables:
NODE_ENV: Set toproductionfor production mode.PORT: Override the default port (3000).
-
Command-Line Arguments:
--file: Path to the commands file (default:commands.json).--logs: Path to the logs directory (default:logs).--port: Port to run the service (default: 3000).
Logging
Logs are stored in the specified directory with daily rotation. Each log file is named YYYY-MM-DD.json.
Contributing
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
License
Comments
New to MCP?
From what the protocol is to installing your first server, these answers cover most first questions.
An open protocol that defines how AI applications connect to external tools and data in a uniform way. Clients talk to the model; MCP servers provide tools, resources and prompt templates. They exchange standard messages, so one server can be reused by many clients.