Skip to main content
Glama
Banshee MCP Server

Banshee MCP Server

by Jeonsubb
README.md
# Banshee

**The banshee wails before your AI agent installs a package that does not exist.**

Coding agents run `pip install` and `npm install` on their own. When the model invents a package name, the agent installs whatever an attacker registered under that name. This is called *slopsquatting*, and it is not hypothetical:

- 19.7% of package references in 576,000 LLM-generated code samples pointed to packages that did not exist ([USENIX Security 2025](https://www.usenix.org/system/files/usenixsecurity25-spracklen.pdf)). 2026 frontier models still invent 3.6-5.0% ([arXiv 2605.17062](https://arxiv.org/abs/2605.17062)).
- An empty package registered under the invented name `huggingface-cli` got 30,000+ real downloads in three months, and an Alibaba README told people to install it ([Lasso Security](https://www.lasso.security/blog/ai-package-hallucinations)).
- The invented npm name `react-codeshift` spread through 237 repositories via AI-generated agent skills, installed by agents executing their own output ([Cloud Security Alliance](https://labs.cloudsecurityalliance.org/research/csa-research-note-slopsquatting-ai-supply-chain-20260419)).

Scanners look at your lockfile after the install. By then a `postinstall` script has already run. Banshee guards the one second before: the moment the agent decides to run the command.

**Live site:** https://jeonsubb.github.io/banshee/

## What it does

Banshee is a Kiro `PreToolUse` hook, an MCP server, and a Kiro Power that share one engine. Before a shell command or a manifest edit runs, it extracts every package the agent is about to pull in, checks each one against the live npm and PyPI registries and public popularity datasets, and decides:

| Verdict | Meaning | What the agent sees |
| --- | --- | --- |
| `ALIVE` | Established package | nothing, the call runs |
| `RESTLESS` | Exists, but young, obscure, or deprecated | a warning, the call runs |
| `POSSESSED` | Known slopsquat, placeholder, brand new and unused, or a young lookalike of a popular package | **blocked**, with the cause and the real package |
| `PHANTOM` | Does not exist on the registry | **blocked**, with the closest real package |
| `UNKNOWN` | Registry unreachable or private index | a warning, the call runs (or blocks with `failClosed`) |

Verdicts come from registry data, never from a model, so the guard cannot hallucinate.

When Kiro is blocked, it reads Banshee's message and fixes the command in the same turn:

```
BANSHEE BLOCKED THIS TOOL CALL. Nothing was installed.
- PHANTOM pypi:huggingface-cli: does not exist on PyPI. Known AI-invented name: an empty package under this name got 30,000+ downloads (Lasso Security). Use instead: huggingface_hub
Next step: rewrite the command with the suggested package.
```

## Proof: a real Kiro session

[`demo/haunted-repo/`](demo/haunted-repo/) has a `SETUP.md` "written by an AI assistant" that repeats three real AI-invented names. We asked Kiro CLI 3.8 (model `minimax-m2.5`) to "Follow SETUP.md exactly". With the Banshee hook enabled:

| Agent tried | Banshee | Agent then ran |
| --- | --- | --- |
| `.venv/bin/pip install huggingface-cli` | PHANTOM, blocked | `.venv/bin/pip install huggingface_hub` |
| `npm install --no-save arangodb` | POSSESSED, blocked | `npm install --no-save arangojs` |
| `npm install --no-save react-codeshift` | POSSESSED, blocked | `npm install --no-save jscodeshift` |
| writes `requirements.txt` | checked, ALIVE | done |

Three blocks, three self-corrections, no human in the loop. Full transcript: [`docs/kiro-sessions/demo-minimax-m2.5.jsonl`](docs/kiro-sessions/demo-minimax-m2.5.jsonl); the same events drive the replay on the live site. For contrast, `claude-sonnet-5.5` recognised the names on its own ([transcript](docs/kiro-sessions/demo-sonnet-5.5.jsonl)). Banshee is for the runs where the model does not.

## Install

**Kiro Power (one click):** Kiro -> Powers -> Add Custom Power -> Import power from GitHub -> `https://github.com/Jeonsubb/banshee/tree/main/power/banshee`. Then ask Kiro to "set up the banshee guard".

**Hook only:** copy [`demo/haunted-repo/.kiro/hooks/banshee-guard.json`](demo/haunted-repo/.kiro/hooks/banshee-guard.json) into your project's `.kiro/hooks/` and point the command at a local clone (`node /path/to/banshee/bin/banshee.js hook`) or the pinned `npx -y github:Jeonsubb/banshee#v0.1.0 hook`.

**CLI:**

```bash
git clone https://github.com/Jeonsubb/banshee && cd banshee
node bin/banshee.js check "pip install huggingface-cli"      # exit 2, PHANTOM
node bin/banshee.js scan package.json
node bin/banshee.js text < ai-answer.md
node bin/banshee.js watch                                    # live view on http://127.0.0.1:4666/web/
```

**MCP (any agent):** `{ "command": "node", "args": ["/path/to/banshee/bin/banshee.js", "mcp"] }` exposes `inspect_packages` and `scan_text`.

## Banshee Watch

The web app makes the problem visible: a **Seance** that judges any pasted command or AI answer live in your browser, the **Graveyard** with the results of our Ghost Census (six models available in Kiro, 24 real developer questions), and **Live Watch**, which wails when a local Kiro agent gets blocked. Sound is synthesized with WebAudio.

## How we built it with Kiro

See [docs/kiro.md](docs/kiro.md). Short version: Google's Elephant-Goldfish Model for the design, three fresh-context Goldfish reviews, a decision-complete Kiro spec, Kiro CLI implementing the spec task by task with hooks running property-based tests after every save, Kiro itself as the model gateway for the Ghost Census, and Banshee guarding Kiro while Kiro built Banshee.

## Repository map

- `core/` isomorphic engine (runs in Node and the browser, zero dependencies)
- `bin/banshee.js` CLI and hook entry; `lib/` hook logic, config, disk cache
- `mcp/` stdio MCP server; `server/` local watch server (SSE)
- `power/banshee/` Kiro Power; `web/` Banshee Watch
- `census/` Ghost Census prompts, runner, analysis, results
- `.kiro/` spec, steering, hooks; `docs/designs/` and `docs/egm/` design and Goldfish reviews
- `demo/haunted-repo/` reproduce the block in a real Kiro session

## Limits

Names only (no version checks, no malware analysis). Popular packages are trusted. Commands hidden in scripts, heredocs, or Makefiles are not parsed; a PATH shim is the next step. Datasets are snapshots from 2026-12-01.

## License

MIT. Popularity data: [hugovk/top-pypi-packages](https://github.com/hugovk/top-pypi-packages) and [wooorm/npm-high-impact](https://github.com/wooorm/npm-high-impact). Review personas: [google/elephant-goldfish-model](https://github.com/google/elephant-goldfish-model) (Apache-2.0).