### Run mcp-server-npm-plus CLI Source: https://github.com/ofershap/mcp-server-npm-plus/blob/main/README.md This command initiates the mcp-server-npm-plus server, making its features available for AI assistants. It requires Node.js and npm to be installed. ```bash npx mcp-server-npm-plus ``` -------------------------------- ### Development commands for npm-server-plus Source: https://context7.com/ofershap/mcp-server-npm-plus/llms.txt Provides essential npm scripts for project development, including dependency installation, type checking, building the project, running tests, and code linting/formatting. These commands streamline the development workflow. ```bash # Install dependencies npm install # Type checking npm run typecheck # Build npm run build # Run tests npm test # Lint and format npm run lint npm run format ``` -------------------------------- ### Development Commands for mcp-server-npm-plus Source: https://github.com/ofershap/mcp-server-npm-plus/blob/main/README.md A set of npm scripts for developing and maintaining the mcp-server-npm-plus project. These commands cover installation, type checking, building, testing, linting, and formatting. ```bash npm install npm run typecheck npm run build npm test npm run lint npm run format ``` -------------------------------- ### Get npm Package Information using MCP Tool Source: https://context7.com/ofershap/mcp-server-npm-plus/llms.txt Illustrates using the 'package_info' MCP tool to retrieve detailed information about a specific npm package. This includes its description, license, repository URL, and dependency lists. ```typescript // MCP Tool Call { "tool": "package_info", "arguments": { "name": "express" } } // Underlying API function import { getPackageInfo } from "./npm-api.js"; const info = await getPackageInfo("express"); // Returns: { // name: "express", // version: "4.18.0", // description: "Fast, unopinionated, minimalist web framework", // keywords: ["web", "framework"], // license: "MIT", // homepage: "https://expressjs.com", // repository: "https://github.com/expressjs/express", // dependencies: { debug: "2.6.9", ... }, // devDependencies: { eslint: "8.0.0", ... } // } ``` -------------------------------- ### Get npm Package Downloads using MCP Tool Source: https://context7.com/ofershap/mcp-server-npm-plus/llms.txt Shows how to use the 'downloads' MCP tool to fetch download statistics for an npm package over a specified period. Supported periods include 'last-day', 'last-week', 'last-month', and 'last-year'. ```typescript // MCP Tool Call { "tool": "downloads", "arguments": { "name": "lodash", "period": "last-month" // Options: last-day, last-week, last-month, last-year } } // Underlying API function import { getDownloads } from "./npm-api.js"; const stats = await getDownloads("lodash", "last-month"); // Returns: { // package: "lodash", // downloads: 25000000, // start: "2025-01-01", // end: "2025-01-31" // } ``` -------------------------------- ### Get npm package download trends Source: https://context7.com/ofershap/mcp-server-npm-plus/llms.txt Provides daily download statistics for an npm package, including a sparkline visualization for trend analysis. It offers total downloads, average per day, minimum, and maximum downloads over a specified period (e.g., 'last-month'). ```typescript // MCP Tool Call { "tool": "download_trends", "arguments": { "name": "typescript", "period": "last-month" } } // Example Response // ## typescript — 2025-01-01 to 2025-01-31 // // Total: 45,000,000 | Avg/day: 1,451,612 | Min: 800,000 | Max: 1,800,000 // // Trend: ▃▄▅▆▇█▇▆▅▄▃▄▅▆▇█▇▆▅▄▃▄▅▆▇█▇▆▅▄ // // | Day | Downloads | // |-----|-----------| // | 2025-01-18 | 1,200,000 | // | 2025-01-19 | 800,000 | // | 2025-01-20 | 1,500,000 | // ... // Underlying API function import { getDownloadTrends } from "./npm-api.js"; const trends = await getDownloadTrends("typescript", "last-month"); // Returns formatted string with: // - Total, average, min, max statistics // - ASCII sparkline visualization (▁▂▃▄▅▆▇█) // - Daily breakdown table (last 14 days) ``` -------------------------------- ### Get npm package bundle size analysis Source: https://context7.com/ofershap/mcp-server-npm-plus/llms.txt Retrieves the minified and gzipped bundle size for an npm package using the Bundlephobia API. It can optionally include the package version. The output provides size metrics in bytes and the dependency count. ```typescript // MCP Tool Call { "tool": "bundle_size", "arguments": { "name": "lodash" // Can include version: "lodash@4.17.21" } } // Example Response // # lodash@4.17.21 bundle size // // | Metric | Size | // |--------|------| // | Minified | 69.46 KB | // | Gzipped | 23.97 KB | // | Dependencies | 0 | // Underlying API function import { getBundleSize } from "./npm-api.js"; const size = await getBundleSize("lodash"); // Returns: { // name: "lodash", // version: "4.17.21", // size: 71124, // bytes (minified) // gzip: 24542, // bytes (gzipped) // dependencyCount: 0 // } // With specific version const sizeWithVersion = await getBundleSize("lodash@4.17.21"); ``` -------------------------------- ### Get npm package vulnerability information Source: https://context7.com/ofershap/mcp-server-npm-plus/llms.txt Fetches vulnerability information and advisory links for a given npm package. This tool is primarily for guidance on security audits, as detailed vulnerability data often requires running `npm audit` within a project context or checking external advisories. ```typescript // MCP Tool Call { "tool": "vulnerabilities", "arguments": { "name": "express" } } // Example Response // Vulnerability data for "express" requires `npm audit` in a project that uses it. // // Public APIs: Run `npm audit` in your project, or check advisories at: // https://github.com/advisories?query=express // // For automated scanning, consider Snyk or Dependabot. // Underlying API function import { getVulnerabilities } from "./npm-api.js"; const text = await getVulnerabilities("express"); // Returns instructional message with GitHub Advisory link ``` -------------------------------- ### Compare npm Package Downloads using MCP Tool Source: https://context7.com/ofershap/mcp-server-npm-plus/llms.txt Demonstrates the 'compare_downloads' MCP tool for evaluating the relative popularity of multiple npm packages. It takes an array of package names and a time period to return their download counts. ```typescript // MCP Tool Call { "tool": "compare_downloads", "arguments": { "packages": ["zustand", "jotai", "valtio"], "period": "last-month" } } // Underlying API function import { compareDownloads } from "./npm-api.js"; const results = await compareDownloads(["zustand", "jotai"], "last-month"); // Returns: Array<{ // package: string, // downloads: number, // start: string, // end: string // }> ``` -------------------------------- ### Search npm Packages using MCP Tool Source: https://context7.com/ofershap/mcp-server-npm-plus/llms.txt Demonstrates how to use the 'search' MCP tool to find npm packages based on a query. It returns package names, versions, descriptions, and keywords. The optional 'size' argument controls the number of results. ```typescript // MCP Tool Call { "tool": "search", "arguments": { "query": "react state management", "size": 10 // Optional: 1-50, default 10 } } // Underlying API function import { searchPackages } from "./npm-api.js"; const results = await searchPackages("lodash", 5); // Returns: Array<{ name, version, description, keywords, downloads }> ``` -------------------------------- ### Configure mcp-server-npm-plus for Cursor Source: https://github.com/ofershap/mcp-server-npm-plus/blob/main/README.md Configuration for integrating mcp-server-npm-plus with Cursor. This JSON snippet should be added to the `.cursor/mcp.json` file to enable the 'npm-plus' server. ```json { "mcpServers": { "npm-plus": { "command": "npx", "args": ["mcp-server-npm-plus"] } } } ``` -------------------------------- ### Download Trends Source: https://context7.com/ofershap/mcp-server-npm-plus/llms.txt Retrieves daily download statistics for an npm package, including a sparkline visualization. ```APIDOC ## GET /download_trends ### Description Get daily download breakdown with sparkline visualization to analyze adoption trends. ### Method GET ### Endpoint `/download_trends` ### Query Parameters - **name** (string) - Required - The name of the npm package (e.g., `typescript`). - **period** (string) - Optional - The time period for the download trends (e.g., `last-month`, `last-week`). Defaults to `last-month`. ### Response #### Success Response (200) - **trends** (string) - A formatted string containing download statistics, sparkline visualization, and daily breakdown. #### Response Example ``` ## typescript — 2025-01-01 to 2025-01-31 Total: 45,000,000 | Avg/day: 1,451,612 | Min: 800,000 | Max: 1,800,000 Trend: ▃▄▅▆▇█▇▆▅▄▃▄▅▆▇█▇▆▅▄▃▄▅▆▇█▇▆▅▄ | Day | Downloads | |-----|-----------| | 2025-01-18 | 1,200,000 | | 2025-01-19 | 800,000 | | 2025-01-20 | 1,500,000 | ... ``` ``` -------------------------------- ### Bundle Size Analysis Source: https://context7.com/ofershap/mcp-server-npm-plus/llms.txt Retrieves the minified and gzipped bundle size analysis for a given npm package using Bundlephobia. ```APIDOC ## GET /bundle_size ### Description Get bundle size analysis (minified and gzipped) for an npm package via Bundlephobia. ### Method GET ### Endpoint `/bundle_size` ### Query Parameters - **name** (string) - Required - The name of the npm package (e.g., `lodash` or `lodash@4.17.21`). ### Response #### Success Response (200) - **name** (string) - The name of the package. - **version** (string) - The version of the package. - **size** (number) - Minified size in bytes. - **gzip** (number) - Gzipped size in bytes. - **dependencyCount** (number) - The number of direct dependencies. #### Response Example ```json { "name": "lodash", "version": "4.17.21", "size": 71124, "gzip": 24542, "dependencyCount": 0 } ``` ``` -------------------------------- ### Display npm package dependency tree Source: https://context7.com/ofershap/mcp-server-npm-plus/llms.txt Visualizes the direct dependencies of an npm package in a tree structure. The output includes both regular dependencies and devDependencies, providing a clear overview of the package's dependency graph. ```typescript // MCP Tool Call { "tool": "dependency_tree", "arguments": { "name": "next" } } // Example Response // next@14.0.0 // // dependencies: // ├── @next/env@14.0.0 // ├── @swc/helpers@0.5.2 // ├── busboy@1.6.0 // ├── caniuse-lite@^1.0.30001406 // ├── postcss@8.4.31 // ├── styled-jsx@5.1.1 // // devDependencies: // ├── @types/react@18.2.0 // ├── typescript@5.0.0 // Underlying API function import { getDependencyTree } from "./npm-api.js"; const tree = await getDependencyTree("next"); // Returns formatted string: // "next@14.0.0\n\ndependencies:\n├── react@18.0.0\n├── react-dom@18.0.0\n\ndevDependencies:\n├── typescript@5.0.0" ``` -------------------------------- ### Dependency Tree Source: https://context7.com/ofershap/mcp-server-npm-plus/llms.txt Displays the direct dependencies of an npm package in a formatted tree structure. ```APIDOC ## GET /dependency_tree ### Description Display the direct dependencies of an npm package as a formatted tree structure. ### Method GET ### Endpoint `/dependency_tree` ### Query Parameters - **name** (string) - Required - The name of the npm package (e.g., `next`). ### Response #### Success Response (200) - **tree** (string) - A formatted string representing the dependency tree of the package. #### Response Example ``` next@14.0.0 dependencies: ├── @next/env@14.0.0 ├── @swc/helpers@0.5.2 ├── busboy@1.6.0 ├── caniuse-lite@^1.0.30001406 ├── postcss@8.4.31 ├── styled-jsx@5.1.1 devDependencies: ├── @types/react@18.2.0 ├── typescript@5.0.0 ``` ``` -------------------------------- ### Vulnerability Information Source: https://context7.com/ofershap/mcp-server-npm-plus/llms.txt Fetches vulnerability information and advisory links for an npm package, useful for security audits. ```APIDOC ## GET /vulnerabilities ### Description Get vulnerability information and advisory links for an npm package. Provides guidance for security audits. ### Method GET ### Endpoint `/vulnerabilities` ### Query Parameters - **name** (string) - Required - The name of the npm package (e.g., `express`). ### Response #### Success Response (200) - **message** (string) - An instructional message with guidance on how to check vulnerabilities and a link to GitHub advisories. #### Response Example ``` Vulnerability data for "express" requires `npm audit` in a project that uses it. Public APIs: Run `npm audit` in your project, or check advisories at: https://github.com/advisories?query=express For automated scanning, consider Snyk or Dependabot. ``` ``` -------------------------------- ### TypeScript API Interfaces for npm analysis Source: https://context7.com/ofershap/mcp-server-npm-plus/llms.txt Defines core interfaces used in the npm API for package information, search results, bundle size analysis, and download statistics. These types ensure type safety and clarity when working with the API functions. ```typescript // Core interfaces exported from npm-api.ts export interface PackageInfo { name: string; version: string; description: string; keywords: string[]; license: string; homepage: string; repository: string; dependencies: Record; devDependencies: Record; } export interface SearchResult { name: string; version: string; description: string; keywords: string[]; downloads: number; } export interface BundleSize { name: string; version: string; size: number; // minified size in bytes gzip: number; // gzipped size in bytes dependencyCount: number; } export interface DownloadStats { package: string; downloads: number; start: string; // ISO date string end: string; // ISO date string } ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.