Check an npm or PyPI package before your AI agent installs it
An AI coding agent that runs npm install or pip install on its own is running code from strangers. A typo in a package name (typosquatting), a package taken over by a new maintainer, or an install script that runs at install time can all reach your machine before anyone reads the code. This guide gives the manual checks first, free, then the one-call version Tolca offers.
1. Check the exact name
- Compare the name character by character with the project's official documentation, not with a search result or a model's suggestion.
- Watch for names one letter away from a popular package, and for scoped names that look official but are not.
- If the package is supposed to be the official SDK of a company, check that the publisher or repository URL belongs to that company.
2. Check the registry page
- npm: open
https://www.npmjs.com/package/NAME. Look at the publish date of the first version, the date of the latest release, the maintainers list, and the linked repository. - PyPI: open
https://pypi.org/project/NAME/. Check the project links, the release history, and the author.
A package created days ago with a famous name, or a package whose maintainer changed recently with no announcement, deserves a closer look before installation.
3. Check the install scripts
On npm, the package.json of the version you install may contain preinstall, install or postinstall scripts. These run on your machine during install. On PyPI, a source distribution (sdist) can run setup.py code during install, while a wheel usually does not. Read these before installing, or install with scripts disabled (npm install --ignore-scripts) when you can.
4. Check known advisories
- The OSV database,
https://osv.dev, aggregates known vulnerabilities for npm and PyPI packages. npm auditandpip-auditcheck your dependency tree against known advisories.
A clean result does not mean the package is safe. It means no known advisory matched at the time of the check.
5. Decide, then pin
Install a specific version, record it in your lock file, and keep a note of why the package was chosen. An agent should not upgrade dependencies silently.
The one-call version
Tolca's pkg-check service (0.003 USD per call, paid per call over x402 or by the MCP tool) returns a verdict for an npm or PyPI package from the registry metadata and the checks above, in one call. Use it as a fast first filter. Keep the manual checks for anything that will run in production.
- API description:
https://tolca.tonbot.ca/openapi.json - MCP endpoint (no authentication):
https://tolca.tonbot.ca/mcp/public - Francais: see the guide "Vérifier un paquet npm ou PyPI avant de l'installer".
What this does not replace
A package check reads public metadata. It does not audit the source code, prove that a maintainer is trustworthy, or protect against a compromised but legitimate release. For code that handles payments, personal data or credentials, a code review and a pinned, reviewed version remain the standard.
POST https://tolca.tonbot.ca/v1/verify-business (x402, USDC on Base) · free in Claude or ChatGPT through MCP: https://tolca.tonbot.ca/mcp/public