PackageLens MCP

by rakeshmenon

Not rated
GitHub

About

Lets your coding agent (such as Claude, Cursor, Copilot, Gemini or Codex) search package registries across multiple ecosystems (npm, PyPI, RubyGems, Crates.io, Packagist, Hex) and fetch package context (README, downloads, GitHub info, usage snippets)

Details

Author
rakeshmenon
Categories
Developer Tools, Other, AI, Search

Setup

Install PackageLens MCP in your MCP client (Claude Desktop, Cursor, Windsurf, and others).

Repository: https://github.com/rakeshmenon/packagelens-mcp

Follow the installation instructions in the repository README, then restart your MCP client.

packagelens-mcplets your coding agent (such as Claude, Cursor, Copilot, Gemini or Codex) search package registries across multiple ecosystems (npm, PyPI, RubyGems, Crates.io, Packagist, Hex) and fetch package context (README, downloads, GitHub info, usage snippets). It featuressmart ecosystem auto-detection, so your AI can find packages without needing to specify which ecosystem to search. It acts as a Model‑Context‑Protocol (MCP) server, giving your AI assistant a structured way to discover libraries and integrate them quickly.

Changelog|Contributing|Example Queries|Troubleshooting|Tool reference

PackageLens MCP supports 6 package ecosystems with varying feature availability:

PyPI does not provide an official downloads API

- 🌟Smart ecosystem auto-detection- Ask "Find HTTP clients" without specifying npm, PyPI, etc.
- 🔍 Multi-ecosystem support: npm, PyPI, RubyGems, Crates.io, Packagist, Hex
- 📦 Structured package search with optional ranking weights
- 📄 Direct README fetch (optionally truncated)
- 📊 Enriched package info (downloads + GitHub details)
- 🔖 Version listing and dependency analysis
- 💡 Usage snippet extraction from README
- 🔌 Stdio MCP transport, ready for MCP‑compatible clients

packagelens-mcpperforms network requests to package registries (npm, PyPI, RubyGems, Crates.io, Packagist, Hex) and GitHub when tools are used. Avoid sharing secrets in prompts; setGITHUB_TOKENonly if you want higher GitHub rate limits.

Add the following config to your MCP client:

{ "mcpServers": { "packagelens": { "command": "npx", "args": ["-y", "packagelens-mcp@latest"] } } }

[!NOTE] Usingpackagelens-mcp@latestensures your MCP client always runs the latest published version.

amp mcp add packagelens -- npx packagelens-mcp@latest
claude mcp add packagelens npx packagelens-mcp@latest
codex mcp add packagelens -- npx packagelens-mcp@latest

Start the dialog to add a new MCP server by running:

Configure the following fields and pressCTRL+Sto save:

- Server name:packagelens
-
Server Type:Local
-
Command:npx -y packagelens-mcp@latest

code --add-mcp '{"name":"packagelens","command":"npx","args":["-y","packagelens-mcp@latest"]}'

Go toCursor Settings->MCP->New MCP Server. Use the config provided above.

gemini mcp add packagelens npx packagelens-mcp@latest
gemini mcp add -s user packagelens npx packagelens-mcp@latest

Alternatively, follow the Gemini CLI MCP guide and use the standard config from above.

Go toSettings | Tools | AI Assistant | Model Context Protocol (MCP)->Add. Use the config provided above. Same for Junie underSettings | Tools | Junie | MCP Settings->Add.

Go toSettings | AI | Manage MCP Servers->+ Addand use the config provided above.

Enter one of thesesmart queries(no ecosystem needed!) to check if everything works:

Smart package info (auto-detects ecosystem):

Compare react-query, swr, and apollo-client

Advanced: Ecosystem-specific queries(when you need control):

Search npm for React debounce hooks, show weekly downloads
What are the dependencies of express in npm? Include dev dependencies.

Looking for JSON‑RPC examples, tool schemas, the local dev CLI, troubleshooting, or contributor setup?

- Seedocs/advanced.mdfor all technical details.
- SeeCONTRIBUTING.mdfor contributing guidelines.

PackageLens MCP provides8 toolswith automatic ecosystem detection. For full JSON schemas, see theTool reference.

The main tool you'll use for finding packages.It automatically detects which package ecosystem to search based on your project or query.
-
Query keywords- Detects language mentions (Python, Rust, JavaScript, etc.)
-
Codebase analysis- Checks current directory for package files (package.json → npm, Cargo.toml → Crates.io, etc.)
-
User clarification- If still unclear, asks for specification

Args:query,ecosystem?,packageName?,size?

Important:Once an ecosystem is detected, the response includes a directive to useecosystem="..."parameter in ALL follow-up searches to maintain consistency. Do NOT search other ecosystems unless explicitly requested.

// In a TypeScript project with package.json { query: "HTTP clients" } // → Auto-detects npm, searches npm only // Follow-up query (maintaining consistency) { query: "async libraries", ecosystem: "npm" } // → Continues searching npm // Explicit ecosystem { query: "web frameworks", ecosystem: "pypi" } // → Searches PyPI regardless of project type // With language context { query: "Find Rust async runtime libraries" } // → Detects "Rust", searches Crates.io

All smart tools support an optionalecosystemparameter for explicit specification.

-

smart_package_info- Get detailed package info

- Args:packageName,ecosystem?,context?,includeReadme?
- Example: "Tell me about react" → detects npm

- Args:packageName,ecosystem?,context?,version?,truncateAt?
- Example: "Get README for django" → detects PyPI

smart_get_usage_snippet- Extract code examples from README

- Args:packageName,ecosystem?,context?,version?
- Example: "Show me how to use axios" → detects npm

-

smart_get_versions- List package versions

- Args:packageName,context?,limit?,since?
- Example: "Show versions of tokio" → detects Crates.io

smart_get_dependencies- Get package dependencies

- Args:packageName,context?,version?
- Example: "What does express depend on?" → detects npm

- smart_get_downloads- Get download statistics

- Args:packageName,context?,period?
- Example: "How many downloads does flask have?" → detects PyPI

- compare_packages- Compare packages across ecosystems

- Args:items[]with{ecosystem, name}objects
- Example: Compare axios (npm), requests (PyPI), httparty (RubyGems)

PackageLens MCP supports two query styles:smart queries(automatic detection) andspecific queries(explicit ecosystem). Once an ecosystem is detected, use the same ecosystem for follow-up queries to maintain consistency.

Find Python HTTP client libraries → Detects PyPI from "Python" keyword → Response: "Use ecosystem='pypi' for follow-up searches"
Search for Rust async libraries → Detects Crates.io from "Rust" keyword → Response: "Use ecosystem='crates' for follow-up searches"
Find HTTP client libraries → In TypeScript project with package.json → Detects npm from codebase → Response: "Use ecosystem='npm' for follow-up searches"
Search for async runtime packages → In Rust project with Cargo.toml → Detects Crates.io from codebase → Response: "Use ecosystem='crates' for follow-up searches"

Follow-up searches (maintaining consistency):

Initial: "Find Python web frameworks" → Detects PyPI, finds django, flask, fastapi Follow-up: "Show me more async frameworks" (with ecosystem='pypi') → Continues searching PyPI only → Finds aiohttp, starlette, tornado
Initial: "Search for JavaScript testing libraries" → Detects npm, finds jest, mocha, vitest Follow-up: "Find assertion libraries" (with ecosystem='npm') → Continues searching npm only → Finds chai, expect, should
Tell me about react → Detects npm from well-known package name
Get info for django including README → Detects PyPI from well-known package name
Show me details for tokio → Detects Crates.io from well-known package name
Show me how to use axios → Detects npm, extracts usage snippet from README
Get usage example for requests → Detects PyPI, extracts usage snippet from README
What versions of react are available? → Detects npm, lists recent versions
What does express depend on? → Detects npm, shows dependency tree
How many downloads does django have? → Detects PyPI (note: PyPI doesn't provide download stats)
Show me weekly downloads for lodash → Detects npm, shows weekly download count

Cross-ecosystem comparison (explicit intent):

Compare axios from npm with requests from PyPI → Compares HTTP clients across ecosystems
Compare react, vue, and angular → All detected as npm packages, compares within npm

Use these when you need precise control or want to override auto-detection:

Search npm for React debounce hooks → Uses npm regardless of project type
Search crates for tokio alternatives → Uses Crates.io regardless of project type

Maintaining consistency with explicit parameter:

Initial: "Find web frameworks" (in TypeScript project) → Detects npm Follow-up: Search for "validation libraries" with ecosystem="npm" → Continues in npm (recommended approach)
Initial: "Find Python web frameworks" → Detects PyPI, finds django, flask Explicit switch: "Now search npm for web frameworks" → Explicitly switches to npm ecosystem
Get info for @types/node from npm → Scoped package, explicitly npm
Show README for symfony/console from packagist → Vendor/package format, explicitly Packagist
What are the dependencies of express in npm? Include dev dependencies. → Explicit npm query with dev dependencies
Show me versions of tokio from crates published in last 6 months → Explicit crates query with time filter

- First query: Use language context ("Python", "Rust") or let codebase detection work
-
Follow-up queries: Use theecosystemparameter from the first response
-
Comparisons: Only compare across ecosystems when explicitly comparing alternatives
-
Specific packages
*: Well-known package names auto-detect reliably (react → npm, django → PyPI)

No reviews yet — be the first

Sign in to leave a review

Use Google, GitHub, or an email account so ratings stay tied to real people.

Email sign in

No reviews posted yet.