# NPM Package Scraper & Dependency Analyzer (`andok/npm-metadata-extractor`) Actor

Fetch full NPM package metadata, versions, and dependencies in bulk. Build developer intelligence dashboards without rate limits.

- **URL**: https://apify.com/andok/npm-metadata-extractor.md
- **Developed by:** [Andok](https://apify.com/andok) (community)
- **Categories:** Developer tools
- **Features:** Limited permissions
- **Stats:** 3 total users, 2 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $0.47 / 1,000 package analyzeds

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## NPM Package Metadata Extractor

Pull package details and statistics from the official NPM Registry for dependency audits, technology research, and supply-chain analysis. Feed it a list of package names and get back descriptions, latest versions, licenses, authors, keywords, and dependency counts — all from the public registry API without authentication.

### Features

- **Bulk extraction** — analyze dozens of NPM packages in a single run
- **Official registry** — queries `registry.npmjs.org` directly for accurate, up-to-date data
- **Rich metadata** — extracts description, version, license, author, homepage, repository, keywords, and dependency count
- **Repository linking** — automatically cleans and normalizes Git repository URLs
- **No auth required** — uses the public NPM registry API
- **Pay-per-result pricing** — only pay for packages analyzed, with charge-limit safety

### Input

| Field | Type | Required | Default | Description |
|-------|------|----------|---------|-------------|
| `packages` | `array` | Yes | — | List of NPM package names to look up (e.g. `react`, `express`, `apify`) |
| `timeoutSeconds` | `integer` | No | `15` | Per-request API timeout in seconds (1-120) |

#### Input Example

```json
{
  "packages": ["apify", "crawlee", "express"],
  "timeoutSeconds": 15
}
```

### Output

Each dataset item represents one NPM package. Key fields:

- `packageName` (`string`) — the queried package name
- `description` (`string`) — package description from the registry
- `latestVersion` (`string`) — latest published version
- `license` (`string`) — license type (e.g. `MIT`, `Apache-2.0`)
- `author` (`string`) — package author name
- `homepage` (`string`) — homepage URL
- `repository` (`string`) — source repository URL
- `keywords` (`array`) — list of package keywords
- `dependencyCount` (`number`) — number of runtime dependencies in the latest version

#### Output Example

```json
{
  "packageName": "apify",
  "description": "Apify SDK — The scalable web crawling and scraping library for JavaScript/Node.js",
  "latestVersion": "3.2.6",
  "license": "Apache-2.0",
  "author": "Apify Technologies s.r.o.",
  "homepage": "https://docs.apify.com/sdk/js/",
  "repository": "https://github.com/apify/apify-sdk-js",
  "keywords": ["apify", "headless", "chrome", "crawling", "scraping"],
  "dependencyCount": 18
}
```

### Pricing

| Event | Cost |
|-------|------|
| Package Analyzed | Pay-per-event (see actor pricing page) |

### Use Cases

- **Dependency auditing** — check license types and maintenance status of packages in your stack
- **Technology research** — compare packages by version activity, dependency weight, and community keywords
- **Supply-chain analysis** — monitor dependency counts and author changes for security reviews
- **Portfolio tracking** — schedule runs to track version updates across packages you maintain or depend on

### Related Actors

| Actor | What it adds |
|-------|-------------|
| [GitHub API Scraper](https://apify.com/andok/github-api-scraper) | Get repository-level stats (stars, forks) for the package's source repo |
| [Tech Stack Analyzer](https://apify.com/andok/tech-stack-analyzer) | Detect which frameworks and tools a website uses |

# Actor input Schema

## `packages` (type: `array`):

List of NPM package names to look up in the registry. Use exact package names as they appear on npmjs.com (e.g. react, express, @apify/crawlee).

## `timeoutSeconds` (type: `integer`):

Per-request timeout for NPM Registry API calls in seconds.

## Actor input object example

```json
{
  "packages": [
    "apify"
  ],
  "timeoutSeconds": 15
}
```

# Actor output Schema

## `results` (type: `string`):

No description

## `resultsCsv` (type: `string`):

No description

## `run` (type: `string`):

No description

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "packages": [
        "apify"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("andok/npm-metadata-extractor").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = { "packages": ["apify"] }

# Run the Actor and wait for it to finish
run = client.actor("andok/npm-metadata-extractor").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "packages": [
    "apify"
  ]
}' |
apify call andok/npm-metadata-extractor --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,andok/npm-metadata-extractor"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/vOt3DBcbNoHRB0cX9/builds/TcDCi1YKLJtHZOvHd/openapi.json
