Package Documentation MCP Server
December 14, 2024 ยท View on GitHub
A Model Context Protocol (MCP) server that provides tools to fetch and format documentation for npm and PyPI packages. This server allows AI assistants to easily access package documentation and information directly from the official registries.
Features
- Fetch documentation from npm registry
- Fetch documentation from PyPI registry
- Formatted output including:
- Package name and version
- Description
- Installation instructions
- Homepage and repository links
- Keywords
- Full documentation/readme content
Installation
- Clone or create the server in your MCP servers directory:
cd /path/to/mcp/servers
npx @modelcontextprotocol/create-server package-docs-server
- Install dependencies:
cd package-docs-server
npm install
- Build the server:
npm run build
Configuration
Add the server to your Claude Desktop configuration file:
- macOS:
~/Library/Application Support/Claude/claude_desktop_config.json - Windows:
%APPDATA%/Claude/claude_desktop_config.json
{
"mcpServers": {
"package-docs": {
"command": "node",
"args": [
"/path/to/package-docs-server/build/index.js"
]
}
}
}
Available Tools
get_npm_docs
Fetches documentation for an npm package.
Parameters:
package_name(string, required): Name of the npm package
Example usage:
<use_mcp_tool>
<server_name>package-docs</server_name>
<tool_name>get_npm_docs</tool_name>
<arguments>
{
"package_name": "react"
}
</arguments>
</use_mcp_tool>
get_pypi_docs
Fetches documentation for a Python package from PyPI.
Parameters:
package_name(string, required): Name of the Python package
Example usage:
<use_mcp_tool>
<server_name>package-docs</server_name>
<tool_name>get_pypi_docs</tool_name>
<arguments>
{
"package_name": "requests"
}
</arguments>
</use_mcp_tool>
Development
The server is built with TypeScript and uses:
@modelcontextprotocol/sdkfor MCP server implementationaxiosfor making HTTP requests to package registries
To modify the server:
- Edit the source code in
src/index.ts - Rebuild using
npm run build - Restart Claude Desktop to load the changes
License
MIT