systemd-mcp
by openSUSE
Overview
Manages systemd services, units, and logs via the Model Context Protocol (MCP) by directly connecting to systemd's C API.
Installation
go run systemd-mcp.goEnvironment Variables
- SYSTEMD_MCP_HTTP
- SYSTEMD_MCP_LOGFILE
- SYSTEMD_MCP_CONTROLLER
- SYSTEMD_MCP_VERBOSE
- SYSTEMD_MCP_DEBUG
- SYSTEMD_MCP_LOG_JSON
- SYSTEMD_MCP_LIST_TOOLS
- SYSTEMD_MCP_ALLOW_WRITE
- SYSTEMD_MCP_ALLOW_READ
- SYSTEMD_MCP_ENABLED_TOOLS
- SYSTEMD_MCP_TIMEOUT
- SYSTEMD_MCP_NOAUTH
Security Notes
The server implements robust authorization mechanisms (Polkit/D-Bus and OAuth2) for managing systemd units and reading logs. However, two critical tools, 'get_file' and 'get_man_page', do not perform any authorization checks within their respective MCP handlers (or underlying functions). This means that if these tools are enabled, any authenticated (via Polkit or OAuth2) or unauthenticated (if '--noauth' is used) client can read arbitrary files and retrieve any man page on the system, subject only to the permissions of the user running the 'systemd-mcp' server. If the server is run with elevated privileges (e.g., as root for HTTP mode, as recommended by the README), this constitutes a severe arbitrary file read vulnerability. Command execution through 'man', 'rpm', and 'getfacl' is present, but arguments are passed via exec.Command, reducing direct shell injection risk, though potential vulnerabilities in these external tools could still be a concern. No obvious hardcoded secrets or obfuscation were found.
Similar Servers
mcp-server-kubernetes
This MCP server enables AI agents to connect to and manage Kubernetes clusters by executing kubectl and Helm commands.
linux-mcp-server
This server provides read-only Linux system administration, diagnostics, and troubleshooting capabilities for AI agents using the Model Context Protocol (MCP).
cosmotop
System monitoring and information exposure via MCP protocol.
prometheus-mcp
A Model Context Protocol (MCP) server that enables AI agents and CLI users to query and discover metrics from Prometheus, with built-in features like retries, caching, and an optional metrics exporter.