NPM Documentation MCP Server logo

NPM Documentation MCP Server

by bsmi021

An MCP server that fetches metadata and documentation for NPM packages using a local cache for improved performance. It provides the `getNpmPackageDocs` MCP tool to retrieve package information.

View on GitHub

Last updated: N/A

What is NPM Documentation MCP Server?

This is an MCP server designed to fetch and cache documentation and metadata for NPM packages. It leverages the npms.io API and a local SQLite database to provide fast access to package information.

How to use NPM Documentation MCP Server?

  1. Clone the repository (if applicable). 2. Install dependencies using npm install. 3. Build the server with npm run build. 4. Configure the server using environment variables (optional). 5. Run the server using node dist/server.js or npm run dev for development. 6. Integrate the server with an MCP client by adding its configuration to your MCP settings file, ensuring to use the absolute path to the compiled server.js.

Key features of NPM Documentation MCP Server

  • Fetches package metadata and README content from npms.io API

  • Caches results locally using SQLite (better-sqlite3)

  • Provides the getNpmPackageDocs MCP tool

  • Follows the standard MCP server structure

Use cases of NPM Documentation MCP Server

  • Quickly retrieve NPM package documentation within an MCP environment

  • Reduce API calls to npms.io by caching results

  • Integrate NPM package information into other tools or applications

  • Provide a consistent and reliable source of NPM package data

FAQ from NPM Documentation MCP Server

What is the purpose of the NPM_CACHE_TTL environment variable?

It defines the cache Time-To-Live in seconds. The default value is 86400 (24 hours).

Where is the cache database file located?

By default, it's located at ./dist/npm-docs-cache.db after building the project. You can override this using the NPM_CACHE_DB_PATH environment variable.

How do I enable verbose logging?

Set the LOG_LEVEL environment variable to debug.

What does the getNpmPackageDocs tool do?

It retrieves documentation and metadata for a specified NPM package from the cache or the npms.io API.

What is the forceFresh parameter in the getNpmPackageDocs tool?

If set to true, it bypasses the local cache and fetches fresh data from the npms.io API.