Skip to main content

MCP server for read-only Linux system administration, diagnostics, and troubleshooting

Project description

CI Coverage PyPI

Linux MCP Server

A Model Context Protocol (MCP) server for read-only Linux system administration, diagnostics, and troubleshooting on RHEL-based systems.

Features

  • Read-Only Operations: All tools are strictly read-only for safe diagnostics
  • Remote SSH Execution: Execute commands on remote systems via SSH with key-based authentication
  • Multi-Host Management: Connect to different remote hosts in the same session
  • Comprehensive Diagnostics: System info, services, processes, logs, network, and storage
  • Configurable Log Access: Control which log files can be accessed via environment variables
  • RHEL/systemd Focused: Optimized for Red Hat Enterprise Linux systems

Installation

Python 3.10 or later is required.

Install with pip

Create and activate a virtual environment, then install using pip:

pip install linux-mcp-server

Or install in the Python user directory

pip install --user linux-mcp-server

Install with uv

Install using uv

uv tool install linux-mcp-server

See the complete installation guide for more details.

Configuration

Key environment variables:

  • LINUX_MCP_ALLOWED_LOG_PATHS - Comma-separated list of log files that can be accessed
  • LINUX_MCP_LOG_LEVEL - Logging level (DEBUG, INFO, WARNING, ERROR, CRITICAL)
  • LINUX_MCP_SSH_KEY_PATH - Path to SSH private key for remote execution

See Environment Variables for more details.

Audit Logging

All server operations are logged in both human-readable and JSON formats with automatic daily rotation and configurable retention. Logs are stored in ~/.local/share/linux-mcp-server/logs/.

Tool execution

All tools support optional host and username parameters for remote execution via SSH:

  • Authentication: SSH key-based authentication only (no password support)
  • Key Discovery: Automatically discovers SSH keys from ~/.ssh/ or use LINUX_MCP_SSH_KEY_PATH
  • Connection Pooling: Reuses SSH connections for efficiency
  • Multi-Host: Each tool call can target a different remote host

Requirements:

  • SSH key-based authentication must be configured on remote hosts
  • Remote user must have appropriate permissions for diagnostic commands

Usage

Running the Server

Installed using pip

Run from within the virtual environment:

[path to virtual environment]/bin/linux-mcp-server

Or run from the Python user directory:

~/.local/bin/linux-mcp-server

Installed using uv

uv tool run linux-mcp-server

For detailed usage instructions, available tools, and example troubleshooting sessions, see Usage.

Using with Claude Desktop

For complete Claude Desktop integration instructions including platform-specific config file locations and alternative configurations, see Claude Desktop Integration.

Available Tools

System Information

  • get_system_information - OS version, kernel, hostname, uptime
  • get_cpu_information - CPU details and load averages
  • get_memory_information - RAM usage and swap details
  • get_disk_usage - Filesystem usage and mount points
  • get_hardware_information - Hardware details (CPU architecture, PCI/USB devices, memory hardware)

Service Management

  • list_services - List all systemd services with status
  • get_service_status - Detailed status of a specific service
  • get_service_logs - Recent logs for a specific service

Process Management

  • list_processes - Running processes with CPU/memory usage
  • get_process_info - Detailed information about a specific process

Logs & Audit

  • get_journal_logs - Query systemd journal with filters
  • get_audit_logs - Read audit logs (if available)
  • read_log_file - Read specific log file (whitelist-controlled)

Network Diagnostics

  • get_network_interfaces - Network interface information
  • get_network_connections - Active network connections
  • get_listening_ports - Ports listening on the system

Storage & Disk Analysis

  • list_block_devices - Block devices and partitions
  • list_directories_by_size - List directories sorted by size (largest first) with top N limit
  • list_directories_by_name - List all directories sorted alphabetically (A-Z or Z-A)
  • list_directories_by_modified_date - List all directories sorted by modification date (newest/oldest first)

Architecture Overview

graph TB
    Client["Client Layer<br/>MCP Client (e.g. Claude Desktop)"]

    subgraph Server["MCP Server"]
        FastMCP[FastMCP Server]

        subgraph Tools["Tool Categories"]
            direction LR
            subgraph Row1[" "]
                SystemInfo[System Info]
                Services[Services]
                Processes[Processes]
            end
            subgraph Row2[" "]
            Logs[Logs & Audit]
                Network[Network]
                Storage[Storage]
            end
        end

        Executor[SSH Executor]
        Logger[Audit Logger]
    end

    subgraph Targets["Execution Targets"]
        direction LR
        Local[Local System]
        Remote[Remote Hosts<br/>SSH]
    end

    Client -->|MCP Protocol| FastMCP
    FastMCP --> Tools
    Tools --> Executor
    Executor --> Targets

    FastMCP -.-> Logger
    Executor -.-> Logger

    style Client fill:#4a9eff,stroke:#2563eb,color:#fff
    style FastMCP fill:#f59e0b,stroke:#d97706,color:#fff
    style SystemInfo fill:#64748b,stroke:#475569,color:#fff
    style Services fill:#64748b,stroke:#475569,color:#fff
    style Processes fill:#64748b,stroke:#475569,color:#fff
    style Logs fill:#64748b,stroke:#475569,color:#fff
    style Network fill:#64748b,stroke:#475569,color:#fff
    style Storage fill:#64748b,stroke:#475569,color:#fff
    style Executor fill:#10b981,stroke:#059669,color:#fff
    style Logger fill:#8b5cf6,stroke:#7c3aed,color:#fff
    style Local fill:#eab308,stroke:#ca8a04,color:#fff
    style Remote fill:#eab308,stroke:#ca8a04,color:#fff
    style Row1 fill:none,stroke:none
    style Row2 fill:none,stroke:none

Key Components

  • FastMCP Server: Core MCP protocol server handling tool registration and invocation
  • Tool Categories: Six categories of read-only diagnostic tools (system info, services, processes, logs, network, storage)
  • SSH Executor: Routes commands to local subprocess or remote SSH execution with connection pooling
  • Audit Logger: Comprehensive logging in both human-readable and JSON formats with automatic rotation
  • Multi-Target Execution: Single server instance can execute commands on local system or multiple remote hosts

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

linux_mcp_server-0.1.0a2.tar.gz (133.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

linux_mcp_server-0.1.0a2-py3-none-any.whl (34.8 kB view details)

Uploaded Python 3

File details

Details for the file linux_mcp_server-0.1.0a2.tar.gz.

File metadata

  • Download URL: linux_mcp_server-0.1.0a2.tar.gz
  • Upload date:
  • Size: 133.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for linux_mcp_server-0.1.0a2.tar.gz
Algorithm Hash digest
SHA256 6881d2e532030535ee6a39b5ab2d45ec1c7a6bc87e35c014a4a954312d9cb706
MD5 bf459e233d0f0682911ca5eb575ca66c
BLAKE2b-256 101a300ccc43873acc0c714b4356dac65277169671a3b368943d6f39a7efb150

See more details on using hashes here.

Provenance

The following attestation bundles were made for linux_mcp_server-0.1.0a2.tar.gz:

Publisher: build-publish.yml on rhel-lightspeed/linux-mcp-server

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file linux_mcp_server-0.1.0a2-py3-none-any.whl.

File metadata

File hashes

Hashes for linux_mcp_server-0.1.0a2-py3-none-any.whl
Algorithm Hash digest
SHA256 3102079f7a41033f308622e0d54b941ffac71a2e8b915346d9a6fb06d8216cd5
MD5 73ce16cffa22914ef0b25461fab67314
BLAKE2b-256 189405b16f0d7db9f45883f4f7f487afd9fa97b0fe676ba259f5d14fbb6133a5

See more details on using hashes here.

Provenance

The following attestation bundles were made for linux_mcp_server-0.1.0a2-py3-none-any.whl:

Publisher: build-publish.yml on rhel-lightspeed/linux-mcp-server

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page