Loading...
Loading...
MCP server for read-only Linux system diagnostics and troubleshooting on RHEL-based systems via SSH
npx skill4agent add aradotso/mcp-skills linux-mcp-server-administrationSkill by ara.so — MCP Skills collection.
pip install linux-mcp-server# Install uv first
pip install uv
# Install the server
uv pip install linux-mcp-servergit clone https://github.com/rhel-lightspeed/linux-mcp-server.git
cd linux-mcp-server
pip install -e .config.json{
"mcpServers": {
"linux": {
"command": "uv",
"args": [
"--directory",
"/path/to/linux-mcp-server",
"run",
"linux-mcp-server"
],
"env": {
"LINUX_MCP_ALLOWED_LOGS": "/var/log/messages,/var/log/secure,/var/log/audit/audit.log"
}
}
}
}LINUX_MCP_ALLOWED_LOGSSSH_AUTH_SOCKHOME# Generate SSH key if needed
ssh-keygen -t ed25519 -C "your_email@example.com"
# Copy public key to remote host
ssh-copy-id user@remote-host
# Test connection
ssh user@remote-host# Usage in MCP client
# Ask: "What's the system info for server01?"
# Tool call: get_system_info(host="user@server01")# Usage: "Show me kernel details"
# Tool call: get_uname(host=None) # Local system# Usage: "List all services on the production server"
# Tool call: list_services(host="admin@prod-server", state="all")
# States: "all", "running", "failed", "enabled", "disabled"# Usage: "Check nginx status on web01"
# Tool call: get_service_status(service_name="nginx", host="root@web01")# Usage: "Show all processes"
# Tool call: list_processes(host=None)# Usage: "What's using PID 1234?"
# Tool call: get_process_info(pid=1234, host=None)# Usage: "Show last 50 journal entries"
# Tool call: read_journal(lines=50, unit=None, priority=None, host=None)
# Priorities: "emerg", "alert", "crit", "err", "warning", "notice", "info", "debug"# Usage: "Show last 100 lines of /var/log/messages"
# Tool call: read_log_file(log_path="/var/log/messages", lines=100, host=None)
# Note: Log must be in LINUX_MCP_ALLOWED_LOGS# Usage: "Search for 'error' in system logs"
# Tool call: search_logs(pattern="error", log_path="/var/log/messages", host=None)# Usage: "What are the network interfaces?"
# Tool call: get_network_info(host=None)# Usage: "What ports are listening?"
# Tool call: get_listening_ports(host=None)# Usage: "Can we reach google.com?"
# Tool call: test_connectivity(target="google.com", host=None)# Usage: "Show disk usage"
# Tool call: get_disk_usage(host=None)# Usage: "What's mounted on the system?"
# Tool call: get_mount_points(host=None)# Check multiple hosts in sequence
# "Check service status on web01, web02, and db01"
# Tool calls:
# 1. get_service_status(service_name="httpd", host="admin@web01")
# 2. get_service_status(service_name="httpd", host="admin@web02")
# 3. get_service_status(service_name="postgresql", host="admin@db01")# "Troubleshoot why nginx isn't working on web01"
# Typical tool sequence:
# 1. get_service_status(service_name="nginx", host="admin@web01")
# 2. read_journal(lines=100, unit="nginx", priority="err", host="admin@web01")
# 3. get_listening_ports(host="admin@web01") # Check if port 80/443 open
# 4. test_connectivity(target="localhost:80", host="admin@web01")# "Run a health check on server01"
# Tool sequence:
# 1. get_system_info(host="admin@server01")
# 2. list_services(host="admin@server01", state="failed")
# 3. get_disk_usage(host="admin@server01")
# 4. read_journal(lines=50, priority="err", host="admin@server01")
# 5. list_processes(host="admin@server01")# "Find authentication errors in the last hour"
# Tool sequence:
# 1. read_journal(lines=1000, priority="err", host=None)
# 2. search_logs(pattern="authentication failure", log_path="/var/log/secure", host=None)
# 3. read_log_file(log_path="/var/log/audit/audit.log", lines=500, host=None)# Run locally
linux-mcp-server
# With custom log access
LINUX_MCP_ALLOWED_LOGS="/var/log/myapp.log,/var/log/custom.log" linux-mcp-server# Clone and install in editable mode
git clone https://github.com/rhel-lightspeed/linux-mcp-server.git
cd linux-mcp-server
pip install -e .
# Run with debugging
python -m linux_mcp_serverssh user@hostecho $SSH_AUTH_SOCKeval $(ssh-agent)ssh-add ~/.ssh/id_ed25519ssh-keyscan host >> ~/.ssh/known_hostsLINUX_MCP_ALLOWED_LOGS{
"env": {
"LINUX_MCP_ALLOWED_LOGS": "/var/log/messages,/var/log/secure,/custom/app.log"
}
}ssh admin@hostssh user@hostsystemctl statussystemctljournalctlssdf/usr/bin/usr/sbin