NPM Package Docs MCP
A Model Context Protocol (MCP) tool that provides up-to-date documentation for npm packages directly in your IDE. This tool fetches the latest README documentation from either the package's GitHub repository or the README bundled with the npm package itself.
What it does
This MCP tool helps your IDE (like Cursor) get the most current documentation for any npm package instead of relying on outdated or incomplete information. It works by:
- GitHub Repository First: If the package has a GitHub repository, it fetches the README directly from the repository's main branch (trying
master
,main
, ordevelop
branches) - NPM Package Fallback: If no GitHub repository is available, it downloads the package tarball and extracts the README file from the bundled package
- Real-time Updates: Always gets the latest documentation, ensuring you have the most current information
Why this matters
- No more guesswork: Get accurate, up-to-date documentation instead of relying on potentially outdated IDE suggestions
- Better development experience: Understand package APIs and usage patterns with current documentation
- Reduced errors: Avoid issues caused by using outdated API references or deprecated methods
- Seamless integration: Works directly in your IDE through the MCP protocol
Tools Provided
get_docs_for_npm_package
Description: Retrieves the latest documentation for any npm package
Parameters:
packageName
(string): The name of the npm package (e.g., "react", "lodash", "express")
Returns: The README content as text, either from the GitHub repository or the package tarball
Example Usage:
How it Works
- Package Lookup: Queries the npm registry to get package metadata
- Repository Detection: Checks if the package has a GitHub repository URL
- GitHub Fetch: If available, fetches README.md from the repository's main branch
- Tarball Extraction: If no GitHub repo, downloads and extracts the package tarball to find the README
- Content Return: Returns the documentation content to your IDE
Installation
Prerequisites
- Node.js (v16 or higher)
- Cursor IDE (or any MCP-compatible IDE)
Installation
Add to Cursor
Add manually to Cursor
Edit your Cursor MCP configuration file (usually located at ~/.cursor/mcp.json
):
- Restart Cursor: Restart Cursor IDE to load the new MCP server
Usage
Once installed, you can use the tool in Cursor by:
- Opening the command palette (Cmd/Ctrl + Shift + P)
- Typing your request, for example:
- "Get docs for express"
- "Show me the latest react documentation"
- "What's new in lodash v4?"
The tool will fetch and display the current documentation for the requested package.
Development
Running in Development Mode
Building for Production
Project Structure
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
License
MIT License - see the LICENSE file for details.
Support
If you encounter any issues or have questions, please open an issue on the GitHub repository.
This server cannot be installed
remote-capable server
The server can be hosted and run remotely because it primarily relies on remote services or has no dependency on the local environment.
Fetches up-to-date documentation for any npm package directly in your IDE by retrieving README files from GitHub repositories or package tarballs. Provides real-time access to current package documentation and API information.
Related MCP Servers
- AsecurityAlicenseAqualityFacilitates LLMs to efficiently access and fetch structured documentation for packages in Go, Python, and NPM, enhancing software development with multi-language support and performance optimization.Last updated -1181376TypeScriptMIT License
- AsecurityAlicenseAqualityFacilitates searching and accessing programming resources across platforms like Stack Overflow, MDN, GitHub, npm, and PyPI, aiding LLMs in finding code examples and documentation.Last updated -638JavaScriptAGPL 3.0
- AsecurityAlicenseAqualityFetches and extracts comprehensive package documentation from multiple programming language ecosystems (JavaScript, Python, Java, etc.) for LLMs like Claude without requiring API keys.Last updated -461114JavaScriptMIT License
- -securityAlicense-qualityA server that provides structured access to markdown documentation from NPM packages, Go Modules, or PyPi packages, enabling informed code generation by exposing these docs as resources or tools.Last updated -1TypeScriptMIT License