@graneth/mcp-server
An account-free Model Context Protocol server that
catches AI-hallucinated dependencies and hardcoded secrets in your staged
changes before you commit — straight inside your AI coding agent.
It exposes a single, always-free tool over stdio:
pre_flight_check
Give it your staged files (path + content). It will:
- Detect hallucinated / slopsquatted packages — every package referenced in
import statements and declared in manifests (
package.json,
requirements*.txt) is checked live against the npm and PyPI registries.
A package that doesn't exist (404) is the hallmark of an AI-invented
dependency an attacker may have pre-registered. → BLOCKED. A manifest
that cannot be parsed is reported, never silently skipped. → REVIEW_REQUIRED.
- Flag brand-new packages (published < 30 days ago) — the prime
slopsquatting attack window. → REVIEW_REQUIRED.
- Catch hardcoded secrets — known credential patterns (AWS, GitHub, Slack,
OpenAI
sk-…/sk-proj-…, Anthropic sk-ant-…, Stripe sk_live_…, PEM
private keys) plus Shannon-entropy analysis with semantic variable-name
context. → BLOCKED / REVIEW_REQUIRED. Vendor-documented sample keys
and secrets in test/fixture files are downgraded to warnings — surfaced, but
they won't block a commit.
No Graneth account, API key, or hosted backend is required. The checks run
locally; the only network calls are to the public npm/PyPI registries.
Install / run
npx -y @graneth/mcp-server
Configure your agent
The snippet is the same everywhere; only the file it goes in (or the CLI
command) differs per client:
{
"mcpServers": {
"graneth": {
"command": "npx",
"args": ["-y", "@graneth/mcp-server"]
}
}
}
| Claude Code (CLI) | claude mcp add --transport stdio graneth -- npx -y @graneth/mcp-server | Writes to ~/.claude.json (local scope, default). Add --scope project to write a shareable .mcp.json at the repo root instead. |
| Cursor | Paste the snippet above | ~/.cursor/mcp.json (global) or <project-root>/.cursor/mcp.json (this project only) |
| Windsurf | Paste the snippet above | ~/.codeium/windsurf/mcp_config.json (macOS/Linux) · %USERPROFILE%\.codeium\windsurf\mcp_config.json (Windows) |
| Claude Desktop | Paste the snippet above | macOS: ~/Library/Application Support/Claude/claude_desktop_config.json · Windows: %APPDATA%\Claude\claude_desktop_config.json |
Then ask your agent to run pre_flight_check before suggesting a commit. A
BLOCKED verdict means: do not commit until the CRITICAL findings are fixed.
Verdicts
CLEAR | No issues — safe to commit. |
REVIEW_REQUIRED | Warnings to confirm (new packages, lower-confidence). |
BLOCKED | Critical issues (non-existent package / secret) — do not commit. |
How it relates to Graneth
This server shares its detection core with the hosted
Graneth scanner via the internal @graneth/core-checks
module, so local pre-flight results match what the full PR scan would find.
License
MIT