Server¶
server ¶
Core MCP server for Linux diagnostics using FastMCP.
get_audit_logs
async
¶
get_audit_logs(
lines: Annotated[
int,
Field(
description="Number of log lines to retrieve.",
ge=1,
le=100000,
),
] = 100,
host: Host = None,
) -> str
Get Linux audit logs.
Retrieves entries from /var/log/audit/audit.log containing security-relevant events such as authentication, authorization, and system call auditing. Requires root privileges to read.
Source code in src/linux_mcp_server/tools/logs.py
get_cpu_information
async
¶
Get CPU information.
Retrieves CPU model, core counts (logical and physical), frequency, and current load averages (1, 5, and 15 minute).
Source code in src/linux_mcp_server/tools/system_info.py
get_disk_usage
async
¶
Get disk usage information.
Retrieves filesystem usage for all mounted volumes including size, used/available space, utilization percentage, and mount points.
Source code in src/linux_mcp_server/tools/system_info.py
get_hardware_information
async
¶
Get hardware information.
Retrieves detailed hardware inventory including CPU specifications, PCI devices, USB devices, and DMI/SMBIOS data (system manufacturer, model, BIOS version, etc.). Some information may require root privileges.
Source code in src/linux_mcp_server/tools/system_info.py
get_journal_logs
async
¶
get_journal_logs(
unit: Annotated[
str | None,
"Filter by systemd unit name or pattern (e.g., 'nginx.service', 'ssh*')",
] = None,
priority: Annotated[
str | None,
"Filter by priority. Possible values: priority level (0-7), syslog level name ('emerg' to 'debug'), or range (e.g., 'err..info')",
] = None,
since: Annotated[
str | None,
"Filter entries since specified time. Date/time filter (format: 'YYYY-MM-DD HH:MM:SS', 'today', 'yesterday', 'now', or relative like '-1h')",
] = None,
lines: Annotated[
int,
Field(
description="Number of log lines to retrieve. Default: 100",
ge=1,
le=10000,
),
] = 100,
host: Host = None,
) -> str
Get systemd journal logs.
Retrieves entries from the systemd journal with optional filtering by unit, priority level, and time range. Returns timestamped log messages.
Source code in src/linux_mcp_server/tools/logs.py
get_listening_ports
async
¶
Get listening ports.
Retrieves all ports with services actively listening for connections, including protocol (TCP/UDP), bind address, port number, and process name.
Source code in src/linux_mcp_server/tools/network.py
get_memory_information
async
¶
Get memory information.
Retrieves physical RAM and swap usage including total, used, free, shared, buffers, cached, and available memory.
Source code in src/linux_mcp_server/tools/system_info.py
get_network_connections
async
¶
Get active network connections.
Retrieves all established and pending network connections including protocol, state, local/remote addresses and ports, and associated process information.
Source code in src/linux_mcp_server/tools/network.py
get_network_interfaces
async
¶
Get network interface information.
Retrieves all network interfaces with their operational state, IP addresses, and traffic statistics (bytes/packets sent/received, errors, dropped packets).
Source code in src/linux_mcp_server/tools/network.py
get_process_info
async
¶
get_process_info(
pid: Annotated[
int, Field(description="Process ID", ge=1)
],
host: Host = None,
) -> str
Get detailed information about a specific process.
Retrieves comprehensive process details including CPU/memory usage, process
state, virtual/resident memory size, controlling terminal, and additional
metadata from /proc/
Source code in src/linux_mcp_server/tools/processes.py
get_service_logs
async
¶
get_service_logs(
service_name: Annotated[str, "Name of the service"],
lines: Annotated[
int,
Field(
description="Number of log lines to retrieve.",
ge=1,
le=10000,
),
] = 50,
host: Host = None,
) -> str
Get recent logs for a specific systemd service.
Retrieves journal entries for the specified service unit, including timestamps, priority levels, and log messages.
Source code in src/linux_mcp_server/tools/services.py
get_service_status
async
¶
get_service_status(
service_name: Annotated[str, "Name of the service"],
host: Host = None,
) -> str
Get status of a specific systemd service.
Retrieves detailed service information including active/enabled state, main PID, memory usage, CPU time, and recent log entries from the journal.
Source code in src/linux_mcp_server/tools/services.py
get_system_information
async
¶
Get basic system information.
Retrieves hostname, OS name/version, kernel version, architecture, system uptime, and last boot time.
Source code in src/linux_mcp_server/tools/system_info.py
list_block_devices
async
¶
List block devices.
Retrieves all block devices (disks, partitions, LVM volumes) with their name, size, type, mount point, and filesystem information.
Source code in src/linux_mcp_server/tools/storage.py
list_directories
async
¶
list_directories(
path: Annotated[str, "The directory path to analyze"],
order_by: Annotated[
OrderBy,
"Sort order - 'size', 'name', or 'modified' (default: 'name')",
] = OrderBy.NAME,
sort: Annotated[
SortBy,
"Sort direction - 'ascending' or 'descending' (default: 'ascending')",
] = SortBy.ASCENDING,
top_n: Annotated[
int | None,
Field(
description="Optional limit on number of directories to return (1-1000, only used with size ordering)",
gt=0,
le=1000,
),
] = None,
host: Host = None,
) -> str
List directories under a specified path.
Retrieves subdirectories with their size (when ordered by size) or modification time, supporting flexible sorting and result limiting.
Source code in src/linux_mcp_server/tools/storage.py
list_files
async
¶
list_files(
path: Annotated[str, "The path to analyze"],
order_by: Annotated[
OrderBy,
"Sort order - 'size', 'name', or 'modified' (default: 'name')",
] = OrderBy.NAME,
sort: Annotated[
SortBy,
"Sort direction - 'ascending' or 'descending' (default: 'ascending')",
] = SortBy.ASCENDING,
top_n: Annotated[
int | None,
Field(
description="Optional limit on number of files to return (1-1000, only used with size ordering)",
gt=0,
le=1000,
),
] = None,
host: Host = None,
) -> str
List files under a specified path.
Retrieves files with their size or modification time, supporting flexible sorting and result limiting. Useful for finding large or recently modified files.
Source code in src/linux_mcp_server/tools/storage.py
list_processes
async
¶
List all running processes.
Retrieves a snapshot of all running processes with details including PID, user, CPU/memory usage, process state, start time, and command line.
Source code in src/linux_mcp_server/tools/processes.py
list_services
async
¶
List all systemd services.
Retrieves all systemd service units with their load state, active state, sub-state, and description. Also includes a count of currently running services.
Source code in src/linux_mcp_server/tools/services.py
read_file
async
¶
Read the contents of a file.
Retrieves the full contents of a text file. The path must be absolute and the file must exist. Binary files may not display correctly.
Source code in src/linux_mcp_server/tools/storage.py
read_log_file
async
¶
read_log_file(
log_path: Annotated[str, "Path to the log file"],
lines: Annotated[
int,
Field(
description="Number of lines to retrieve from the end.",
ge=1,
le=10000,
),
] = 100,
host: Host = None,
) -> str
Read a specific log file.
Retrieves the last N lines from a log file. The file path must be in the allowed list configured via LINUX_MCP_ALLOWED_LOG_PATHS environment variable.
Source code in src/linux_mcp_server/tools/logs.py
108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 | |