Server¶
server ¶
Core MCP server for Linux diagnostics using FastMCP.
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,
Field(
description="Filter by systemd unit name or pattern",
examples=[
service,
nginx,
httpd,
"systemd-*",
"audit*",
],
),
] = "",
priority: Annotated[
str,
Field(
description="Filter by syslog priority level (0-7), name, or range",
examples=[
err,
warning,
info,
debug,
3,
"err..warning",
],
),
] = "",
since: Annotated[
str,
Field(
description="Filter entries since specified time (absolute or relative)",
examples=[
today,
yesterday,
"-1h",
"-30m",
"-7d",
"2025-01-15 10:00:00",
],
),
] = "",
transport: Annotated[
Transport | None,
"Filter by journal transport (e.g., 'audit' for audit logs, 'kernel' for kernel messages, 'syslog' for syslog messages)",
] = None,
lines: Annotated[
int,
Field(
description="Number of log lines to retrieve. Default: 100",
ge=1,
le=10000,
),
] = 100,
host: Host = None,
) -> LogEntries
Get systemd journal logs.
Retrieves entries from the systemd journal with optional filtering by unit, priority level, time range, and transport. Returns timestamped log messages.
To get audit logs, use transport='audit'.
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,
examples=[1, 1234, 65535],
),
],
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,
Field(
description="Name of the systemd service",
examples=[
sshd,
NetworkManager,
auditd,
rsyslog,
crond,
firewalld,
],
),
],
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,
Field(
description="Name of the systemd service",
examples=[
sshd,
NetworkManager,
auditd,
rsyslog,
crond,
firewalld,
],
),
],
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[
Path,
BeforeValidator(validate_path),
Field(
description="Absolute path to the directory to analyze",
examples=[
"/var/log",
"/etc",
"/home",
"/opt",
"/tmp",
],
),
],
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)",
gt=0,
le=1000,
),
] = None,
host: Host = None,
) -> StorageNodes
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[
Path,
BeforeValidator(validate_path),
Field(
description="Absolute path to the directory to analyze",
examples=[
"/var/log",
"/etc",
"/home",
"/opt",
"/tmp",
],
),
],
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,
) -> StorageNodes
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_file(
path: Annotated[
Path,
BeforeValidator(validate_path),
Field(
description="Absolute path to the file to read",
examples=[
"/etc/hosts",
"/etc/resolv.conf",
"/etc/os-release",
"/proc/cpuinfo",
],
),
],
host: Host = None,
) -> str
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[
Path,
BeforeValidator(validate_path),
Field(
description="Absolute path to the log file (must be in allowed list)",
examples=[
"/var/log/messages",
"/var/log/secure",
"/var/log/audit/audit.log",
"/var/log/dnf.log",
],
),
],
lines: Annotated[
int,
Field(
description="Number of lines to retrieve from the end.",
ge=1,
le=10000,
),
] = 100,
host: Host = None,
) -> LogEntries
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
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 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 | |