Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ A Model Context Protocol (MCP) server for read-only Linux system administration,
- **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
- **Package Insights (DNF)**: Query packages, repositories, provides, groups, and modules
- **Configurable Log Access**: Control which log files can be accessed via environment variables
- **RHEL/systemd Focused**: Optimized for Red Hat Enterprise Linux systems

Expand Down
1 change: 1 addition & 0 deletions docs/api/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ MCP tools organized by category:
- **[Services](tools/services.md)** - Systemd service management
- **[Processes](tools/processes.md)** - Process listing and details
- **[Logs](tools/logs.md)** - Journal, audit, and log file access
- **[DNF](tools/dnf.md)** - Package and repository information
- **[Network](tools/network.md)** - Network interfaces, connections, ports, routes
- **[Storage](tools/storage.md)** - Block devices, directory and file listing

Expand Down
6 changes: 6 additions & 0 deletions docs/api/tools/dnf.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# DNF Tools

::: linux_mcp_server.tools.dnf
options:
show_root_heading: true
show_root_full_path: false
16 changes: 16 additions & 0 deletions docs/cheatsheet.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,22 @@ A quick reference guide for common tasks and the tools to use.
| **Service Logs** | `get_service_logs` | "Show recent logs for sshd." |
| **Specific Log File** | `read_log_file` | "Read the last 50 lines of /var/log/messages." |

## 📦 Packages (DNF)

| I want to check... | Use this tool | Example Prompt |
|-------------------|---------------|----------------|
| **Installed Packages** | `list_dnf_installed_packages` | "List all installed packages." |
| **Available Packages** | `list_dnf_available_packages` | "What packages are available in repos?" |
| **Package Details** | `get_dnf_package_info` | "Show details for bash." |
| **Repositories** | `list_dnf_repositories` | "Which repositories are enabled?" |
| **File Provides** | `dnf_provides` | "Which package provides /usr/bin/python3?" |
| **Repository Info** | `get_dnf_repo_info` | "Show details for baseos." |
| **Group List** | `list_dnf_groups` | "List all package groups." |
| **Group Info** | `get_dnf_group_info` | "Show details for Development Tools." |
| **Group Summary** | `get_dnf_group_summary` | "Summarize installed groups." |
| **Module List** | `list_dnf_modules` | "List nodejs module streams." |
| **Module Provides** | `dnf_module_provides` | "Which module provides python3?" |

## 🌐 Network

| I want to check... | Use this tool | Example Prompt |
Expand Down
1 change: 1 addition & 0 deletions docs/contributing.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ pytest
linux-mcp-server/
├── src/linux_mcp_server/
│ ├── tools/ # MCP tool implementations
│ │ ├── dnf.py # DNF package manager tools
│ │ ├── logs.py # Log reading tools
│ │ ├── network.py # Network diagnostic tools
│ │ ├── processes.py # Process management tools
Expand Down
114 changes: 114 additions & 0 deletions docs/usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,120 @@ Reads a specific log file (must be in the allowed list).

**Security Note:** This tool respects the `LINUX_MCP_ALLOWED_LOG_PATHS` environment variable whitelist.

### Package Management (DNF)

#### `list_dnf_installed_packages`
Lists installed packages via `dnf`.

**Parameters:**
- `host` (string, optional): Remote host identifier
- `limit` (number, optional): Maximum number of output lines to return (default: 500)
- `offset` (number, optional): Number of output lines to skip (default: 0)
- `no_limit` (boolean, optional): Disable output truncation (default: false)

**Example use case:** "Show me all installed packages."

#### `list_dnf_available_packages`
Lists packages available in configured repositories.

**Parameters:**
- `host` (string, optional): Remote host identifier
- `limit` (number, optional): Maximum number of output lines to return (default: 500)
- `offset` (number, optional): Number of output lines to skip (default: 0)
- `no_limit` (boolean, optional): Disable output truncation (default: false)

**Example use case:** "Which packages are available from enabled repos?"

#### `get_dnf_package_info`
Returns detailed information for a specific package.

**Parameters:**
- `package` (string, required): Package name (e.g., "bash", "openssl")
- `host` (string, optional): Remote host identifier

**Example use case:** "Get details for the bash package."

#### `list_dnf_repositories`
Lists configured repositories and their status.

**Parameters:**
- `host` (string, optional): Remote host identifier
- `limit` (number, optional): Maximum number of output lines to return (default: 500)
- `offset` (number, optional): Number of output lines to skip (default: 0)
- `no_limit` (boolean, optional): Disable output truncation (default: false)

**Example use case:** "Show me all configured repositories and whether they are enabled."

#### `dnf_provides`
Finds packages that provide a file or binary.

**Parameters:**
- `query` (string, required): File path or binary name (e.g., "/usr/bin/python3", "libssl.so.3")
- `host` (string, optional): Remote host identifier

**Example use case:** "Which package provides /usr/bin/python3?"

#### `get_dnf_repo_info`
Shows detailed information for a specific repository.

**Parameters:**
- `repo_id` (string, required): Repository id (e.g., "baseos", "appstream")
- `host` (string, optional): Remote host identifier

**Example use case:** "Show details for the baseos repository."

#### `list_dnf_groups`
Lists available and installed package groups.

**Parameters:**
- `host` (string, optional): Remote host identifier
- `limit` (number, optional): Maximum number of output lines to return (default: 500)
- `offset` (number, optional): Number of output lines to skip (default: 0)
- `no_limit` (boolean, optional): Disable output truncation (default: false)

**Example use case:** "List all package groups."

#### `get_dnf_group_info`
Shows details for a specific package group.

**Parameters:**
- `group` (string, required): Group name (e.g., "Development Tools")
- `host` (string, optional): Remote host identifier

**Example use case:** "Show details for the Development Tools group."

#### `get_dnf_group_summary`
Shows a summary of installed and available groups.

**Parameters:**
- `host` (string, optional): Remote host identifier
- `limit` (number, optional): Maximum number of output lines to return (default: 500)
- `offset` (number, optional): Number of output lines to skip (default: 0)
- `no_limit` (boolean, optional): Disable output truncation (default: false)

**Example use case:** "Summarize installed and available groups."

#### `list_dnf_modules`
Lists modules (optionally filtered by module name).

**Parameters:**
- `module` (string, optional): Module name filter (e.g., "nodejs")
- `host` (string, optional): Remote host identifier
- `limit` (number, optional): Maximum number of output lines to return (default: 500)
- `offset` (number, optional): Number of output lines to skip (default: 0)
- `no_limit` (boolean, optional): Disable output truncation (default: false)

**Example use case:** "List available nodejs module streams."

#### `dnf_module_provides`
Shows modules that provide a specific package.

**Parameters:**
- `package` (string, required): Package name (e.g., "python3")
- `host` (string, optional): Remote host identifier

**Example use case:** "Which module provides python3?"

### Network Diagnostics

#### `get_network_interfaces`
Expand Down
56 changes: 56 additions & 0 deletions src/linux_mcp_server/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,62 @@ class CommandGroup(BaseModel):
"default": CommandSpec(args=("cat", "{path}")),
}
),
# === Packages (dnf) ===
"dnf_list_installed": CommandGroup(
commands={
"default": CommandSpec(args=("dnf", "list", "installed")),
}
),
"dnf_list_available": CommandGroup(
commands={
"default": CommandSpec(args=("dnf", "list", "available")),
}
),
"dnf_package_info": CommandGroup(
commands={
"default": CommandSpec(args=("dnf", "info", "{package}")),
}
),
"dnf_repolist": CommandGroup(
commands={
"default": CommandSpec(args=("dnf", "repolist", "--all")),
}
),
"dnf_provides": CommandGroup(
commands={
"default": CommandSpec(args=("dnf", "provides", "{query}")),
}
),
"dnf_repo_info": CommandGroup(
commands={
"default": CommandSpec(args=("dnf", "repoinfo", "{repo_id}")),
}
),
"dnf_group_list": CommandGroup(
commands={
"default": CommandSpec(args=("dnf", "group", "list")),
}
),
"dnf_group_info": CommandGroup(
commands={
"default": CommandSpec(args=("dnf", "group", "info", "{group}")),
}
),
"dnf_group_summary": CommandGroup(
commands={
"default": CommandSpec(args=("dnf", "group", "summary")),
}
),
"dnf_module_list": CommandGroup(
commands={
"default": CommandSpec(args=("dnf", "module", "list"), optional_flags={"module": ("{module}",)}),
}
),
"dnf_module_provides": CommandGroup(
commands={
"default": CommandSpec(args=("dnf", "module", "provides", "{package}")),
}
),
# === System Info ===
"system_info": CommandGroup(
commands={
Expand Down
24 changes: 24 additions & 0 deletions src/linux_mcp_server/tools/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
# packages (dnf)
from linux_mcp_server.tools.dnf import dnf_module_provides
from linux_mcp_server.tools.dnf import dnf_provides
from linux_mcp_server.tools.dnf import get_dnf_group_info
from linux_mcp_server.tools.dnf import get_dnf_group_summary
from linux_mcp_server.tools.dnf import get_dnf_package_info
from linux_mcp_server.tools.dnf import get_dnf_repo_info
from linux_mcp_server.tools.dnf import list_dnf_available_packages
from linux_mcp_server.tools.dnf import list_dnf_groups
from linux_mcp_server.tools.dnf import list_dnf_installed_packages
from linux_mcp_server.tools.dnf import list_dnf_modules
from linux_mcp_server.tools.dnf import list_dnf_repositories

# logs
from linux_mcp_server.tools.logs import get_journal_logs
from linux_mcp_server.tools.logs import read_log_file
Expand Down Expand Up @@ -45,11 +58,22 @@
"get_service_logs",
"get_service_status",
"get_system_information",
"get_dnf_package_info",
"get_dnf_group_info",
"get_dnf_group_summary",
"get_dnf_repo_info",
"list_block_devices",
"list_directories",
"list_dnf_available_packages",
"list_dnf_installed_packages",
"list_dnf_groups",
"list_dnf_modules",
"list_dnf_repositories",
"list_files",
"list_processes",
"list_services",
"dnf_module_provides",
"dnf_provides",
"read_file",
"read_log_file",
]
Loading