Linux Command MCP (Model Context Protocol) logo

Linux Command MCP (Model Context Protocol)

Community
xkiranj

MCP server and client for running Linux commands

Publisherxkiranj
Repositorylinux-command-mcp
LanguageTypeScript
Forks
8
Stars
25
Available tools
0
Transport typestdio
Categories
LicenseMIT
Links
  • Connect tools to AI workflows

    Linux Command MCP (Model Context Protocol) exposes MCP capabilities that can be used by compatible AI clients and agents.

  • 0 available tools

    Browse the callable actions below, including names and descriptions when provided by the server.

  • Ready-to-copy setup

    Use the installation snippets to configure this server in your preferred MCP client.

  • Open source signals

    25 stars and 8 forks from the linked repository.

Linux Command MCP (Model Context Protocol)

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

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

Linux Command MCP Server Configuration

json
"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
bash
git clone <repository-url>
cd linux-command-mcp
  1. Install server dependencies
bash
cd server
npm install
npm run build
  1. Install client dependencies
bash
cd ../client
npm install
npm run build

Usage

Starting the Server

  1. Navigate to the server directory
bash
cd server
  1. Start with PM2
bash
npm run pm2:start

Using the Client

Available Commands:

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

Execute commands directly:

bash
# In the client directory
npm start 
exec "ls -l"
exec "list /home"
exec "uname -a"

Interactive Commands & Stdin Support

✨ NEW: The Linux Command MCP server now supports interactive scripts via stdin!

Using stdin Parameter

You can now provide input to interactive scripts using the stdin parameter:

typescript
// Example: Run an interactive Python game
await callTool('execute-command', {
  command: 'python3 /path/to/interactive_script.py',
  stdin: '15\n2\n1\n2\n1\n'  // Automated responses
});

How it works:

  • The stdin parameter sends input to the script before execution
  • Input is sent line-by-line (use \n for newlines)
  • Script runs to completion with automated responses
  • All output is captured and returned

Interactive Script Examples

Python game with input:

bash
# Game expects: number of sticks, then player moves
stdin: "15\n2\n1\n2\n1\n"

Setup wizard:

bash
# Wizard expects: username, email, confirm
stdin: "johndoe\njohn@example.com\ny\n"

Multiple choice prompt:

bash
# Script shows options 1-5, user selects option 3
stdin: "3\n"

Sudo Commands

Important Note: The Linux Command MCP server still CANNOT execute sudo commands that require password prompts.

For sudo commands:

  1. Execute the command manually with proper permissions
  2. Or configure passwordless sudo for specific commands
  3. Or use the stdin parameter for non-sudo interactive scripts

Troubleshooting

  • Ensure PM2 is running: pm2 list
  • Check server logs: pm2 logs linux-command-mcp-server
  • Verify server and client builds

Using Linux Commands in Claude Desktop

Example Interactions

Here are some safe, generic examples of how you can ask Claude to run Linux commands:

  1. Check System Information

    • "Can you show me the Linux kernel version?"
    $ uname -r
  2. List Directory Contents

    • "Show me the contents of the home directory"
    $ ls ~
  3. Check Available Disk Space

    • "What's the disk usage on this system?"
    $ df -h
  4. View System Uptime

    • "How long has this system been running?"
    $ uptime
  5. Check Network Interfaces

    • "What network interfaces are available?"
    $ ip addr
  6. System Memory Information

    • "Can you show me the memory usage?"
    $ free -h

Important Usage Guidelines

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

What to Avoid

❌ Do NOT run commands that:

  • Reveal personal file names or paths
  • Contain sensitive system configurations
  • Modify system settings
  • Require sudo or root permissions

Example Conversation

User: "Can you check the Linux kernel version?"

Claude: Certainly! I'll run the command to show the Linux kernel version.

$ uname -r
5.15.0-91-generic

This kernel is running Ubuntu 22.04.3 LTS.

Security Considerations

  • Only run this on trusted networks
  • Limit access to the server
  • Be cautious with command execution

Security and Best Practices

  • Always be mindful of the information you're requesting
  • Use commands that provide system-level, non-sensitive information
  • When in doubt, ask Claude to clarify the command's purpose

Contributing

Improve and expand the Linux Command MCP by:

  • Adding more safe, generic command examples
  • Enhancing documentation
  • Suggesting improvements to command execution

License

MIT license

Contact

  • Email: xkiranj.1980@gmail.com

  • Blockchain: 0xkiran.eth

    • Ethereum: 0x67F367edb83d8fdF48E7E7Cfcb35183e746c292c
    • Bitcoin: bc1q688np092y8raxag5e6573chrcgck5756yv476v

Installation

TypingMind
Prerequisites:

Node.js 18+

{
  "mcpServers": {
    "xkiranj-linux-command-mcp": {
      "command": "",
      "args": []
    }
  }
}

Use Linux Command MCP (Model Context Protocol) MCP with multiple AI models

TypingMind connects MCP tools at the workspace level, so once Linux Command MCP (Model Context Protocol) is connected, you can use it with different AI models in TypingMind instead of setting it up separately for each model. This MCP runs locally through the TypingMind MCP connector on your device.

Setup guide to use the local connector

Use this when the MCP server needs access to local files, apps, or private resources on your computer.

1

Open the MCP settings

In TypingMind, go to Settings, Advanced Settings, then Model Context Protocol and choose Setup Connector.

  1. Open TypingMind in your browser.
  2. Click the Settings icon.
  3. Go to Advanced Settings.
  4. Open the Model Context Protocol section.
  5. Click Setup Connector and choose This Device.
TypingMind MCP connector setup screen with This Device selected
2

Run the connector command

Choose This Device, copy the command from TypingMind, and run it in Terminal. Keep the process running while you use MCP.

  1. Copy the setup command shown by TypingMind.
  2. Open Terminal on macOS or Windows Terminal on Windows.
  3. Paste and run the command.
  4. Approve the package install if Terminal asks you to proceed.
  5. Keep the Terminal window running while using MCP tools.
3

Add Linux Command MCP (Model Context Protocol) as a server

When the connector status is Ready, click Edit Servers and paste the MCP server configuration.

  1. Wait until the connector status shows Ready.
  2. Click Edit Servers.
  3. Paste the Linux Command MCP (Model Context Protocol) MCP server configuration.
  4. Save the server list.
  5. Refresh if you want to confirm the connector is still ready.
TypingMind MCP settings showing active server and Edit Servers button
{
  "mcpServers": {
    "xkiranj-linux-command-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "linux-command-mcp"
      ]
    }
  }
}
4

Use it across models

Save the server list, open Plugins, enable the Linux Command MCP (Model Context Protocol) MCP tools, then select any supported AI model in TypingMind and use the tools in chat or assign them to an AI agent.

  1. Open the Plugins page in TypingMind.
  2. Enable the Linux Command MCP (Model Context Protocol) MCP tools.
  3. Start a chat and choose the AI model you want to use.
  4. Use the MCP tools in chat or assign them to an AI agent.
  5. Switch to another AI model whenever needed without reconnecting MCP.
TypingMind chat using enabled MCP tools with a selected AI model
Can you use Linux Command MCP (Model Context Protocol) to help me with this task?
Linux Command MCP (Model Context Protocol)
Sure. I read it.
Here is what I found using Linux Command MCP (Model Context Protocol).

Frequently asked questions

What is the Linux Command MCP (Model Context Protocol) MCP server used for?

Linux Command MCP (Model Context Protocol) is an MCP server that lets compatible AI clients connect to external tools and context. In TypingMind, you can add this MCP server once and make its tools available in your AI workspace.

Can I use Linux Command MCP (Model Context Protocol) MCP with multiple AI models in TypingMind?

Yes. TypingMind connects MCP tools at the workspace level, so you can use Linux Command MCP (Model Context Protocol) with different AI models such as Claude, ChatGPT, Gemini, or other models you have configured in TypingMind without setting up the MCP server separately for each model.

Why use Linux Command MCP (Model Context Protocol) MCP with TypingMind?

TypingMind is one of the best frontends for LLM chat because it brings multiple AI models, prompts, plugins, AI agents, API keys, and MCP tools into one workspace. With Linux Command MCP (Model Context Protocol) connected, you can use its MCP tools across your preferred models while keeping your chat workflow organized in TypingMind.

How do I connect Linux Command MCP (Model Context Protocol) MCP to TypingMind?

Linux Command MCP (Model Context Protocol) runs through the TypingMind local MCP connector. This is best when the MCP server needs access to local files, desktop apps, command-line tools, or private resources on your computer.

What tools does Linux Command MCP (Model Context Protocol) MCP provide in TypingMind?

Linux Command MCP (Model Context Protocol) exposes MCP capabilities that can be enabled from the TypingMind Plugins page and used in chat or assigned to AI agents.

Do I need to share my API keys with TypingMind to use Linux Command MCP (Model Context Protocol) MCP?

No. TypingMind is local-first and lets you keep your model providers, API keys, prompts, and MCP configuration under your control. If Linux Command MCP (Model Context Protocol) requires authentication, add the required headers, OAuth settings, or local configuration for that MCP server when you create the connection.

Related MCP Servers

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇