π Documentation Β· π Getting Started Β· π‘ API Reference
A local NPM registry built for the age of AI coding agents.
Lightweight. Security-first. Blazing fast.
π€ MCP Ready Β· π‘οΈ Quarantine-First Security Β· β‘ 1ms Response Time Β· πΈοΈ Dependency Graph
AI coding agents are transforming software development. Tools like Cursor, Windsurf, and Claude Code can write, test, and publish entire packages autonomously. But there's a critical gap: when AI agents install dependencies, they blindly trust everything from npmjs.org β including packages that contain prompt injection attacks, malicious install scripts, or supply chain exploits designed specifically to compromise AI workflows.
AgentRegistry was born from a simple question: what if your local registry could protect your AI agents the same way a firewall protects your network?
AgentRegistry is a private, local NPM registry that sits between your AI agents and the public npm ecosystem. Every package β whether published locally or fetched from upstream β is security-scanned in real time. Suspicious packages are quarantined and require human approval before any agent can use them. This creates a human-in-the-loop security boundary that prevents supply chain attacks without slowing down your workflow.
- π SOTA prompt injection detection β 10-pass scanner based on 2025-2026 academic research, resistant to homoglyphs, leetspeak, FlipAttack, Policy Puppetry, and GCG adversarial suffixes
- π Quarantine-first architecture β Unknown packages are blocked by default, not allowed by default
- π€ Agent-native APIs β MCP protocol,
llms.txt, OpenAPI spec, structured error responses with AI directives - β‘ ~1ms response time β Memory-first cache means agents don't wait
- π Localhost-only β Your packages never leave your machine
| Pain Point | Traditional Registries | AgentRegistry |
|---|---|---|
| Dependencies | 60+ packages to install | 2 dependencies (tar, acorn) |
| Setup Time | Minutes of configuration | One command: bun run start |
| AI Integration | None | Native MCP, llms.txt, OpenAPI |
| Security | Afterthought (plugins) | Quarantine-first architecture |
| Response Time | 50-200ms | ~1ms (memory-first cache) |
| Admin UI | Static page refreshes | Real-time WebSocket dashboard |
β οΈ Alpha Software (0.1.0) β AgentRegistry is under active development. APIs may change. Contributions and feedback welcome!
# Start the server
bun run start
# Or with hot-reload for development
bun run dev
# Custom port
bun run server.ts --port 4874AgentRegistry can run as a background daemon with automatic restart on crash.
# Start daemon in background
bun run cli.ts start
# Check status
bun run cli.ts status
# View logs
bun run cli.ts logs
# Stop daemon
bun run cli.ts stop
# Restart
bun run cli.ts restart# Install as system service (auto-start on boot)
npm run install-service
# Remove service
npm run uninstall-service| File | Location |
|---|---|
| PID file | ~/.agentregistry/agentregistry.pid |
| Logs | ~/.agentregistry/logs/agentregistry.log |
| launchd plist | ~/Library/LaunchAgents/com.agentregistry.daemon.plist |
Point your npm/bun client to the local registry:
# NPM
npm config set registry http://localhost:4873
# Bun
echo 'registry = "http://localhost:4873"' >> bunfig.toml
# Per-project (.npmrc)
echo "registry=http://localhost:4873" > .npmrc# Standard npm publish
npm publish
# Or with bun
bun publishnpm install my-package
bun add my-packagenpm unpublish my-package@1.0.0Create a ready-to-publish TypeScript package:
agentregistry create my-pkgBump version and publish in one command:
agentregistry release patch
# or minor, majorCheck for environment issues (permissions, connectivity):
agentregistry doctorVisualize your local ecosystem at http://localhost:4873/-/admin (Graph tab).
Create a full snapshot (database + storage):
agentregistry backup
agentregistry restore <file.zip>| Method | Endpoint | Description |
|---|---|---|
GET |
/ |
List all packages |
GET |
/-/ping |
Health check |
GET |
/{package} |
Get package metadata |
GET |
/{package}/{version} |
Get specific version |
GET |
/{package}/-/{tarball}.tgz |
Download tarball |
PUT |
/{package} |
Publish package |
DELETE |
/{package}/-/{tarball}/{rev} |
Unpublish version |
β οΈ Authentication Required: All admin API endpoints requireX-Admin-Tokenheader. Token is auto-injected in the admin panel UI.
| Method | Endpoint | Description |
|---|---|---|
GET |
/-/admin |
Admin panel UI (no auth required) |
GET |
/-/admin/stats |
Server stats (memory, cache, etc.) |
GET |
/-/admin/quarantine |
List quarantined packages |
DELETE |
/-/admin/quarantine |
Clear all quarantine |
DELETE |
/-/admin/quarantine/{file} |
Delete specific file |
POST |
/-/admin/quarantine/{file}/approve |
Approve and cache |
GET |
/-/admin/cache |
List cached packages |
DELETE |
/-/admin/cache/{name} |
Delete package |
POST |
/-/admin/cache/{name}/refresh |
Force refresh from NPM |
Recommended: Use WebSocket (/-/admin/ws) for all admin operations. The admin panel uses WebSocket automatically.
Access the admin panel at http://localhost:4873/-/admin
Features:
- π Server stats: Uptime, memory, cache size, scan metrics
- π Quarantine management: View blocked packages, approve or delete
- π¦ Cache control: Delete or force-refresh packages
- πΈοΈ Dependency Graph: Interactive D3.js force-directed visualization with local-only filter
- π‘οΈ IP Allowlist: Configure access control with CIDR/wildcard patterns
- π Sortable Tables: Click column headers to sort data (asc/desc toggle)
- π Audit Logs: Security event tracking with sortable columns
- π Real-time Metrics: RPS, latency, cache hit rate dashboard
- π Auto-refresh: WebSocket-powered live updates
Packages are stored locally in:
storage/packages/- JSON metadatastorage/tarballs/- Validated package tarballs (.tgz)storage/quarantine/- Pending security scan (temporary)storage/backups/- Timestamped backup copies of all published packages
# First, start the server (required for tests)
bun start
# In another terminal, run tests
bun test
β οΈ Some tests (Admin Panel, Agent-First API, Documentation Site) require a running server to pass.
| Category | Tests | Status |
|---|---|---|
| Prompt Injection Scanner | 154 | β |
| Server API | 72 | β |
| Database Module | 54 | β |
| IP Allowlist | 52 | β |
| Admin Panel | 48 | β |
| Security Module | 52 | β |
| CVE Module | 39 | β |
| Helpers & HTTP | 29 | β |
| Validation | 28 | β |
| Documentation Site | 26 | β |
| Agent-First API | 25 | β |
| Metrics Module | 25 | β |
| Services (Cache & Broadcast) | 24 | β |
| Package Allowlist | 21 | β |
| Upstream Module | 18 | β |
| Health Check | 16 | β |
| Daemon | 13 | β |
| Broadcast | 10 | β |
| WebSocket Tests | 10 | β |
| Compression | 9 | β |
| Logger | 9 | β |
| Allowlist | 8 | β |
| CLI | 6 | β |
| Unit Tests | 3 | β |
| AST Scanner | 179 | β |
| Total | 650+ | β |
AgentRegistry automatically maintains itself:
| Feature | Interval | Details |
|---|---|---|
| Log Cleanup | Every 6 hours | Removes request logs >7 days, audit logs >30 days |
| Quarantine Auto-Approve | On startup | Re-scans quarantine, approves packages that now pass |
| Security Alerts | Kept forever | Blocked packages and security events are never deleted |
When a package is blocked by security scan, AgentRegistry returns detailed JSON with:
- Clear explanation of what happened
action_required: "HUMAN INTERVENTION REQUIRED"- Step-by-step
instructionsarray for resolution - Direct link to admin panel
- Location of quarantined package
β οΈ LOCALHOST ONLY - This server is hardened for local use only.
| Layer | Protection |
|---|---|
| Network | Binds to 127.0.0.1 only (not 0.0.0.0) |
| Host Check | Rejects requests from non-localhost hosts (403) |
| Input Validation | Strict regex for package names and versions |
| Path Traversal | Blocks ../, null bytes, enforces basename() checks |
| XSS Protection | Output encoding via escapeHtml() on all render paths |
| Length Limits | Package names max 214 chars |
| Security Scanner | Static analysis before caching (~10-50ms) |
| Quarantine | All upstream packages scanned before cache |
All packages fetched from npmjs.org go through security scanning:
npm install lodash
β
π₯ Download from npmjs.org
β
π Write to storage/quarantine/
β
π Security scan (~10-50ms)
β
β
SAFE β Move to storage/tarballs/ + memory cache
π¨ BLOCKED β Stays in quarantine, returns 403
| Severity | Patterns Detected |
|---|---|
| Critical | eval(), new Function(), `curl |
| High | child_process, exec(), SSH/npmrc access, base64 payloads |
| Medium | File system writes, .env access, prototype pollution |
| Low | process.env access |
The prompt injection scanner uses a research-backed 10-pass analysis pipeline to detect LLM manipulation attempts hidden in package metadata, READMEs, and code comments:
| Pass | Technique | Catches |
|---|---|---|
| 1 | Raw content scan | Literal injection patterns in 5 languages |
| 2 | Unicode normalization + homoglyphs | Cyrillic/Greek/fullwidth character substitution |
| 3 | Leetspeak decode | 1gn0r3 4ll pr3v10us 1nstruct10ns |
| 4 | ROT13 decode | ROT13-encoded payloads |
| 5 | FlipAttack reversal | Character-reversed injection strings |
| 6 | Reconstruction patterns | String.fromCharCode(), reverse().join() |
| 7 | Policy Puppetry | Config format mimicry (INI/JSON/XML/YAML) |
| 8 | MCP injection | Tool description injection, line jumping |
| 9 | Adversarial suffix | GCG-style high-entropy gibberish detection |
| 10 | Invisible characters | Zero-width, tag characters, BiDi overrides |
Cross-field payload splitting: Metadata fields are concatenated and rescanned to catch payloads split across name, description, and keywords.
| Attack Vector | Paper/Source | Detection Method |
|---|---|---|
| Homoglyph substitution | ACL 2025 (42-59% ASR) | NFKD + 75 character mappings |
| Leetspeak obfuscation | HiddenLayer, April 2025 | Digitβletter substitution |
| Policy Puppetry | HiddenLayer, April 2025 | Config format pattern matching |
| FlipAttack | ACL 2025 (98% GPT-4o bypass) | Reverse content scanning |
| GCG adversarial suffixes | Zou et al., 2023 | Shannon entropy + punctuation analysis |
| Payload splitting | OWASP LLM01:2025 | Cross-field concatenation |
| MCP line jumping | MCP security research, 2025 | Tool description pattern matching |
| Invisible Unicode | Unicode Consortium TR36 | Zero-width/tag character detection |
154 prompt injection tests (30 SOTA adversarial) Β· 100% line coverage Β· 97% function coverage
β οΈ The AST deep scanner is one approach to complementing regex-based scanning with lightweight AST analysis. Well-tested (179 tests, 99% coverage) and effective within its scope β but not a replacement for dedicated tools like Semgrep or CodeQL. See known limitations β
Opt-in only β never runs automatically. Trigger via CLI (agentregistry scan --deep) or Admin Panel UI ("π¬ Scan" button).
| Pattern | Severity | Detects |
|---|---|---|
eval_family |
Critical | eval(), new Function() |
encoded_payload_exec |
Critical | eval(atob(...)), encoded execution |
process_spawn |
Critical | child_process.exec(), shell commands |
network_exfiltration |
Critical | HTTP requests with sensitive data |
dynamic_require |
Critical | require(variable) |
computed_member_exec |
High | global["ev"+"al"]() |
prototype_pollution |
High | __proto__ writes |
timer_obfuscation |
Medium | setTimeout("code", 0) |
iife_with_suspicious_args |
Medium | Suspicious IIFE arguments |
Includes lightweight constant propagation (tracks const x = "literal" values).
Known limitations: No data-flow, interprocedural, or control-flow analysis. Cannot track values across function boundaries or detect multi-file payloads.
179 tests Β· 100% function coverage Β· 99.41% line coverage β Full docs β
- Zou et al. β Universal and Transferable Adversarial Attacks on Aligned Language Models (GCG, 2023)
- HiddenLayer β Policy Puppetry: A Universal Jailbreak for LLMs (April 2025)
- ACL 2025 β FlipAttack: Jailbreak LLMs via Flipping (78.97% ASR, 98% GPT-4o bypass)
- ACL 2025 β Homoglyph Attack Analysis (42-59% success rate)
- OWASP β Top 10 for LLM Applications 2025 (LLM01: Prompt Injection)
- MCP Security β Tool Description Injection via Line Jumping (2025)
- Unicode Consortium β TR36: Unicode Security Considerations
- npm Supply Chain β Shai-Hulud worm, Chalk/Debug attack, Contagious Interview campaign (2024-2025)
- Package names:
/^(@[a-z0-9-~][a-z0-9-._~]*\/)?[a-z0-9-~][a-z0-9-._~]*$/i - Versions: Strict semver pattern
- Paths: Containment check - all file operations stay within
storage/
This registry is designed for:
- β Local agent-to-agent package sharing
- β Development and testing
- β NOT for public internet exposure
- β NOT for multi-user production environments
AgentRegistry is optimized for AI agent workflows with full support for modern agent protocols.
| Endpoint | Description |
|---|---|
GET /llms.txt |
AI discovery file (like robots.txt for LLMs) |
GET /openapi.json |
Full OpenAPI 3.0 specification |
GET /-/capabilities |
Tool definitions for AI agents |
AgentRegistry includes a full MCP server for integration with Claude, GPT, and other AI assistants:
# Install and run MCP server
cd mcp-server
bun install
bun run startClaude Desktop Configuration (claude_desktop_config.json):
{
"mcpServers": {
"agentregistry": {
"command": "bun",
"args": ["run", "/path/to/AgentRegistry/mcp-server/index.ts"]
}
}
}| Tool | Description |
|---|---|
publish_package |
Publish with automatic security scanning |
get_package |
Get package metadata |
search_packages |
Search local + upstream packages |
get_server_stats |
Server health and statistics |
check_quarantine |
Check for blocked packages |
- Structured JSON errors with remediation instructions
- Idempotent operations for safe retries
- Security scan feedback explains why packages were blocked
- WebSocket protocol for real-time admin operations
- β Full npm publish/install workflow
- β Scoped packages support (@scope/name)
- β SHA1 and SHA512 integrity checksums
- β Dist-tags (latest, next, etc.)
- β Version-specific fetching
- β CORS enabled for browser access
- β Upstream proxy to npmjs.org (auto-cache)
- β Real-time security scanning (~10-50ms per package)
- β Quarantine flow for upstream packages
- β In-memory cache (X-Cache: HIT-MEMORY/HIT-DISK)
- β Localhost-only security hardening
- β
Single runtime dependency (
tar) - β ~12,300 lines of code (modular architecture)
- β Developer Tools: Scaffolding, Release Helper, Dependency Graph
- Local packages first: If a package exists locally, serve it (memory β disk)
- Upstream + Quarantine: Fetch from npmjs.org β quarantine β scan β cache
- Security blocking: Suspicious packages get 403 Forbidden
- Fast caching: Memory cache for instant response, disk for persistence
| Operation | Time |
|---|---|
| Memory cache hit | ~1ms |
| Disk cache hit | ~3ms |
| Upstream fetch + scan | ~500ms (network) + ~10-50ms (scan) |
Memory cache stores up to 100 tarballs for instant serving.
