Npm Package MCP Server
"MCP server for fetching and exploring NPM package source code. Built with TypeScript, supports package browsing, file extraction, and code analysis."
Ask AI about Npm Package MCP Server
Powered by Claude Β· Grounded in docs
I know everything about Npm Package MCP Server. Ask me about installation, configuration, usage, or troubleshooting.
0/500
Reviews
Documentation
π¦ NPM Package MCP Server
A powerful Model Context Protocol (MCP) server that enables AI assistants to fetch, explore, and analyze source code from any NPM package in real-time.
π Quick Start
# Install
npm install -g npm-package-mcp-server
# Run
npm-package-mcp-server
β¨ Features
- π¦ Fetch Any NPM Package: Download and explore source code from millions of packages
- π Smart File Discovery: List and filter files with intelligent code detection
- π Selective Code Reading: Get specific files or entire codebases
- π·οΈ Version Control: Support for any published package version
- π§Ή Auto Cleanup: Automatic temporary file management
- π Type Safe: Full TypeScript support with comprehensive error handling
- β‘ ES Modules: Modern JavaScript with optimal performance
- π€ AI-Ready: Perfect integration with Claude, ChatGPT, and other AI assistants
π― Use Cases
- Code Analysis: Analyze libraries before adopting them
- Learning: Study well-written open source code
- AI Development: Enable AI assistants to understand package internals
- Documentation: Generate docs by analyzing source code
- Security Auditing: Review dependencies for security issues
- Migration Planning: Understand APIs when upgrading packages
π API Reference
Tools Available
get_npm_package_code
## π§ Installation & Setup
### Option 1: Global Installation
```bash
npm install -g npm-package-mcp-server
npm-package-mcp-server
Option 2: Local Development
git clone https://github.com/Ligament/npm-package-mcp-server.git
cd npm-package-mcp-server
npm install
npm run build
npm start
Option 3: Docker
docker run -it npm-package-mcp-server
π€ AI Assistant Integration
Claude Desktop
Add to your claude_desktop_config.json:
{
"mcpServers": {
"npm-packages": {
"command": "npm-package-mcp-server"
}
}
}
Other MCP Clients
Works with any MCP-compatible client. Configure stdio transport with the server command.
ποΈ Architecture
graph TD
A[AI Assistant] --> B[MCP Client]
B --> C[NPM Package MCP Server]
C --> D[NPM Registry]
C --> E[Package Extraction]
C --> F[File System]
E --> G[Code Analysis]
G --> A
π Supported Packages
- β All public NPM packages
- β
Scoped packages (
@org/package) - β Any published version
- β TypeScript and JavaScript
- β React, Vue, Angular, Node.js packages
- β Monorepo packages
π₯ Popular Packages to Explore
Try these commands with your AI assistant:
"Analyze the lodash utility functions"
"Show me the React hooks implementation"
"Explore the Express.js middleware system"
"Review the TypeScript compiler source"
π οΈ Development
Scripts
npm run build # Compile TypeScript
npm run dev # Development with hot reload
npm run test # Run tests
npm run clean # Clean build artifacts
Contributing
- Fork the repository
- Create feature branch:
git checkout -b feature/amazing-feature - Commit changes:
git commit -m 'Add amazing feature' - Push to branch:
git push origin feature/amazing-feature - Open a Pull Request
π Performance
- Fast Downloads: Optimized npm registry API usage
- Memory Efficient: Streams large packages
- Smart Caching: Temporary file management
- Error Recovery: Robust error handling
π Security
- Read-Only: Never modifies packages
- Sandboxed: Temporary extraction directories
- No Execution: Only reads source code
- Public Packages Only: No private registry access
π Troubleshooting
| Issue | Solution |
|---|---|
| Package not found | Verify package name on npmjs.com |
| Network errors | Check internet connectivity |
| Permission errors | Ensure Node.js 18+ and proper permissions |
| Large packages timeout | Try specific file paths instead of full package |
π License
MIT Β© Ligament
π Star History
π€ Related Projects
β Star this repo β’ π Report Bug β’ π‘ Request Feature
Made with β€οΈ for the AI development community
