linux-advisory-mcp
by 119adarl
README.md
# linux-advisory-mcp
An MCP server that lets Claude (or any MCP client) answer questions about **AlmaLinux security advisories, CVEs and package versions**, from a local index of the public AlmaLinux errata feed.
Ask things like:
- "Is `openssl-3.0.7-24.el9.x86_64` behind any security fixes on AlmaLinux 9?"
- "Which advisory fixed CVE-2024-6387, and what version do I need?"
- "Here is `rpm -qa` from a host. What is outstanding, most severe first?"
- "What Critical advisories has AlmaLinux 9 shipped since October?"
## Why this needs a tool
A language model cannot answer "is this host patched?" reliably on its own, for two reasons. The advisory data changes daily, so it is not in the model. And RPM versions do not sort like strings or semantic versions: `5.14.0-70.el9` is older than `5.14.0-284.el9`, `1.0~rc1` is older than `1.0`, and an epoch outranks everything. The server does both jobs in code: it indexes the feed, and it compares versions with rpm's own ordering rules (`src/advisory_mcp/rpmver.py`).
I spent several years building and patching an Enterprise Linux platform for a large fleet.
```mermaid
flowchart LR
C[Claude or another MCP client] -- "MCP over stdio" --> S[linux-advisory-mcp]
S --> Q[Queries + rpm version comparison]
Q --> DB[(SQLite index)]
F[errata.almalinux.org feed] -- "sync" --> DB
```
## Tools
| Tool | What it does |
|---|---|
| `check_package` | One line of `rpm -qa` in; the advisories that ship a newer build, and the version to update to |
| `check_host` | A whole `rpm -qa` listing in; outstanding advisories grouped by severity, most severe first |
| `find_cve` | The advisories that fix a CVE in each synced release, with fixed versions |
| `get_advisory` | One advisory: severity, CVEs, description, fixed packages |
| `search_advisories` | Filter by package, severity, date and text |
| `data_status` | Which releases are indexed and when they were synced |
All tools are read-only. Mistakes the caller can fix (unknown release, unsynced data, unparseable package line) come back as tool errors with a message that says what to do, so the model can correct itself. When the data cannot answer a question, the tools say so: a CVE with no advisory returns a note that absence does not prove a release is unaffected.
## Install and run
```bash
python -m venv .venv && source .venv/bin/activate
pip install -e ".[dev]"
linux-advisory-mcp sync --release 9 # downloads about 35 MB, indexes in under a second
linux-advisory-mcp status
```
Add it to Claude Code:
```bash
claude mcp add linux-advisory -- linux-advisory-mcp serve
```
Or to any client that takes a JSON server entry:
```json
{
"mcpServers": {
"linux-advisory": { "command": "linux-advisory-mcp", "args": ["serve"] }
}
}
```
The index lives in `~/.cache/linux-advisory-mcp/` (override with `ADVISORY_MCP_DIR`). Releases 8, 9 and 10 are supported; sync the ones you need and re-run `sync` to refresh.
## Tests
```bash
pytest -q # 55 tests
```
- `tests/test_rpmver.py`: the version ordering, including tilde, caret, epochs, leading zeros and `rpm -qa` line parsing.
- `tests/test_store.py`: indexing and every query, against a fixture of five real advisories trimmed from the feed.
- `tests/test_server.py`: the tools called through the MCP server object.
- `tests/test_stdio_end_to_end.py`: starts the real server as a subprocess and drives it with an MCP client over stdio, including an error case.
## Limits
- It reports advisories that have shipped. It does not know about CVEs with no fix yet, and it is not a vulnerability scanner.
- Module streams (for example `php:8.1` against `php:8.2`) are recorded on each result but not resolved: a package from one stream can be flagged by an advisory for another. Check the `module` field.
- Default `rpm -qa` output omits the epoch. When it is missing, the comparison assumes the same epoch as the fixed package.
- The whole feed is re-downloaded on each sync; there is no incremental update.
- AlmaLinux only. The feed format is specific to it.
Advisory data comes from [errata.almalinux.org](https://errata.almalinux.org) and belongs to the AlmaLinux OS Foundation. This project is not affiliated with AlmaLinux.
## License
MIT