{
  "markdown": "# Journald MCP Server\n\nAn MCP server for accessing systemd journal logs.\n\n## Features\n\n- List systemd units from journal logs\n- List syslog identifiers from journal logs\n- Get datetime of first journal entry\n- Filter journal entries by datetime range (since/until)\n- Filter by systemd unit or syslog identifier\n- Filter by message content (case-insensitive substring matching)\n- Natural language datetime parsing (e.g., \"2 hours ago\", \"yesterday at 3pm\")\n- List units and identifiers within specific time ranges\n\n## Installation\n\n\n```bash\n# Install dependencies\nuv sync\n```\n\n## Usage\nRun as non-root: Give the user systemd-journal group access  `usermod -aG systemd-journal $USER`\n\nRun the server with:\n\n```bash\nuv run server.py [OPTIONS]\n```\n\n### CLI Options\n\n- `--transport`: Transport protocol to use (`stdio`, `sse`, or `streamable-http`). Default: `stdio`\n- `--port`: Port to listen on for HTTP transport (ignored for `stdio` transport). Default: `3002`\n- `--log-level`: Logging level (`DEBUG`, `INFO`, `WARNING`, `ERROR`, `CRITICAL`). Default: `INFO`\n\n### Examples\n\n1. Run with stdio transport (default, for MCP clients that communicate via stdin/stdout):\n   ```bash\n   python server.py\n   ```\n\n2. Run with HTTP transport on custom port:\n   ```bash\n   python server.py --transport streamable-http --port 8080\n   ```\n\n3. Run with SSE transport:\n   ```bash\n   python server.py --transport sse --port 3000\n   ```\n\n4. Run with debug logging:\n   ```bash\n   python server.py --log-level DEBUG\n   ```\n\n## MCP Integration\n\nThe server provides the following MCP resources and tools:\n\n### Resources\n- `journal://units`: List unique systemd units from journal logs (all accessible time)\n- `journal://syslog-identifiers`: List unique syslog identifiers from journal logs (all accessible time)\n- `journal://first-entry-datetime`: Get the datetime of the first entry in the journal\n- `journal://units/{since}/{until}`: List unique systemd units within a specified time range\n- `journal://syslog-identifiers/{since}/{until}`: List unique syslog identifiers within a specified time range\n\n### Tools\n- `get_journal_entries`: Get journal entries with datetime filtering\n  - Parameters: `since` (optional), `until` (optional), `unit` (optional), `identifier` (optional), `message_contains` (optional), `limit` (default: 100)\n  - Returns: List of entries with timestamp, unit, identifier, and message\n  - Example: Get logs from last 2 hours containing \"error\": `since=\"2 hours ago\", message_contains=\"error\"`\n  \n- `get_recent_logs`: Get recent journal logs from the last N minutes\n  - Parameters: `minutes` (default: 60), `unit` (optional), `limit` (default: 50)\n  - Returns: Formatted string of recent log messages\n\n### Datetime Input Format\nThe server uses natural language datetime parsing via the `dateparser` library. Supported formats include:\n- Relative times: \"2 hours ago\", \"yesterday at 3pm\", \"last week\", \"now\"\n- Absolute times: \"2024-01-15 14:30\", \"2024-01-15T14:30:00\"\n- Mixed: \"today at 9am\", \"tomorrow 3pm\"\n\nAll times are interpreted as UTC and returned in human-readable format: \"YYYY-MM-DD HH:MM:SS UTC\"\n\n## Development\n\nThis project uses:\n- Python 3.12+\n- [MCP](https://modelcontextprotocol.io) FastMCP\n- systemd-python for journal access\n- Click for CLI interface\n- dateparser for natural language datetime parsing\n\n### Project Structure\n\n```\njournald-mcp-server/\n├── journald_mcp_server/     # Main package\n│   ├── __init__.py\n│   ├── server.py           # MCP server implementation\n│   └── datetime_utils.py   # Datetime parsing and formatting utilities\n├── tests/                  # Test suite\n│   ├── __init__.py\n│   └── test_server.py\n├── server.py              # Entry point wrapper\n├── pyproject.toml\n└── README.md\n```\n\n### Running Tests\n\n```bash\npython -m pytest tests/\n```\n",
  "bytes": 3787,
  "sha": "4b4542dedf12bdbe7ab02dbdd366006508b4b2e0447448b46b36a47b76ea2fd0",
  "repo_slug": "james116blue/journald-mcp-server",
  "fonte": "repo",
  "truncated": false,
  "api": "https://agentalog.com/api/listings/mcp_io_github_james116blue_journald_mcp_serv_6b4f1a95/readme"
}