Linux Command MCP (Model Context Protocol)

by xkiranj

25 539 downloads Not rated yet MIT
GitHub

About

MCP server and client for running Linux commands

Details

License
MIT

Explore

- Execute Linux commands via MCP client
- Supports interactive scripts with stdin input
- No sudo execution requiring password prompts
- PM2 process management for server reliability
- Client commands: exec, list, help, exit
- Uses absolute paths in configuration

Setting up with Highlight

This MCP is not yet compatible with Highlight’s one-click setup. However, you can still use it with Highlight by following these steps:

  1. Download and install Highlight from highlightai.com/download
  2. Navigate to the plugins tab and select "Add Custom Plugin"
  3. Configure the plugin with the settings below
    Plugin Name Linux Command MCP (Model Context Protocol)
    Command (node, npx, python, etc.)

    Please refer to the README for specific instructions on how to obtain API keys or other required environment variables.

  4. Enable "Start Automatically" if you want the plugin to start when Highlight launches

From the repository

- Node.js (v18.x or later)
- npm
- PM2 (for process management)

The MCP servers are configured in the claude_desktop_config.json file, typically located at ~/.config/Claude/claude_desktop_config.json.

"mcpServers": {
  "server-name": {
    "command": "node|npx|uvx",
    "args": ["server-specific-arguments"],
    "env": {
      "OPTIONAL_ENVIRONMENT_VARIABLES": "value"
    }
  }
}
"linux-command": {
  "command": "node",
  "args": [
    "/full/path/to/linux-command-mcp/server/dist/index.js"
  ]
}

- "command": Specifies the executor (node, npx, uvx)
- "args": Full path to the server's executable
- Ensure the path is an absolute path to your index.js

- Always use full, absolute paths
- Verify file permissions
- Ensure the specified file is executable

- Privacy: Only run commands that do not reveal sensitive information
- Safety: Avoid commands that modify system configuration
- Scope: Focus on informational and diagnostic commands

Claude Desktop / Cursor

Paste into your MCP client config file to install this server.

{
    "mcpServers": {
        "linux command mcp (model context protocol)": {
            "linux-command": {
                "command": "node",
                "args": [
                    "/full/path/to/linux-command-mcp/server/dist/index.js"
                ]
            }
        }
    }
}

McpServers

{
    "linux-command": {
        "command": "node",
        "args": [
            "/full/path/to/linux-command-mcp/server/dist/index.js"
        ]
    }
}

Overview

Linux Command MCP is a remote command execution system built using the Model Context Protocol (MCP), allowing secure and standardized execution of Linux commands.

Configuration for Claude Desktop MCP Servers

Understanding the Configuration

The MCP servers are configured in the claude_desktop_config.json file, typically located at ~/.config/Claude/claude_desktop_config.json.

Configuration Structure
"mcpServers": {
  "server-name": {
    "command": "node|npx|uvx",
    "args": ["server-specific-arguments"],
    "env": {
      "OPTIONAL_ENVIRONMENT_VARIABLES": "value"
    }
  }
}

Linux Command MCP Server Configuration

"linux-command": {
  "command": "node",
  "args": [
    "/full/path/to/linux-command-mcp/server/dist/index.js"
  ]
}
Configuration Explained
- "command": Specifies the executor (node, npx, uvx) - "args": Full path to the server's executable - Ensure the path is an absolute path to your index.js

Important Configuration Tips

- Always use full, absolute paths - Verify file permissions - Ensure the specified file is executable

Prerequisites

- Node.js (v18.x or later)
- npm
- PM2 (for process management)

Installation

1. Clone the repository

git clone <repository-url>
cd linux-command-mcp

2. Install server dependencies

cd server
npm install
npm run build

3. Install client dependencies

cd ../client
npm install
npm run build

Usage

Starting the Server

1. Navigate to the server directory

cd server

2. Start with PM2

npm run pm2:start

Using the Client

Available Commands:
1. exec <command> - Execute a Linux command
2. list [directory] - List directory contents
3. help - Show this help
4. exit - Exit the client

Execute commands directly:
```bash

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.

Videos about Linux Command MCP (Model Context Protocol)

Relevant YouTube tutorials, setups, and demos