This document collects the deeper, more technical details for contributors and folks running PackageLens MCP locally.
Basic smoke test (CLI, no MCP)
pnpm demo:search -- react debounce hookpnpm demo:readme -- reactpnpm demo:info -- reactpnpm demo:downloads -- react weekpnpm demo:snippet -- reactYou should see JSON/text output with package lists, README content, weekly downloads, and an extracted snippet.
A tiny CLI is included to try functionality directly during development.
npx -y packagelens-mcp@latest --help
# Or try a standalone search via the built-in demo commands in this
# repo (dev only)
pnpm demo:search -- react debounce hook
# Version pinning guidance
# - Latest (moving): use @latest
# - Major pin: packagelens-mcp@0 (gets newest 0.x)
# - Minor pin: packagelens-mcp@0.1 (newest 0.1.x)
# - Exact: packagelens-mcp@0.1.3
# Tip: check the current version with
# `npm view packagelens-mcp version`.
pnpm demo:readme -- react
pnpm demo:readme -- lodash 4.17.21
pnpm demo:info -- react
pnpm demo:downloads -- react week
pnpm demo:snippet -- react
PackageLens MCP provides 8 tools with automatic ecosystem detection. All tools use smart detection to automatically determine the package ecosystem from context. When ecosystem cannot be determined, tools ask for user clarification.
{ query: string, packageName?: string, size?: number (1-250)
}{ searchedEcosystems: string[], results: Array<{ ecosystem,
name, version, description?, downloads?, repository?, homepage?,
stars?, forks?, license? }> }{ query: "Find Python HTTP clients", size: 10 }{ query: "http clients" } → asks for clarification{ packageName: string, context?: string, includeReadme?:
boolean }{ ecosystem, name, version?, repository?, homepage?, github?:
{ fullName, url, stars?, forks?, license? }, downloads?: number,
readme?: string }{ packageName: "react" } → detects npm{ packageName: "django", context: "Python web framework" }
→ detects pypi{ packageName: string, context?: string, version?: string,
truncateAt?: number }{ ecosystem, name, version?, repository?, homepage? }{ packageName: "django" } → detects pypi{ packageName: string, context?: string, version?: string }{ ecosystem, name, version?, snippet?: { language?, code,
heading? } }{ packageName: "axios" } → detects npm{ packageName: string, context?: string, limit?: number,
since?: string }{ ecosystem, name, versions: Array<{ version: string, date:
string, tags?: string[] }> }"2024-01-01T00:00:00.000Z") or relative
("6 months", "1 year", "30 days"){ packageName: "tokio", limit: 10, since: "6 months" } →
detects crates{ packageName: string, context?: string, version?: string }{ ecosystem, name, version, dependencies: Array<{ name:
string, version: string }>, devDependencies?: Array<{ name: string,
version: string }> }{ packageName: "express" } → detects npm{ packageName: string, context?: string, period?:
'day'|'week'|'month' }{ ecosystem, name, period, downloads?: number }{ packageName: "react", period: "week" } → detects npm{ items: Array<{ ecosystem: string, name: string }> (1-10
items) }Array<{ ecosystem, name, version?, description?, downloads?,
stars?, forks?, license?, repository?, homepage?, error?: string }>error field{ items: [{ ecosystem: "npm", name: "react" }, { ecosystem:
"pypi", name: "django" }] }{
"jsonrpc": "2.0",
"id": 1,
"method": "initialize",
"params": {
"clientInfo": { "name": "demo", "version": "0.0.0" },
"capabilities": {}
}
}
{
"jsonrpc": "2.0",
"id": 2,
"method": "tools/list"
}
{
"jsonrpc": "2.0",
"id": 3,
"method": "tools/call",
"params": {
"name": "smart_search",
"arguments": { "query": "Find JavaScript debounce hooks", "size": 10 }
}
}
{
"jsonrpc": "2.0",
"id": 4,
"method": "tools/call",
"params": {
"name": "smart_get_readme",
"arguments": { "packageName": "react" }
}
}
{
"jsonrpc": "2.0",
"id": 5,
"method": "tools/call",
"params": {
"name": "smart_package_info",
"arguments": { "packageName": "react", "includeReadme": false }
}
}
{
"jsonrpc": "2.0",
"id": 6,
"method": "tools/call",
"params": {
"name": "smart_get_versions",
"arguments": {
"packageName": "react",
"limit": 10,
"since": "6 months"
}
}
}
{
"jsonrpc": "2.0",
"id": 7,
"method": "tools/call",
"params": {
"name": "smart_get_dependencies",
"arguments": { "packageName": "express" }
}
}
{
"jsonrpc": "2.0",
"id": 8,
"method": "tools/call",
"params": {
"name": "smart_get_downloads",
"arguments": { "packageName": "react", "period": "week" }
}
}
{
"jsonrpc": "2.0",
"id": 9,
"method": "tools/call",
"params": {
"name": "compare_packages",
"arguments": {
"items": [
{ "ecosystem": "npm", "name": "react" },
{ "ecosystem": "npm", "name": "vue" },
{ "ecosystem": "npm", "name": "svelte" }
]
}
}
}
pnpm build
(or use pnpm dev).GITHUB_TOKEN.dist/index.js and correct permissions.pnpm lintpnpm test (100% coverage enforced via pnpm coverage)CACHE_TTL_MS/CACHE_MAX via env.GITHUB_TOKEN to raise rate limits.