mcp-npm-package-documentation
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@mcp-npm-package-documentationget the docs for express"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
MCP Node Documentation
A Model Context Protocol (MCP) server that retrieves documentation for any npm package by automatically discovering its GitHub repository and returning its README.md.
The server is built using the official @modelcontextprotocol/server SDK and communicates over STDIO, making it compatible with MCP clients such as Claude Desktop, the MCP Inspector, and other MCP-compatible applications.
Features
Fetches package information directly from the npm registry.
Automatically detects the GitHub repository associated with an npm package.
Downloads the project's README from GitHub.
Supports repositories using either:
mainmaster
Supports common README filename variations:
README.mdReadme.mdreadme.md
Uses request timeouts to avoid hanging requests.
Implements clean separation between:
MCP Server
Service Layer
HTTP Layer
Fully written in TypeScript.
Compatible with MCP 2.x.
How It Works
User / MCP Client
│
▼
MCP Tool Invocation
│
▼
npm-package-documentation
│
▼
Fetch npm Registry Metadata
│
▼
Extract GitHub Repository URL
│
▼
Download README.md
│
▼
Return README as ResponseProject Structure
mcp-node-documentation
│
├── src
│ ├── index.ts
│ │
│ └── service
│ ├── data.model.ts
│ ├── fetch.api.ts
│ ├── service.ts
│ └── service.implementation.ts
│
├── package.json
├── tsconfig.json
├── .gitignore
└── README.mdFolder Explanation
src/index.ts
Entry point of the application.
Responsibilities:
Creates the MCP Server.
Registers the tool.
Connects using
StdioServerTransport.Handles tool requests.
Returns documentation to the MCP client.
Registered Tool:
npm-package-documentationInput:
{
"packageName": "express"
}Output:
Contents of README.mdRelated MCP server: NPM Context Agent MCP
src/service/service.ts
Defines the service interface.
interface Service {
getRepoInfo(packageName: string): Promise<RepoInfo>;
getDocumentation(user: string, repo: string): Promise<DocumentationResponse>;
}This abstraction allows multiple implementations in the future.
src/service/service.implementation.ts
Contains all business logic.
Responsibilities:
1. Fetch npm package metadata
Example:
https://registry.npmjs.org/expressExtracts
{
"repository": {
"url": "git+https://github.com/expressjs/express.git"
}
}Converts it into
user = expressjs
repo = express2. Fetch GitHub README
It searches multiple possible locations.
Examples:
main/README.md
master/README.md
main/readme.md
master/readme.md
main/Readme.md
master/Readme.mdThe first successful request is returned using
Promise.any(...)src/service/fetch.api.ts
Wrapper around the native fetch() API.
Features:
Timeout support
AbortController
Error handling
Automatic cleanup
Instead of repeatedly writing
fetch(...)the project uses
fetchApi.fetch(...)which provides consistent behavior.
src/service/data.model.ts
Contains project models.
export interface RepoInfo {
user: string;
repo: string;
}and
export type DocumentationResponse = {
CONTENT: string;
}Tool Definition
Tool Name
npm-package-documentationInput Schema
{
"packageName": "string"
}Example
{
"packageName": "react"
}Response
Entire README.md contentRequest Flow
User
↓
MCP Tool
↓
getRepoInfo()
↓
npm Registry API
↓
GitHub Repository
↓
getDocumentation()
↓
raw.githubusercontent.com
↓
README.md
↓
MCP ResponseInstallation
Clone the repository.
git clone https://github.com/<your-username>/mcp-node-documentation.gitMove into the project.
cd mcp-node-documentationInstall dependencies.
npm installBuild
npm run buildCompiled JavaScript will be generated inside
dist/Development
Run in watch mode.
npm run devProduction
npm startRun MCP Inspector
npm run localThis launches the official MCP Inspector.
You can invoke the tool directly from the Inspector UI.
Example Tool Call
Input
{
"packageName": "express"
}Processing
↓
Fetch npm registry
↓
Extract repository
↓
Fetch README
↓
Return documentationOutput
# Express
Fast, unopinionated, minimalist web framework...APIs Used
npm Registry
https://registry.npmjs.org/<package-name>Example
https://registry.npmjs.org/reactUsed for discovering the GitHub repository.
GitHub Raw Content
https://raw.githubusercontent.com/<user>/<repo>/<branch>/README.mdExample
https://raw.githubusercontent.com/facebook/react/main/README.mdUsed for retrieving documentation.
Error Handling
The project gracefully handles:
Invalid package names
Missing repositories
Non-GitHub repositories
Missing README files
Network failures
Timeout errors
Invalid GitHub URLs
Errors are returned as plain text responses to the MCP client.
Dependencies
Runtime
Package | Purpose |
@modelcontextprotocol/server | MCP server implementation |
zod | Input validation |
Development
Package | Purpose |
typescript | TypeScript compiler |
tsx | Execute TypeScript directly |
@types/node | Node.js type definitions |
Design Decisions
The project follows a layered architecture.
MCP Server
↓
Service Layer
↓
HTTP Layer
↓
External APIsBenefits:
Easy to maintain
Easy to test
Easy to extend
Separation of concerns
Reusable HTTP logic
Future Improvements
Potential enhancements include:
Support GitLab repositories.
Support Bitbucket repositories.
Cache README responses.
Add configurable request timeouts.
Return additional package metadata (version, description, homepage, author).
Support documentation files other than README (e.g.,
docs/,CONTRIBUTING.md,CHANGELOG.md).Support branch detection via the GitHub API instead of assuming
mainormaster.Add unit and integration tests.
Add logging with configurable log levels.
Publish the MCP server as an npm package.
Containerize with Docker.
Add CI/CD workflows using GitHub Actions.
Requirements
Node.js 20+
npm
TypeScript
License
This project is licensed under the ISC License.
Author
Developed as a simple MCP server that demonstrates how to integrate the npm Registry API with GitHub's raw content service to provide package documentation on demand.
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- AlicenseCqualityFmaintenanceFetches 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.Last updated111MIT
- AlicenseAqualityDmaintenanceProvides comprehensive contextual information about npm packages including README files, versions, dependencies, download statistics, and search functionality. Enables users to explore and analyze npm packages through natural language queries with intelligent GitHub README fetching and branch fallback.Last updated9MIT
- Alicense-qualityCmaintenanceIntelligently detects package managers and provides unified access to documentation and information across 15+ package ecosystems including npm, PyPI, and others. Automatically routes requests to appropriate package-specific MCP servers for README retrieval, package information, and cross-ecosystem package search.Last updated14MIT
- Alicense-qualityDmaintenanceProvides intelligent, version-aware access to npm library documentation. Supports semantic search, API validation, and version comparison to assist developers in using libraries correctly.Last updated2MIT
Related MCP Connectors
Provide AI-powered real-time analysis and intelligence on NPM packages, including security, depend…
npm, PyPI & crates.io intel for AI agents: versions, popularity, deps, health. No API keys.
Package intelligence for AI agents across npm, PyPI, crates.io and deps.dev. No API keys.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/NirojShah/mcp-npm-package-documentation'
If you have feedback or need assistance with the MCP directory API, please join our Discord server