oactive defense.
3. Dynamic Re-Verification: Hallucination status is temporal. A package flagged today may be legitimately published tomorrow. DepScope performs nightly re-verification at 05:00 UTC, reverting flags if registries resolve the name, ensuring the corpus remains accurate for research and tooling.
Core Solution
DepScope provides a free, open MCP server and REST API designed for zero-friction integration. The architecture prioritizes real-time validation, research-grade data integrity, and seamless agent interoperability.
Validation Pipeline Architecture
The system employs a four-stage pipeline to filter noise and confirm hallucinations:
- Live Observation: The agent queries the registry via the MCP tool. A
404 response triggers the hallucination workflow.
- Plausibility Filtering: Ingest logic discards non-package artifacts such as URLs, image paths, scanner probes, and scheme-prefixed strings to reduce false positives.
- Cross-Validation: To enter the public corpus, a hallucination requires persistence across multiple callers or days. This filters transient errors and isolates high-confidence signals.
- Daily Re-Verifier: A scheduled job re-checks all flagged entries. If a registry now resolves the name, the entry is removed from the hallucination corpus, preventing stale warnings.
Integration Implementation
The following TypeScript example demonstrates how to wrap DepScope's MCP tools into a pre-install validation hook for an agent workflow. This implementation uses distinct variable naming and structure compared to standard examples, emphasizing error handling and concurrency safety.
import { DepScopeClient } from '@depscope/sdk';
import { RegistryStatus } from '@depscope/types';
interface InstallRequest {
packageName: string;
ecosystem: 'npm' | 'pypi' | 'maven';
}
class DependencyValidator {
private client: DepScopeClient;
constructor(config: { mcpEndpoint: string }) {
this.client = new DepScopeClient({
endpoint: config.mcpEndpoint,
timeoutMs: 150, // Strict timeout to maintain agent flow
});
}
async validateBeforeInstall(request: InstallRequest): Promise<void> {
// Step 1: Check existence and hallucination status
const validation = await this.client.checkPackage({
name: request.packageName,
ecosystem: request.ecosystem,
});
if (validation.status === RegistryStatus.HALLUCINATED) {
throw new SecurityError(
`Blocked installation of hallucinated package: ${request.packageName}. ` +
`Detected by ${validation.agentCount} agents. ` +
`Suggested alternatives: ${validation.alternatives.join(', ')}`
);
}
// Step 2: Cross-reference vulnerability intelligence
if (validation.status === RegistryStatus.EXISTS) {
const vulnReport = await this.client.getVulnerabilities({
name: request.packageName,
ecosystem: request.ecosystem,
});
const criticalExploits = vulnReport.filter(
v => v.epssScore > 0.5 || v.isInCisaKev
);
if (criticalExploits.length > 0) {
console.warn(
`Warning: ${request.packageName} has ${criticalExploits.length} ` +
`high-risk advisories (EPSS > 0.5 or CISA KEV).`
);
}
}
}
}
// Usage within agent execution loop
async function executeAgentCommand(command: string) {
if (command.startsWith('npm install') || command.startsWith('pip install')) {
const pkgName = parsePackageName(command);
const validator = new DependencyValidator({
mcpEndpoint: 'https://mcp.depscope.dev/mcp',
});
try {
await validator.validateBeforeInstall({
packageName: pkgName,
ecosystem: command.includes('pip') ? 'pypi' : 'npm',
});
// Proceed with installation
} catch (err) {
console.error(err.message);
// Agent should suggest alternatives or abort
}
}
}
Architecture Rationale
- MCP-Native Design: By exposing 22 tools via the Model Context Protocol, DepScope eliminates the need for custom API wrappers. Agents can invoke
check_package, find_alternatives, and scan_project natively during code generation.
- Zero-Auth Model: The free tier requires no API keys or OAuth flows, removing authentication barriers that disrupt agent autonomy and CI/CD pipelines.
- Research-Grade Licensing: The dataset is released under CC-BY-NC-SA 4.0, enabling academic research and open-source tooling while preventing unauthorized commercial exploitation.
- Synchronized Cadence: All data, including package metadata, vulnerability advisories, and hallucination flags, refreshes daily at 05:00 UTC, ensuring consistency across the ecosystem.
Pitfall Guide
1. The "Trust the Agent" Fallacy
Explanation: Developers assume AI-generated code is safe to execute without verification. This leads to blind installation of hallucinated packages that resolve to malicious payloads.
Fix: Implement a mandatory pre-install hook that queries DepScope before any package manager execution. Treat agent output as untrusted input.
2. Ignoring Suffix Pattern Signals
Explanation: LLMs consistently append predictable suffixes (-pro, -turbo, -easy) to real package names. Attackers exploit this by pre-registering these variants.
Fix: Package maintainers should monitor depscope.dev/benchmark for live pattern tracking. Consider pre-registering common variants of your own packages to prevent squatting.
3. Relying on Static Hallucination Datasets
Explanation: Using CSV or JSON snapshots for validation leads to stale data. Registries change, and typosquats are removed, causing false positives or missed detections.
Fix: Always use the live /api/benchmark/hallucinations endpoint with last_updated_at validation. Static files should only be used for offline research, not production validation.
4. Overlooking Multi-Agent Convergence
Explanation: Treating all hallucinations equally ignores risk severity. A name hallucinated by a single agent may be noise, while convergence across multiple architectures indicates high structural plausibility.
Fix: Prioritize validation and defensive registration for packages flagged by β₯3 independent agent fingerprints. Use the agentCount field in validation responses to triage risk.
5. Misconfiguring MCP Transport
Explanation: Hardcoding cloud endpoints or missing stdio fallback breaks workflows in air-gapped environments or CI runners with network restrictions.
Fix: Support both cloud and local transports. Use npx -y depscope-mcp for local stdio execution in restricted environments. Ensure configuration templates include fallback logic.
6. Neglecting EPSS and KEV Context
Explanation: Not all vulnerabilities require immediate remediation. Treating every advisory as critical leads to alert fatigue and delayed response to actual threats.
Fix: Cross-reference advisories with EPSS scores and CISA KEV entries. Prioritize remediation for packages with epssScore > 0.5 or isInCisaKev: true, as these indicate active exploitation likelihood.
Production Bundle
Action Checklist
Decision Matrix
| Scenario | Recommended Approach | Why | Cost Impact |
|---|
| Solo Developer / Local Dev | Local Stdio (npx -y depscope-mcp) | Zero setup, no network dependency, instant validation. | Free |
| Team / CI Pipeline | Cloud MCP Endpoint | Shared cache, audit logging, centralized configuration. | Free |
| Air-Gapped / Restricted Network | Local Mirror + Stdio | Complies with network isolation policies; requires infra. | Infra Cost |
| Research / Academic | CC-BY-NC-SA Dataset | Enables analysis of hallucination trends and agent behavior. | Free (Attribution Required) |
| Enterprise / Commercial | Custom Integration | Requires commercial license for dataset usage and support. | Licensing Fee |
Configuration Template
Use the following JSON configuration to integrate DepScope into MCP-compatible clients. This template supports both cloud and local transports.
{
"mcpServers": {
"depscope-cloud": {
"url": "https://mcp.depscope.dev/mcp",
"transport": "http",
"description": "Cloud-based DepScope validation for team environments."
},
"depscope-local": {
"command": "npx",
"args": ["-y", "depscope-mcp"],
"transport": "stdio",
"description": "Local stdio transport for air-gapped or restricted networks."
}
},
"validation": {
"timeoutMs": 150,
"retryOnFailure": true,
"maxRetries": 2,
"fallbackToCache": true
}
}
Quick Start Guide
- Install the MCP Server:
Run
npx -y depscope-mcp to launch the local server, or add the cloud endpoint to your agent config.
- Verify Integration:
Open your agent interface and invoke
check_package with a known hallucination (e.g., react-fast-button). Confirm the response indicates HALLUCINATED.
- Configure Pre-Install Hooks:
Add a validation step to your CI/CD pipeline that queries DepScope before package installation. Use the TypeScript example above as a reference.
- Monitor and Triage:
Review the
agentCount and epssScore fields in validation responses to prioritize remediation efforts. Set up alerts for high-convergence signals.
- Stay Updated:
Ensure your configuration refreshes daily at 05:00 UTC to maintain alignment with the latest registry state and vulnerability data.