command-executor-mcp-server
Model Context Protocol Server for Safely Executing Pre-approved Commands
Documentation
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:
npm installBuild the server:
npm run buildFor development with auto-rebuild:
npm run watchโ๏ธ 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:
export ALLOWED_COMMANDS=git,ls,mkdir,python๐ Claude Desktop Integration
To use with Claude Desktop, add the server config:
On MacOS:
~/Library/Application Support/Claude/claude_desktop_config.jsonOn Windows:
%APPDATA%/Claude/claude_desktop_config.jsonConfiguration example:
{
"mcpServers": {
"command-executor": {
"command": "/path/to/command-executor/build/index.js"
}
}
}๐ก๏ธ Security Considerations
The command-executor server implements several security measures:
1. Pre-approved Command List
2. Command Validation
3. Error Handling
4. Environment Isolation
๐ป Development
๐ Project Structure
command-executor/
โโ src/
โ โโ index.ts # Main server implementation
โโ build/
โ โโ index.js # Compiled JavaScript
โโ assets/
โ โโ header.svg # Project header image
โโ package.json # Project configuration๐ Debugging
Since MCP servers communicate over stdio, debugging can be challenging. We recommend using the MCP Inspector:
npm run inspectorThe 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:
{
"name": "execute_command",
"arguments": {
"command": "git status"
}
}Example Response:
{
"content": [
{
"type": "text",
"text": "On branch main\nNothing to commit, working tree clean"
}
]
}Error Response:
{
"content": [
{
"type": "text",
"text": "Command execution failed: Command not allowed"
}
],
"isError": true
}โ Error Handling
The server provides detailed error messages for various scenarios:
1. Unauthorized Commands
{
"code": "InvalidParams",
"message": "Command not allowed: [command]. Allowed commands: git, ls, mkdir, cd, npm, npx, python"
}2. Execution Failures
{
"content": [
{
"type": "text",
"text": "Command execution failed: [error message]"
}
],
"isError": true
}๐ค Contributing
1. Fork the repository
2. Create your feature branch
3. Commit your changes
4. Push to the branch
5. Create a new Pull Request
๐ License
This project is licensed under the MIT License - see the LICENSE file for details.
Frequently asked questions
What is command-executor-mcp-server?
command-executor-mcp-server is Model Context Protocol Server for Safely Executing Pre-approved Commands
How do I install command-executor-mcp-server?
Open the GitHub repository and follow its README. Most MCP servers are added to your client's MCP config, then called by your agent.
Is command-executor-mcp-server open source?
Yes โ it is hosted on GitHub at https://github.com/Sunwood-ai-labs/command-executor-mcp-server and has 21 stars.
Related MCP tools
The all-in-one Desktop & Docker AI application with built-in RAG, AI agents, No-code agent builder, MCP compatibility, and more.
An AI-powered task-management system you can drop into Cursor, Lovable, Windsurf, Roo, and others. Built for the Model Context Protocol to enhance AI capabiliti
Fayๆฏไธไธชๅธฎๅฉๆฐๅญไบบ๏ผ2.5dใ3dใ็งปๅจใpcใ็ฝ้กต๏ผๆๅคง่ฏญ่จๆจกๅ๏ผopenaiๅ ผๅฎนใdeepseek๏ผ่ฟ้ไธๅก็ณป็ป็mcpๆกๆถใ JavaScript-based implementation. Trusted by 12000+ developers.
CTTF: MCP integration between Cursor and Figma, allowing Cursor Agentic AI to communicate with Figma for reading designs and modifying them programmatically.
๐ฅ Official Firecrawl MCP Server - Adds powerful web scraping and search to Cursor, Claude and any other LLM clients. JavaScript-based implementation.
This is MCP server for Claude that gives it terminal control, file system search and diff file editing capabilities JavaScript-based implementation.
Run your own MCP server? See who uses it and what to fix.
Measure it with TrackMCP