npm-package-mcp-server

Ligament/npm-package-mcp-server

3.1

If you are the rightful owner of npm-package-mcp-server and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.

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.

๐Ÿ“ฆ NPM Package MCP Server

npm version TypeScript License: MIT Node.js Version

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

  1. Fork the repository
  2. Create feature branch: git checkout -b feature/amazing-feature
  3. Commit changes: git commit -m 'Add amazing feature'
  4. Push to branch: git push origin feature/amazing-feature
  5. 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

IssueSolution
Package not foundVerify package name on npmjs.com
Network errorsCheck internet connectivity
Permission errorsEnsure Node.js 18+ and proper permissions
Large packages timeoutTry 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