Hallucinated package names, typo-squats and hijacked maintainers are the cheapest attack on an AI agent. Here is what to check, in the order that catches the most.
Why this is the highest-value check
An agent that invents a dependency name does not get a warning; it gets an install. If the invented name is already registered by someone else, the agent has just run their code with your credentials in the environment. That is the whole attack, and it needs no prompt injection at all.
Check in this order
- Does it exist? A 404 on the registry is the loudest possible signal, and the one agents skip.
- Is the name one edit away from a popular package?
reqeusts,lodahs,python-dateutilvsdateutil. Compare against download counts, not against your memory. - How old, how maintained? A package published last week with one release and no repository is not a dependency, it is a payload.
- Does it run code at install time? npm
postinstalland Python build backends execute on install. Read them or refuse them. - Any advisory or yank? A yanked release is a maintainer telling you something.
- Do the maintainers match? A sudden new publisher on an old package name is a takeover, not a release.
Make it a tool call, not a habit
Habits do not survive an agent running twenty steps unattended. The check has to be something the agent calls, with a verdict it can branch on. check_package takes an ecosystem and one or more names and returns a verdict per package with the evidence behind it, so the agent can stop before npm install rather than after.
{ "name": "check_package", "arguments": { "ecosystem": "npm", "name": "left-pad" } }Try it on a real call. The hosted MCP endpoint answers 50 calls per IP per day without a signup, then 0.01 USDC per call over x402 on Base.
Pricing and endpoint Repository
claude mcp add slf-guardian -- npx -y slf-guardian-mcp