snap-maintainer
Find out which of your published snaps need a rebuild or a new release, and why.
snap-maintainer reads your Snap Store account, finds the source repository behind
each snap, and checks it against three things:
- Security fixes. Ubuntu has fixed a package your snap stages, and a rebuild would pick up the fix.
- Unreleased changes. Your repo has commits, or a version bump, that aren't in the published revision.
- Upstream releases. A part pulls from a git repo that has moved on.
For every snap that needs work, it writes out the exact steps to rebuild and release
it, matched to how that snap is built: a GitHub Actions workflow, a Launchpad recipe,
or a local snapcraft pack.
It never builds, uploads or releases anything itself. Those steps need someone watching, so the tool stops at a plan that a person, or an agent, can follow. Agents can also use it directly through its built-in MCP server.
Requirements
- Python 3.10 or later
snapcraft, logged in to the Snap Store as the snaps' publisher:snapcraft login- The GitHub CLI
gh, logged in:gh auth login - Optional:
unsquashfs(packagesquashfs-tools): reads build manifests from published snaps, for exact security checks.git: compares pinnedsource-tags with upstream tags.- The
mcpPython package: only for the MCP server (snap-maintainer mcp).
The tool checks all of these when it starts, and tells you the command to fix anything that's missing.
Install
pip install snap-maintainer # or: pipx install snap-maintainer
To use it from an agent, install the MCP extra instead:
pip install 'snap-maintainer[mcp]' # or: pipx install 'snap-maintainer[mcp]'
The latest development version comes straight from GitHub:
pipx install git+https://github.com/carlosbravoa/snap-maintainer.git
From a checkout, for development:
git clone https://github.com/carlosbravoa/snap-maintainer.git
cd snap-maintainer
pipx install --editable .
You can also run it without installing, from the checkout:
PYTHONPATH=src python3 -m snap_maintainer <command>.
Quick start
snap-maintainer discover # find your snaps, their repos and how they're built
snap-maintainer check # decide which need a rebuild or release
snap-maintainer plan # the steps to rebuild and release each of them
The first check downloads Ubuntu archive and security data and the published snaps'
manifests, so it takes a minute or two. Later runs use a cache.
Commands
| Command | What it does |
|---|---|
discover [snaps...] |
Lists the snaps registered to your account, their channels, source repos and builders, and saves them to the inventory. Prompts for a repo it can't find (--no-input to skip). |
check [snaps...] |
Gives each snap a verdict, rebuild, update or up to date, with the reasons. -v shows every notice, commit and note; --refresh re-downloads cached Ubuntu data. |
plan [snaps...] |
Shows the steps to rebuild and release every snap that needs it, or just the named ones. --all includes up-to-date snaps; --markdown and --json print it for an issue, an agent or a script. Runs nothing. |
show [--json] |
Prints the inventory without contacting anything. |
set-repo <snap> <url> |
Sets a snap's source repo by hand. |
set-build <snap> <method> [--workflow FILE] |
Sets how a snap is built: github-workflow, launchpad, local or manual. |
mcp |
Runs an MCP server so an agent can use the tool directly. See Use it from an agent (MCP). |
Repos and builders you set by hand are never overwritten by discover.
The inventory is kept in ~/.local/share/snap-maintainer/inventory.json (or under
$XDG_DATA_HOME), so it's the same wherever you run the command.
Global options go before the command: -i FILE uses another inventory file, and
--debug shows a traceback for unexpected errors. The SNAP_MAINTAINER_INVENTORY
environment variable sets the inventory file too.
Exit codes are 0 for success, 1 for an error, 2 when a required tool or login is
missing, and 130 when interrupted.
Output uses colours, a progress bar and clickable links in a terminal, and plain text
when piped or when NO_COLOR is set.
Handing a plan to an agent
plan --markdown prints a self-contained checklist with the reasons, the target
channel and architectures, and copy-paste commands:
snap-maintainer plan --markdown > rebuild-plan.md
snap-maintainer plan --markdown hello-nginx | gh issue create -R you/hello-nginx \
--title "Rebuild for security fixes" --body-file -
Use it from an agent (MCP)
snap-maintainer mcp runs a Model Context Protocol
server over stdio, so an agent such as Claude Code can discover, check and plan rebuilds
directly. It needs the optional mcp package:
pip install 'snap-maintainer[mcp]' # or, if already installed with pipx: pipx inject snap-maintainer mcp
The agent starts the server as snap-maintainer mcp, so snap-maintainer must be on
the agent's PATH (pipx puts it there). If the agent can't find it, use the absolute path,
e.g. ~/.local/bin/snap-maintainer, as the command.
Claude Code (--scope user makes it available in every project):
claude mcp add --scope user snap-maintainer -- snap-maintainer mcp
Codex CLI:
codex mcp add snap-maintainer -- snap-maintainer mcp
or in ~/.codex/config.toml:
[mcp_servers.snap-maintainer]
command = "snap-maintainer"
args = ["mcp"]
Gemini CLI (-s user makes it available in every project):
gemini mcp add -s user snap-maintainer snap-maintainer mcp
VS Code / Copilot:
code --add-mcp '{"name":"snap-maintainer","command":"snap-maintainer","args":["mcp"]}'
or in .vscode/mcp.json (note the servers key):
{
"servers": {
"snap-maintainer": { "type": "stdio", "command": "snap-maintainer", "args": ["mcp"] }
}
}
Cursor (~/.cursor/mcp.json), Windsurf, Cline, Claude Desktop and most
other clients take the common mcpServers form in their server configuration:
{
"mcpServers": {
"snap-maintainer": { "command": "snap-maintainer", "args": ["mcp"] }
}
}
The server provides these tools:
| Tool | What it does |
|---|---|
get_inventory |
Known snaps, their repos, builders and last verdicts. Read-only and fast. |
discover_snaps |
Same as discover. |
check_snaps |
Same as check, with progress updates. |
rebuild_plan |
Same as plan, as Markdown or JSON. Read-only. |
set_repo, set_build |
Same as the commands. |
It also provides a maintain_snaps prompt that walks through the whole flow.
Like the command line, the server never builds, uploads or releases anything. Its instructions tell the agent to show you the plan, and to ask before running any upload, release, tag push or workflow, one snap at a time.
The server shares the command line's inventory,
~/.local/share/snap-maintainer/inventory.json. To use another one, set
SNAP_MAINTAINER_INVENTORY or pass -i FILE before mcp.
If check_snaps or discover_snaps says it can't reach the keyring, the MCP client
started the server without your desktop session's DBUS_SESSION_BUS_ADDRESS, so
snapcraft can't read your login. Either pass that variable through in the client's
server configuration, or give the server an exported login instead:
(umask 077; snapcraft export-login - > ~/.config/snap-maintainer-login) # readable only by you
Then set SNAPCRAFT_STORE_CREDENTIALS to that file's contents in the server's
environment.
How it works
Finding the repo
For each snap, the first of these that points to a repo that exists is used:
- A repo you set with
set-repo, or typed at the prompt. - The store listing's source code link.
- A GitHub URL among the listing's website, issues or contact links.
github.com/<your GitHub login>/<snap name>. This catches private snaps, which the public store API can't see.- A prompt, when running in a terminal.
On GitHub, renamed repos are followed (and noted), and the tool records the default
branch, the location of snapcraft.yaml and the workflow files. Repos on other hosts
are recorded but not inspected.
Detecting the builder
| Builder | When |
|---|---|
github-workflow |
A workflow builds the snap (snapcore/action-build, or snapcraft / snapcraft pack in a step). The tool records whether it also uploads (snapcraft upload, snapcore/action-publish), what triggers it (tags, manual dispatch, releases, pushes), and any hard-coded channel. |
launchpad |
A Launchpad snap recipe builds this snap from the repo. |
local |
Neither of the above: build with snapcraft pack on your machine. |
manual |
Only when you set it: you rebuild the snap some other way. |
A workflow or recipe that uploads to the store is preferred over one that only builds. The candidates that weren't chosen are kept in the inventory.
Deciding what needs work
check looks at the most stable published revision of each architecture on the
latest track.
| Signal | Verdict | When |
|---|---|---|
| Security | rebuild |
A Ubuntu Security Notice fixes a package the snap stages, and the fix is in the public Ubuntu archive. |
| Source | update |
The repo has commits since the revision was uploaded, or snapcraft.yaml declares a different version. |
| Upstream | update |
A part's git source has a newer tag than its source-tag, or new commits on the branch it tracks (GitHub only). |
For security, the check is exact when the published snap contains a build
manifest (snap/manifest.yaml). That manifest records the version of every staged
package, so a notice counts only if the snap has an older version than the fix.
Without a manifest, the check is inferred: it works out which packages the snap
stages (its stage-packages plus their dependencies, minus what the base snap
provides), and counts any notice issued after the revision was uploaded.
snapcraft writes the manifest only when building with SNAPCRAFT_BUILD_INFO=1.
Launchpad and snapcore/action-build set it automatically; for local builds, the
plans include it in the build command.
Limitations
- Private snaps can't be downloaded, so their security checks are always inferred.
- Fixes that exist only in Ubuntu Pro (ESM) are shown as notes, because a rebuild can't pick them up.
- Non-security Ubuntu updates, and dependencies bundled by language plugins (pip, npm, cargo, go), aren't checked.
- Repo inspection, workflow detection and branch checks only support GitHub.
- The inferred check reads the base snap's package list from
/snap/<base>/current. If that base isn't installed locally, it may include packages the base already ships.
Data and privacy
- The inventory is written to
~/.local/share/snap-maintainer/inventory.json, the file given with-i, orSNAP_MAINTAINER_INVENTORY. Versions up to 0.1.3 wroteinventory.jsonto the current directory; if one is there and the new file isn't, it's still used, with a warning saying how to move it. - Ubuntu archive and security data is cached for 24 hours in
~/.cache/snap-maintainer(about 20 MB per Ubuntu release and architecture). - Manifests of published revisions are cached there permanently. Each public revision is downloaded once.
- Your Snap Store and GitHub logins stay with
snapcraftandgh; this tool never reads or stores them.
Development
pip install -e '.[mcp]' pytest
python3 -m pytest
Without the mcp package, the MCP server tests are skipped.
License
Metadata
Release files for snap-maintainer 0.1.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| snap_maintainer-0.1.4.tar.gz | 53.7 kB | Without provenance | Details for snap_maintainer-0.1.4.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| snap_maintainer-0.1.4-py3-none-any.whl | Python 3 | none | any | Details for snap_maintainer-0.1.4-py3-none-any.whl |
Total release size: 103.5 kB
Release files / snap_maintainer-0.1.4.tar.gz
| Download URL | snap_maintainer-0.1.4.tar.gz |
|---|---|
| Size | 53.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
77756d52c12a41f92dabe91a5d6bf4e25e82ac558c5215bb7c54cf785b43f256
|
|
BLAKE2b-256 checksum How to use checksums |
869b4b3d72eea92ad6f2691dd9534a50bb7f03f549586f2c278e0ac14ea92fbe
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.4
|
Release files / snap_maintainer-0.1.4-py3-none-any.whl
| Download URL | snap_maintainer-0.1.4-py3-none-any.whl |
|---|---|
| Size | 49.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
6fee2c9c46f0f81bf724ca7665a0f929952baaff16e4feb01721cddd7485d3ae
|
|
BLAKE2b-256 checksum How to use checksums |
950ae1af49e9be1af6dabafd7dd331d45f724a25a5c9f690a2316817e81b2352
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.4
|
Security for snap-maintainer 0.1.4
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.