r/GithubCopilot • u/Atipical-exe • 25d ago
General Copilot agent mode keeps pinning vulnerable package versions, so I built an MCP server + hook that checks them before install (VS Code, open source)
Does this happen to you? Copilot in agent mode writes the package.json, you push, and Dependabot opens a pile of alerts for the versions it just picked. It's 2026, the agent writing the code and the tool flagging it live on the same platform, and they still don't talk before the install.
The version comes from the model's memory, or from a docs tool that returns documentation and never checks the version against advisories.
Why I built it. I measured how often this happens. The benchmark ran on Claude Code (Sonnet 5.5, Opus 5.5, Haiku 5.5; Copilot can run the same models), 12 tasks, two runs each, every project audited with npm audit / pip-audit:
- No tools: 40% to 42% of direct dependencies pinned had a known advisory, about 30 alerts per project.
- Docs for the current release only: 0.3 to 3.5 alerts per project.
- pinright: 0 vulnerable direct pins for all three models, with fewer tokens than the docs-only setup.
I have not benchmarked Copilot agent mode itself yet. If someone wants to try it and share numbers, I'd like to see them.
How it works in VS Code.
- MCP server: check-packages checks the whole dependency list in one call against OSV and deps.dev (advisories, malware records, lookalike names, versions that do not exist) and returns the version to use. get-docs serves docs from the package at the version you pin, so agent mode writes code for the right major.
- Hook: for the times agent mode skips the tools, a pre-install hook reads the install command or the manifest write before it runs and denies a vulnerable pin with the version to use.
- Lockfile audit: pinright audit, with SARIF output and a GitHub Action, so it fits next to code scanning.
Setup: npx -y pinright init (detects VS Code and configures the MCP server and the hook), or the "Install in VS Code" button on the site.
Built with Claude Code in TypeScript. Local, no account, no telemetry, MIT.
Site: https://pinright.dev
Repo: https://github.com/Hiper-AI/pinright
Feedback on the VS Code setup and false positives from the hook are welcome :))


4
u/colablizzard 25d ago
This could have been a prompt.
4
u/ch34p3st 25d ago
Or... crazy idea, but you just use an idempotent low power tool instead of requiring a datacenter.