Your agent's MCP config
An agent starts every server in .mcp.json with your credentials, and uvx some-server runs whatever was released that day. buckthorn check .mcp.json fetches the release each server would start and reads it first.
Buckthorn / Open source · MIT · 0.1 preview
Buckthorn is a static checker for Python and npm packages. It reads the wheel, sdist or tarball, and tells you whether installing it, starting Python or importing it would run code. Nothing is installed, imported or run.
The problem
pip install runs setup.py. A .pth file in a wheel runs every time Python starts. import runs whatever the package's __init__.py says. A malicious package needs no exploit. It only needs you to install it.
Buckthorn reads that code first, straight from the archive, and tells you what it would do.
$ buckthorn scan colourful_logs-1.4.2-py3-none-any.whl colourful_logs-1.4.2-py3-none-any.whl: flagged high BKT-HIDE-001 colourful_logs/__init__.py:2 exec of data decoded by base64.b64decode medium BKT-PTH-001 colourful_logs-1.4.2.pth:1 .pth line runs code at every Python start 1 scanned: 1 flagged
What it is for
An agent starts every server in .mcp.json with your credentials, and uvx some-server runs whatever was released that day. buckthorn check .mcp.json fetches the release each server would start and reads it first.
buckthorn diff requests==2.32.3 requests==2.32.4 shows only what the new version adds. If a maintainer account is taken over, the new code is in that diff.
buckthorn check uv.lock fetches every pinned file, checks its hash and reads it, before anything is installed. Accept what is there today with --write-allowlist, and from then on only new behaviour fails the build.
npm tarballs, and the code a Hugging Face repo runs with trust_remote_code=True. Newer than the Python side, and called preview until we have measured them on packages they have never seen.
Measured
We tested Buckthorn next to GuardDog on 5,723 benign files and 430 malicious archives that none of its rules had seen. The plan was committed before the first scan, so the numbers could not be tuned after the fact.
That is about a quarter of the false alarms. And it held up: on the top 1,000 packages we tuned on, Buckthorn flagged 6.9% of files. On packages it had never seen, 5.4%.
When it flags, it is usually right about what it saw. Of 50 flags we checked by hand, 42 were the package really doing what the rule describes, like a .pth file that runs at start-up. It also finished every file, with no errors or timeouts.
Better together. The two tools see different things. Buckthorn caught 26 malicious archives that GuardDog's threat rules missed. Run both, and 74.7% of the malicious set is caught, against 68.6% for GuardDog alone.
On its own, GuardDog catches more of the malware. Buckthorn reads what runs at install, at start-up and at import, and leaves code you call yourself to other tools. We believe the gate in front of every install has to be quiet first, because a noisy gate gets switched off.
Self-measured. GuardDog 3.2.0, threat rules, run offline, so its metadata rules did not run. Buckthorn at commit c80b090, from before the fixes in 0.1. The full write-up has 95% intervals, the protocol and every result.
How it works
Archives are read in memory, with limits on how many files and how many bytes. No pip install, no setup.py egg_info, no build backend call. Code is parsed, never imported or run.
In setup.py, only the commands pip runs count as install code. A publish shortcut that never runs at install is a note, not an alarm. When it cannot be sure, it counts the whole file.
exec of base64-decoded data, and builtins reached through getattr with a name built at run time. A package that hides its code is flagged for the hiding alone.
A file it could not read is not_verified, never clean. A package cannot buy a clean verdict with a file Buckthorn gives up on.
Ways to run it
requirements.txt with hashes, uv.lock and poetry.lock, each file hash-checked.Open source
Buckthorn needs Python 3.11 or newer and one dependency, packaging. scan makes no network calls. check and diff fetch only from PyPI over https, and check each file's sha256 before reading it. MIT licensed. The most useful thing you can send us is a package it gets wrong.