Get the FREE Ultimate OpenClaw Setup Guide →

mcp-npm_docs

An MCP server that provides a tool to fetch metadata and documentation (including README content) for NPM packages, using a local cache to improve performance.

Installation
Run this command in your terminal to add the MCP server to Claude Code.
Run in terminal:
Command
claude mcp add --transport stdio bsmi021-mcp-npm_docs-server node dist/server.js \
  --env LOG_LEVEL="info" \
  --env NPM_CACHE_TTL="86400" \
  --env NPM_CACHE_DB_PATH="./dist/npm-docs-cache.db"

How to use

This MCP server provides a specialized tool called getNpmPackageDocs that fetches metadata and documentation for NPM packages, including the README content, via the npms.io API and caches results locally using SQLite. The server is designed to be registered with an MCP client (for example, in a cline_mcp_settings.json file) and invoked to retrieve a consolidated NPM package document payload. The tool returns a structured NpmDocumentation object containing fields such as name, version, description, homepage, repository, author, license, keywords, dependencies, devDependencies, and readmeContent when available.

To use the tool, configure your MCP client to call getNpmPackageDocs on the npm-docs-server, passing the required packageName and an optional forceFresh flag. The forceFresh option bypasses the local cache and fetches fresh data from npms.io. Example invocation in an MCP client: provide a payload with {"packageName": "lodash", "forceFresh": false} and point the call to the npm-docs-server's getNpmPackageDocs tool. The server will return a JSON object conforming to the NpmDocumentation interface, including readmeContent if npms.io exposes it for the package.

How to install

Prerequisites:

  • Node.js (recommended LTS) installed
  • Git installed (optional for cloning)
  • npm installed (comes with Node.js)

Installation steps:

  1. Clone the repository (if applicable):

    git clone <repository-url> mcp-npm_docs-server cd mcp-npm_docs-server

  2. Install dependencies:

    npm install

  3. Build the TypeScript source (produces dist/):

    npm run build

  4. Run the server:

    node dist/server.js

  5. Optional: Run in development with auto-reload (if a dev script exists):

    npm run dev

  6. Ensure configuration matches your environment, especially the cache settings and paths, before deployment.

Additional notes

Tips and considerations:

  • The server uses npms.io for package data; the NPM_REGISTRY_URL config variable exists but is currently ignored by design.
  • The local cache is stored in an SQLite database (npm-docs-cache.db) under dist by default. You can override the path with NPM_CACHE_DB_PATH.
  • Set NPM_CACHE_TTL to control how long cached results are considered fresh. A shorter TTL increases freshness at the cost of more API calls.
  • If you run behind a proxy or require restricted network access, ensure Node.js can reach npms.io for metadata retrieval.
  • When integrating with an MCP client, provide an absolute path to the compiled server.js in dist/server.js and enable the npm-docs-server in your mcp_settings.json with autoApprove for getNpmPackageDocs if desired.
  • If readmeContent is not available for a package from npms.io, the field may be omitted or empty; ensure your tooling handles optional fields accordingly.

Related MCP Servers

Sponsor this space

Reach thousands of developers