home / mcp / linux command mcp server
Provides remote execution of Linux commands via MCP, enabling secure, standardized command execution.
Configuration
View docs{
"mcpServers": {
"xkiranj-linux-command-mcp": {
"command": "node",
"args": [
"/full/path/to/linux-command-mcp/server/dist/index.js"
]
}
}
}You can securely execute Linux commands remotely using the Linux Command MCP Server. This MCP server provides a standardized way to run common Linux commands from a client, enabling safe, centralized command execution across environments.
You interact with the Linux Command MCP Server through an MCP client. Install the client, connect to the server, and issue command requests like listing directories, checking system information, or viewing disk usage. The server executes the requested commands and returns the results to your client, while enforcing safety guidelines to prevent interactive or privileged actions.
Practical usage patterns include: - Execute a directory listing in your home folder - Check kernel version information - Inspect available disk space - Retrieve system uptime and memory usage These actions are designed to be read-only and do not modify system state.
Notes on usage: - Do not attempt interactive commands such as sudo through the client - Focus on informational and diagnostic commands to protect system integrity - Validate results from the server before relying on them for decisions
Prerequisites you need before installing the MCP server:
- Node.js v18.x or later
- npm
- PM2 for process management# 1) Install Node.js and npm if not already installed
# (use your OS package manager or NodeSource)
# 2) Install PM2 globally for process management
npm install -g pm2
# 3) Clone the Linux Command MCP repository
# (replace with the actual repository URL if you have one)
# git clone <repository-url>
# cd linux-command-mcpInstall server dependencies and build the server code, then install client dependencies and build the client: - Install server dependencies - Build the server - Install client dependencies - Build the client
# 1) Install server dependencies and build
cd linux-command-mcp
cd server
npm install
npm run build
# 2) Install client dependencies and build (if applicable)
cd ../client
npm install
npm run buildStart the server with PM2 once built. Use the provided start command to run the server under PM2 monitoring.
# Start the MCP server with PM2
npm run pm2:startIf you prefer running the server directly without PM2, you can start it with the usual Node.js execution flow, ensuring the executable path is correct.
Configuration for the Linux Command MCP Server is defined in a JSON structure that specifies how to start the server process. The example below shows using Node to run the server entry point.
{
"mcpServers": {
"linux_command": {
"command": "node",
"args": [
"/full/path/to/linux-command-mcp/server/dist/index.js"
]
}
}
}Follow these guidelines to keep the MCP server secure: - Run on trusted networks and limit access to authorized clients - Never execute interactive privileged commands through the server - Regularly review server and client builds for vulnerabilities - Keep Node.js and dependencies up to date with security patches
If you encounter issues, try these checks: - Confirm PM2 is running and managing the server - Review logs for errors and stack traces - Verify that the server and client builds completed successfully - Ensure the server’s executable path is correct and accessible
You can request a variety of safe, non-destructive Linux commands through the MCP client. Examples include system information queries, directory listings, and disk usage checks.
Example commands you might run from the client: - Check kernel version - List contents of a directory - Check disk usage - Check system uptime
Execute a Linux command through the MCP client, returning the command output.
List contents of a directory when requested by the MCP client.
Provide guidance or show available client commands.
Terminate the MCP client session.
Manage MCP server processes for starting, stopping, and monitoring.