Graveward MCP Server
by acirema792
README.md
<p align="center"><img src="docs/screenshots/graveyard-hijack-week.png" alt="Graveward's graveyard: the three hijacked packages from September 2025 stand as chained red CURSED headstones among healthy ones" width="820"></p>
# Graveward
**Graveward stands between your AI coding agent and `npm install`, so nothing dead, cursed or imaginary gets into `node_modules`.**
[](BENCHMARK.md)
[-41%2F41-7bc47f)](BENCHMARK.md#held-out-set)
[](BENCHMARK.md#false-positive-controls)
[](LICENSE)
[](KIRO.md)
**[Live graveyard](https://acirema792.github.io/graveward/)** · **[Review it in 5 minutes](JUDGES.md)** · **[How Kiro built it](KIRO.md)** · **[Benchmark](BENCHMARK.md)** · **[Every claim and its evidence](CLAIMS.md)** · **[Feedback for the Kiro team](FEEDBACK.md)** · **[Demo video (2:32)](https://youtu.be/uD4dsnvAmJM)** · **[Blog post](https://dev.to/oscar_ariza_7f9e69098e388/my-ai-agent-ran-npm-install-on-a-hijacked-package-heres-the-ward-i-built-with-kiro-to-stop-it-2omf)**
---
## The problem
- **Agents install packages now.** Kiro and other coding agents run `npm install` themselves, often without a human reading the name.
- **Models invent package names.** A USENIX Security 2025 study of 16 code LLMs collected **205,474 unique hallucinated package names** ([Spracklen et al.](https://www.usenix.org/conference/usenixsecurity25/presentation/spracklen)). Anyone can register one ("slopsquatting").
- **Real packages get hijacked.** In September 2025 a phished maintainer's account pushed malware into chalk, debug and 16 other packages with **about 2 billion weekly downloads** ([The Hacker News](https://thehackernews.com/2025/09/20-popular-npm-packages-with-2-billion.html)).
- **Dead packages linger.** `request` has been deprecated since 2020 and still gets installed every day.
Install-time checkers exist (for example npq, Socket CLI, Aikido Safe Chain). Graveward's difference is **who it talks to**: it answers the *agent*, at the moment the agent decides, with a reason the agent can act on and a living replacement — and it ships as a Kiro hook, an MCP server and a Kiro Power, free, with no account or API key.
## What it looks like in Kiro
You paste an install command from a tutorial with a typo: `loadsh`, a real, live typosquat of lodash (over 10,000 downloads a week). Graveward's `PreToolUse` hook stops the shell command before it runs:
```text
Graveward blocked 1 package(s). Do not install them. Use the suggested successor instead, or ask the user.
- loadsh: CHANGELING (changeling-pattern: Similar to popular package "lodash") Try: lodash
```
Kiro reads that, installs `lodash` instead, and tells you why. A hijacked *version* is even sneakier: in [`examples/hijacked-app`](examples/hijacked-app/README.md) the manifest pins `ua-parser-js@0.7.29`; Kiro runs `npm install`, the guard blocks it (CURSED, try 0.7.33) and Kiro moves the pin ([raw log](.kiro/logs/demo-session-3.log)). Careful agents sometimes catch a bad name on their own; Graveward makes it deterministic for every model and every session ([four real sessions, reported as they happened](docs/kiro-demo-transcript.md)). Try it yourself in [`examples/haunted-app`](examples/haunted-app/README.md).
## The verdicts (the spooky names *are* the function)
| Verdict | Headstone | Meaning | Hook action |
|---|---|---|---|
| **PHANTOM** | translucent outline | The name does not exist on npm: likely hallucinated, and anyone could register it | BLOCK |
| **CURSED** | chains, red runes | This version is known malicious (OSV `MAL-*` or CWE-506) or npm replaced it with a security holding package | BLOCK |
| **CHANGELING** | mask | A look-alike of a popular package (edit distance, separator folding, download ratio) | BLOCK, suggests the real one |
| **DECEASED** | cross | Its author deprecated the package | WARN + successor |
| **ABANDONED** | cracked | Its source repository is archived | WARN |
| **ZOMBIE** | rising hand | Package alive, but this version is deprecated or has known vulnerabilities | WARN + fixed version |
| **DORMANT** | unlit candle | Old but no negative evidence (finished packages like `ms`) — *investigated, not accused* | ALLOW |
| **ALIVE** | sprouting stone | Maintained, nothing known | ALLOW |
| **UNKNOWN** | grey | A data source failed; we say so instead of guessing | ALLOW (with a note) |
**Every spooky element in the graveyard is a measurement, not decoration:**
| You see | It encodes | Source in code |
|---|---|---|
| The headstone's shape | its verdict (table above) | [`verdicts.ts`](web/src/results/verdicts.ts) `SHAPE_OF` |
| How tall it stands | how many packages in the tree depend on it (1 for a leaf, up to 5) | [`stone-model.ts`](web/src/results/stone-model.ts) `heightFor` |
| How far back it stands | front row = your direct dependency; deeper rows recede into the fog | [`stone-model.ts`](web/src/results/stone-model.ts) |
| How thick the fog is | the share of packages that are not ALIVE | [`summary.ts`](web/src/results/summary.ts) `fogDensity` |
| The autopsy drawer | the evidence behind the verdict, each line linked to its source | [`autopsy-drawer.tsx`](web/src/components/autopsy-drawer.tsx) |
A healthy project is a clear night with sprouting stones; a hijacked one is fog and red chains. The **Ledger** view shows the same data as an accessible table.
**Code decides, never a model.** Every verdict is a fixed rule over public data (npm registry, [OSV](https://osv.dev), [deps.dev](https://deps.dev) / OpenSSF Scorecard, npm download counts) and carries its evidence with a source link. The rules and their precedence are published on the site's [Rules of the coroner](https://acirema792.github.io/graveward/#/rules) page, which is generated from the engine's own thresholds.
## Results
| Check | Result |
|---|---|
| Benchmark: 54 real packages, expected verdicts **committed before any code existed** ([`884dc3c`](https://github.com/acirema792/graveward/commit/884dc3c)) | **54/54** verdict *and* gate decision |
| Held-out set: 41 packages, **committed by SHA-256 only** before the classifier fixes and hidden from Kiro until revealed in [`d4ce319`](https://github.com/acirema792/graveward/commit/d4ce319) (later fixes could see it) | **41/41** |
| Dangerous installs blocked (phantom, cursed, look-alike) | **41/41** across both sets |
| False blocks on packages that should pass | **0/54** across both sets |
| Real-world control: every package in the full dependency trees of next, eslint, vite, express, fastify | **0 blocks in 308 packages** |
How the numbers are produced, and how to reproduce them: [BENCHMARK.md](BENCHMARK.md).
## Built with Kiro
Kiro CLI (V3, headless) wrote the specs and the code; every prompt and transcript is committed in [`.kiro/logs/`](.kiro/logs/). Full story, including where Kiro fell short and how we caught it: **[KIRO.md](KIRO.md)**.
| Kiro feature | Where |
|---|---|
| Spec-driven development (requirements-first, Quick Spec, Bugfix spec) | [`.kiro/specs/`](.kiro/specs/) — 4 specs |
| Steering (always + `fileMatch` design system) | [`.kiro/steering/`](.kiro/steering/) |
| Agent hooks: `Stop` done-means-done gate, `PreToolUse` guard (the product, dogfooded), `PostFileSave` manifest scan | [`.kiro/hooks/`](.kiro/hooks/) |
| Custom agents: `dependency-warden`, read-only `judge-auditor` | [`.kiro/agents/`](.kiro/agents/) |
| MCP server (`graveward_check_packages`, `graveward_scan_manifest`, `graveward_suggest_replacement`) | [`packages/mcp`](packages/mcp), [`.kiro/settings/mcp.json`](.kiro/settings/mcp.json) |
| Kiro Power | [`power/graveward/`](power/graveward/) |
| Property-based tests from the specs' correctness properties | `packages/*/test/*.property.test.ts`, `web/test/` |
| Parallel Kiro sessions in git worktrees; model choice per job | [KIRO.md](KIRO.md) |
## Try it
**In Kiro (60 seconds).** Copy one file and one hook into your project:
```bash
mkdir -p .kiro/hooks
curl -fsSL https://raw.githubusercontent.com/acirema792/graveward/main/bin/graveward.mjs -o .kiro/graveward.mjs
cat > .kiro/hooks/graveward-guard.json <<'JSON'
{"version":"v1","hooks":[{"name":"Graveward guard","trigger":"PreToolUse","matcher":"shell",
"action":{"type":"command","command":"node .kiro/graveward.mjs hook"},"timeout":30}]}
JSON
```
**In the browser.** Open the [live graveyard](https://acirema792.github.io/graveward/), click a sample or paste a `package.json`, a lockfile (`package-lock.json`, `pnpm-lock.yaml` or `yarn.lock`), an install command or a GitHub URL. Everything runs in your browser against public APIs.
**On the command line** (Node ≥ 20; the bundles are committed, nothing to build):
```bash
node bin/graveward.mjs check request nodemailer-pro loadsh # exit 2 when something must be blocked
node bin/graveward.mjs scan package-lock.json --markdown
```
**In CI** (fails the job on any BLOCK):
```yaml
- uses: acirema792/graveward@main
with:
file: package-lock.json
```
## Honest limits
- Verdicts are only as fresh as npm, OSV and deps.dev. npm usually removes hijacked versions within hours; Graveward's CURSED check matters most in that window and for lockfiles, mirrors and caches that keep serving removed versions.
- CHANGELING compares against a bundled list of popular packages and their download counts (`packages/core/src/data/popular.json`); a look-alike of a package outside that list is not detected.
- When a data source rate-limits or fails, the verdict is UNKNOWN (or, for a possible look-alike, a warning) rather than a guess.
- The hook reads shell commands; it cannot see packages installed by other tools the agent might call. When a command hides its packages (a variable it cannot resolve, `$(...)`, `$1`), the hook says so to the agent instead of guessing.
- Lockfile parsers skip names npm no longer accepts for new packages (dotted scopes like `@jsonjoy.com/*`, old uppercase names like `JSONStream`), so those go unchecked.
- By default an UNKNOWN (a source failed) is allowed with a note to the agent; set `GRAVEWARD_FAIL_CLOSED=1` in the hook's environment to block unverifiable packages instead.
## Project layout
```
.kiro/ specs, steering, hooks, custom agents, MCP settings, logs of every Kiro run
packages/core the engine: parsers, data sources, rules (browser-safe, no Node built-ins)
packages/cli graveward CLI: check, scan, hook
packages/mcp MCP server
power/ Kiro Power
web/ the graveyard (Vite + React), deployed to GitHub Pages
eval/ benchmark cases, held-out set, black-box runners and results
bin/ committed single-file bundles of the CLI and the MCP server
examples/ haunted-app: a Kiro workspace guarded by Graveward
```
Development: `npm install && npm run build --workspaces --if-present && node scripts/gate.mjs` (build before `npx vitest --run`: the tests import the built workspace packages). After changing `packages/`, run `npm run bundle` and commit `bin/`.
## License
[MIT](LICENSE). Built for [Kiroween 2026](https://kiroween.devpost.com/) (Costume Contest).
This server cannot be deployed
Maintenance
ActivityMaintained
ResponsivenessNo recent community issues