Track MCP LogoTrack MCP
Track MCP LogoTrack MCP

The world's largest repository of Model Context Protocol servers. Discover, explore, and submit MCP tools.

Product

  • Categories
  • Top MCP
  • New & Updated
  • Submit MCP

Company

  • About

Legal

  • Privacy Policy
  • Terms of Service
  • Cookie Policy

© 2026 TrackMCP. All rights reserved.

Built with ❤️ by Krishna Goyal

    Command Executor Mcp Server

    Model Context Protocol Server for Safely Executing Pre-approved Commands

    21 stars
    JavaScript
    Updated Aug 19, 2025

    Table of Contents

    • 🎥 Demo
    • ✨ Features
    • 🚀 Installation
    • ⚙️ Configuration
    • 🔒 Allowed Commands
    • 🔌 Claude Desktop Integration
    • 🛡️ Security Considerations
    • 💻 Development
    • 📁 Project Structure
    • 🐛 Debugging
    • 🛠️ Tool API
    • execute_command
    • ❌ Error Handling
    • 🤝 Contributing
    • 📄 License

    Table of Contents

    • 🎥 Demo
    • ✨ Features
    • 🚀 Installation
    • ⚙️ Configuration
    • 🔒 Allowed Commands
    • 🔌 Claude Desktop Integration
    • 🛡️ Security Considerations
    • 💻 Development
    • 📁 Project Structure
    • 🐛 Debugging
    • 🛠️ Tool API
    • execute_command
    • ❌ Error Handling
    • 🤝 Contributing
    • 📄 License

    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:

    bash
    npm install

    Build the server:

    bash
    npm run build

    For development with auto-rebuild:

    bash
    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:

    bash
    export ALLOWED_COMMANDS=git,ls,mkdir,python

    🔌 Claude Desktop Integration

    To use with Claude Desktop, add the server config:

    On MacOS:

    bash
    ~/Library/Application Support/Claude/claude_desktop_config.json

    On Windows:

    code
    %APPDATA%/Claude/claude_desktop_config.json

    Configuration example:

    json
    {
      "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

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

    2. Command Validation

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

    3. Error Handling

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

    4. Environment Isolation

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

    💻 Development

    📁 Project Structure

    code
    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:

    bash
    npm run 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:

    json
    {
      "name": "execute_command",
      "arguments": {
        "command": "git status"
      }
    }

    Example Response:

    json
    {
      "content": [
        {
          "type": "text",
          "text": "On branch main\nNothing to commit, working tree clean"
        }
      ]
    }

    Error Response:

    json
    {
      "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

    json
    {
         "code": "InvalidParams",
         "message": "Command not allowed: [command]. Allowed commands: git, ls, mkdir, cd, npm, npx, python"
       }

    2. Execution Failures

    json
    {
         "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.

    Similar MCP

    Based on tags & features

    • WA

      Waha Mcp

      JavaScript00
    • WI

      Wizzy Mcp Tmdb

      JavaScript00
    • RI

      Rijksmuseum Mcp

      JavaScript·
      59
    • MC

      Mcp Server Playwright

      JavaScript·
      262

    Trending MCP

    Most active this week

    • PL

      Playwright Mcp

      TypeScript·
      22.1k
    • SE

      Serena

      Python·
      14.5k
    • MC

      Mcp Playwright

      TypeScript·
      4.9k
    • MC

      Mcp Server Cloudflare

      TypeScript·
      3.0k
    View All MCP Servers

    Similar MCP

    Based on tags & features

    • WA

      Waha Mcp

      JavaScript00
    • WI

      Wizzy Mcp Tmdb

      JavaScript00
    • RI

      Rijksmuseum Mcp

      JavaScript·
      59
    • MC

      Mcp Server Playwright

      JavaScript·
      262

    Trending MCP

    Most active this week

    • PL

      Playwright Mcp

      TypeScript·
      22.1k
    • SE

      Serena

      Python·
      14.5k
    • MC

      Mcp Playwright

      TypeScript·
      4.9k
    • MC

      Mcp Server Cloudflare

      TypeScript·
      3.0k