
Journald MCP Server
io.github.james116blue由 GitHub 帳號 james116blue 發布v0.1.0更新於 Oct 24, 2026
Incident forensic with log files analyzing
概覽
唯讀的 MCP 伺服器,讓助理查詢本機 systemd journal 日誌,可依時間範圍、unit、syslog 識別碼與訊息內容篩選。
- 可以做什麼
- 列出 journal 中的 systemd unit 與 syslog 識別碼,可限定時間範圍
- 取得 journal 第一筆記錄的時間
- 依 since/until、unit、識別碼及不分大小寫的訊息子字串篩選日誌項目,並可限制筆數
- 取得某 unit 最近 N 分鐘的日誌
- 支援「2 hours ago」「yesterday at 3pm」等自然語言時間,以 UTC 解讀
- 適用情境
- 適合在 Linux 機器上進行故障排查與事件鑑識:讓助理取得近期服務日誌、依時間區間或 unit 縮小範圍、搜尋錯誤訊息,而不必手寫 journalctl 指令。
- 執行需求
- 以本機 Python 3.12+ 程序執行(PyPI 套件 journald-mcp-server,或 uv sync 後執行 server.py),依賴 systemd-python 存取 journal。建議將使用者加入 systemd-journal 群組以便非 root 讀取日誌。預設 stdio 傳輸,可選 sse 與 streamable-http。
安裝
在 SourceWeft 中
- 開啟 儀表板中的 Journald MCP Server,將其新增到工作區。
- 為需要使用其工具的對話啟用該服務。
Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。
其他 MCP 客戶端
參照 儲存庫 中的啟動說明。
README
Journald MCP Server
An MCP server for accessing systemd journal logs.
Features
- List systemd units from journal logs
- List syslog identifiers from journal logs
- Get datetime of first journal entry
- Filter journal entries by datetime range (since/until)
- Filter by systemd unit or syslog identifier
- Filter by message content (case-insensitive substring matching)
- Natural language datetime parsing (e.g., "2 hours ago", "yesterday at 3pm")
- List units and identifiers within specific time ranges
Installation
Usage
Run as non-root: Give the user systemd-journal group access usermod -aG systemd-journal $USER
Run the server with:
CLI Options
--transport: Transport protocol to use (stdio,sse, orstreamable-http). Default:stdio--port: Port to listen on for HTTP transport (ignored forstdiotransport). Default:3002--log-level: Logging level (DEBUG,INFO,WARNING,ERROR,CRITICAL). Default:INFO
Examples
-
Run with stdio transport (default, for MCP clients that communicate via stdin/stdout):
-
Run with HTTP transport on custom port:
-
Run with SSE transport:
-
Run with debug logging:
MCP Integration
The server provides the following MCP resources and tools:
Resources
journal://units: List unique systemd units from journal logs (all accessible time)journal://syslog-identifiers: List unique syslog identifiers from journal logs (all accessible time)journal://first-entry-datetime: Get the datetime of the first entry in the journaljournal://units/{since}/{until}: List unique systemd units within a specified time rangejournal://syslog-identifiers/{since}/{until}: List unique syslog identifiers within a specified time range
Tools
-
get_journal_entries: Get journal entries with datetime filtering- Parameters:
since(optional),until(optional),unit(optional),identifier(optional),message_contains(optional),limit(default: 100) - Returns: List of entries with timestamp, unit, identifier, and message
- Example: Get logs from last 2 hours containing "error":
since="2 hours ago", message_contains="error"
- Parameters:
-
get_recent_logs: Get recent journal logs from the last N minutes- Parameters:
minutes(default: 60),unit(optional),limit(default: 50) - Returns: Formatted string of recent log messages
- Parameters:
Datetime Input Format
The server uses natural language datetime parsing via the dateparser library. Supported formats include:
- Relative times: "2 hours ago", "yesterday at 3pm", "last week", "now"
- Absolute times: "2024-01-15 14:30", "2024-01-15T14:30:00"
- Mixed: "today at 9am", "tomorrow 3pm"
All times are interpreted as UTC and returned in human-readable format: "YYYY-MM-DD HH:MM:SS UTC"
Development
This project uses:
- Python 3.12+
- MCP FastMCP
- systemd-python for journal access
- Click for CLI interface
- dateparser for natural language datetime parsing
Project Structure
Running Tests
來源:README.md,提交 d9843ed
工具
0版本歷史
1- v0.1.0最新Sep 16, 2026
評分
已滿足適用檢查項的 40%
該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。
- 近 30 天內可連通25 分
請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。
- 已宣告認證方式10 分
請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。
- 已列出工具15 分
請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。
- 描述必需15 分
- 圖示10 分
- 文件15 分
- 授權條款10 分
請在儲存庫或註冊中心條目中宣告授權條款。