packagelens-mcp 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). It features smart
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.
PackageLens MCP supports 6 package ecosystems with varying feature availability:
| Ecosystem | Search | README | Versions | Dependencies | Downloads |
|---|---|---|---|---|---|
| npm | ✅ | ✅ | ✅ | ✅ | ✅ |
| RubyGems (Ruby) | ✅ | ✅ | ✅ | ✅ | ✅ |
| Crates.io (Rust) | ✅ | ✅ | ✅ | ✅ | ✅ |
| Packagist (PHP) | ✅ | ✅ | ✅ | ✅ | ✅ |
| Hex (Elixir) | ✅ | ✅ | ✅ | ✅ | ✅ |
| PyPI (Python) | ✅ | ✅ | ✅ | ✅ | ❌* |
* PyPI does not provide an official downloads API
packagelens-mcp performs network requests to package registries (npm, PyPI,
RubyGems, Crates.io, Packagist, Hex) and GitHub when tools are used. Avoid sharing
secrets in prompts; set GITHUB_TOKEN only 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] Using
packagelens-mcp@latestensures your MCP client always runs the latest published version.
Enter one of these smart queries (no ecosystem needed!) to check if everything works:
Smart search (auto-detects ecosystems):
Find HTTP client libraries
Find async runtime packages for Rust
Smart package info (auto-detects ecosystem):
Tell me about react
Get info for django including README
Smart usage examples:
Show me how to use axios
Compare packages:
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?
docs/advanced.md for all technical details.CONTRIBUTING.md for contributing guidelines.PackageLens MCP provides 8 tools with automatic ecosystem detection. For full JSON schemas, see the Tool reference.
smart_searchThe main tool you’ll use for finding packages. It automatically detects which package ecosystem to search based on your project or query.
Detection Strategy:
Args: query, ecosystem?, packageName?, size?
Important: Once an ecosystem is detected, the response includes a directive
to use ecosystem="..." parameter in ALL follow-up searches to maintain
consistency. Do NOT search other ecosystems unless explicitly requested.
Examples:
// 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 optional ecosystem parameter for explicit
specification.
Package Information:
smart_package_info - Get detailed package info
packageName, ecosystem?, context?, includeReadme?smart_get_readme - Fetch package README
packageName, ecosystem?, context?, version?, truncateAt?smart_get_usage_snippet - Extract code examples from README
packageName, ecosystem?, context?, version?Versions & Dependencies:
smart_get_versions - List package versions
packageName, context?, limit?, since?smart_get_dependencies - Get package dependencies
packageName, context?, version?Downloads:
smart_get_downloads - Get download statistics
packageName, context?, period?Comparison:
compare_packages - Compare packages across ecosystems
items[] with {ecosystem, name} objectsPackageLens MCP supports two query styles: smart queries (automatic detection) and specific queries (explicit ecosystem). Once an ecosystem is detected, use the same ecosystem for follow-up queries to maintain consistency.
Initial search with language context:
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"
Initial search in project directory:
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
Package info with auto-detection:
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
Usage examples:
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
Versions and dependencies:
What versions of react are available?
→ Detects npm, lists recent versions
What does express depend on?
→ Detects npm, shows dependency tree
Downloads:
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:
Explicit ecosystem search:
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)
Switching ecosystems (when needed):
Initial: "Find Python web frameworks"
→ Detects PyPI, finds django, flask
Explicit switch: "Now search npm for web frameworks"
→ Explicitly switches to npm ecosystem
Specific package queries:
Get info for @types/node from npm
→ Scoped package, explicitly npm
Show README for symfony/console from packagist
→ Vendor/package format, explicitly Packagist
Advanced dependency queries:
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
ecosystem parameter from the first
responsePackageLens MCP is MIT licensed. Contributions are welcome! Please see CONTRIBUTING.md for guidelines.
Found a bug or have a feature request? Open an issue on GitHub.
Made with ❤️ for the vibe coding community. Happy coding!