
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 分
请在仓库或注册中心条目中声明许可证。