# PyPI & npm Package Health, Releases & Supply-Chain Risk (MCP) (`the_magic_dragon/pypi-npm-package-health-mcp`) Actor

Audit PyPI and npm packages in real time for release freshness, deprecated or yanked versions, maintainer bus-factor, license hygiene, repository links, download velocity, and deterministic 0-100 maintenance health & supply-chain risk flags. MCP-ready.

- **URL**: https://apify.com/the_magic_dragon/pypi-npm-package-health-mcp.md
- **Developed by:** [Cade Hockley](https://apify.com/the_magic_dragon) (community)
- **Categories:** AI, Developer tools
- **Features:** Limited permissions
- **Stats:** 1 total users, 0 monthly users, 0.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $2.20 / 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/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

## PyPI & npm Package Health, Releases & Supply-Chain Risk (MCP)

Audit **PyPI** (`pypi.org` + `pypistats.org`) and **npm** (`registry.npmjs.org` + `api.npmjs.org`) dependencies in real time for **release freshness**, **deprecated or yanked latest versions**, **maintainer bus-factor**, **license hygiene**, **repository URLs**, **download velocity**, and a deterministic **`0-100` maintenance health score** with structured supply-chain risk flags.

Built for **Apify Pay-per-Event** (`$0.004` per valid package analyzed = `US$4.00 / 1,000 packages`; malformed inputs and HTTP `404` not-found packages are not charged) and ready for **Hosted MCP (`mcp.apify.com`)**, **Clay**, and **n8n** workflows.

### Overview & Key Features

- **Dual-Registry Live Metadata:** Queries official `pypi.org/pypi/{name}/json` and `registry.npmjs.org/{name}` APIs (including scoped npm packages such as `@types/node`) using pure Python stdlib HTTP/JSON with zero heavy scraping overhead.
- **Supply-Chain Risk Flags:** Computes deterministic boolean flags (`deprecated`, `yankedLatest`, `staleOver365Days`, `missingLicense`, `singleMaintainer`, `hasRepositoryUrl`) plus human-readable `issues`.
- **Optional Download Velocity:** Enriches results with `downloadsLastMonth` (plus `downloadsLastWeek` and `downloadsLastDay` for PyPI) via `pypistats.org` and `api.npmjs.org` with graceful `null` fallback if rate-limited or unavailable.
- **Zero-Charge Guardrails:** Invalid entries (`""`, `"bad:pkg"`, whitespace/control chars) emit `status: "invalid_input"`, and missing packages emit `status: "not_found"`, both with **`0` PPE charges**.
- **Concise MCP Mode:** Limits verbose maintainer arrays, URL maps, and long descriptions so AI coding agents and dependency auditors stay compact inside LLM context windows.

### Input & Output Reference

#### Input Parameters

| Field | Type | Default | Description |
| :--- | :--- | :--- | :--- |
| `packages` | `string[]` | `["pypi:requests", "npm:axios"]` | Required list of registry-prefixed packages (`pypi:<name>`, `npm:<name>`, `npm:@scope/name`). Also accepts `{"registry": "pypi"\|"npm", "name": "..."}` objects programmatically. |
| `timeoutSeconds` | `integer` | `12` | Per-request HTTP timeout in seconds (`3`–`30`). |
| `includeDownloadStats` | `boolean` | `true` | Fetch recent download counts from `pypistats.org` and `api.npmjs.org` (graceful `null` fallback). |
| `conciseMcpMode` | `boolean` | `true` | Caps maintainer lists (top 5), project URLs (top 5), and summaries (280 chars) for MCP context efficiency. |

#### Output Dataset Fields

| Field | Type | Description |
| :--- | :--- | :--- |
| `registry` / `name` | `string` | Normalized registry (`pypi` or `npm`) and canonical package name. |
| `status` / `ok` | `string` / `boolean` | `ok` (`true`), `invalid_input` (`false`), `not_found` (`false`), or `error` (`false`). |
| `latestVersion` | `string \| null` | Latest published version (`info.version` on PyPI, `dist-tags.latest` on npm). |
| `daysSinceLastRelease` | `integer \| null` | Days elapsed since the latest version was published. |
| `maintenanceHealthScore` | `integer` | Deterministic `0`–`100` score (`HEALTHY`, `MODERATE`, `AT_RISK`, `CRITICAL`, or `ERROR`). |
| `riskFlags` | `object` | `{ deprecated, yankedLatest, staleOver365Days, missingLicense, singleMaintainer, hasRepositoryUrl }`. |
| `downloadsLastMonth` | `integer \| null` | Last 30-day download count when `includeDownloadStats` is enabled and available. |

### Use Cases

- **AI Coding & AppSec Agents:** Verify release recency, license hygiene, deprecation status, and single-maintainer bus factor via `mcp.apify.com` before adding a Python or JS dependency.
- **Vendor & Supply-Chain Audits:** Batch-check open-source dependencies across internal SBOMs in n8n to flag `staleOver365Days`, `deprecated`, or `yankedLatest` packages.
- **DevTools Market Intelligence:** Track monthly PyPI/npm download velocity and maintainer counts across competing SDKs in Clay.

### Pay-per-Event Pricing & Store Discounts

This Actor uses **Apify Pay-per-Event (PPE)** billing on `package-analyzed`, with **automatic Apify Store discounts** for paid subscription tiers:

| Apify Tier | Price per Package Analyzed | Effective Rate / 1,000 Packages |
| --- | --- | --- |
| Free (`FREE`) | `$0.0040` | `US$4.00` |
| Starter (`BRONZE`) | `$0.0034` | `US$3.40` (15% off) |
| Scale (`SILVER`) | `$0.0028` | `US$2.80` (30% off) |
| Business (`GOLD`) | `$0.0022` | `US$2.20` (45% off) |
| Enterprise (`PLATINUM` / `DIAMOND`) | `$0.0018` / `$0.0014` | `US$1.80` / `US$1.40` |

- **Charged ONLY on `HTTP 200`:** Malformed entries (`invalid_input`), missing packages (`not_found`), and upstream failures (`error`) incur **`$0.00`**. Respects Apify spending caps cleanly at **256 MB** RAM.

### Example Input

```json
{
  "packages": [
    "pypi:requests",
    "npm:axios",
    "npm:@types/node"
  ],
  "timeoutSeconds": 12,
  "includeDownloadStats": true,
  "conciseMcpMode": true
}
```

### Example Output

```json
{
  "input": "npm:axios",
  "registry": "npm",
  "name": "axios",
  "status": "ok",
  "ok": true,
  "latestVersion": "1.21.1",
  "summary": "Promise based HTTP client for the browser and node.js",
  "license": "MIT",
  "requiresPython": null,
  "latestReleaseAtUtc": "2026-11-09T16:17:55.565000+00:00",
  "daysSinceLastRelease": 18,
  "totalReleases": 94,
  "versionsCount": 94,
  "dependenciesCount": 3,
  "maintainersCount": 1,
  "maintainers": ["jasonsaayman"],
  "downloadsLastMonth": 630824254,
  "downloadsLastWeek": null,
  "downloadsLastDay": null,
  "repositoryUrl": "https://github.com/axios/axios",
  "homepageUrl": "https://axios-http.com",
  "projectUrls": {
    "Repository": "https://github.com/axios/axios",
    "Homepage": "https://axios-http.com"
  },
  "deprecatedMessage": null,
  "maintenanceHealthScore": 90,
  "healthBand": "HEALTHY",
  "riskFlags": {
    "deprecated": false,
    "yankedLatest": false,
    "staleOver365Days": false,
    "missingLicense": false,
    "singleMaintainer": true,
    "hasRepositoryUrl": true
  },
  "issues": [
    "Single maintainer/owner detected (bus-factor concentration risk)."
  ],
  "auditedAtUtc": "2026-11-27T17:58:03+00:00",
  "error": null
}
```

### Hosted MCP Configuration (`mcp.apify.com`)

Connect this Actor in Claude Desktop, Cursor, Windsurf, or any MCP-compatible agent using Apify's hosted MCP endpoint:

```json
{
  "mcpServers": {
    "apify": {
      "command": "npx",
      "args": [
        "-y",
        "mcp-remote",
        "https://mcp.apify.com/?actors=the_magic_dragon/pypi-npm-package-health-mcp",
        "--header",
        "Authorization: Bearer ${APIFY_TOKEN}"
      ]
    }
  }
}
```

### Clay & n8n Usage Notes

- **Clay:** Add an **Apify — Run Actor** or **HTTP API** enrichment column pointing to `the_magic_dragon~pypi-npm-package-health-mcp` with `{"packages": ["npm:{{Package Name}}"], "conciseMcpMode": true}` to enrich SaaS/OSS vendor tech stacks with release freshness and single-maintainer supply-chain signals.
- **n8n:** Use the official **Apify** node (`Run an Actor and get dataset items`) inside CI/CD, Dependabot, or security-triage workflows to gate dependency upgrades on `maintenanceHealthScore >= 65`, `riskFlags.deprecated == false`, and `riskFlags.yankedLatest == false`.

### FAQ & Troubleshooting

- **How are scoped npm packages formatted?** Prefix with `npm:` as usual, e.g. `"npm:@types/node"` or `"npm:@modelcontextprotocol/sdk"`.
- **What if `pypistats.org` is temporarily rate-limited?** The Actor degrades gracefully (`downloadsLastMonth: null`) and still returns full release, maintainer, license, and risk-flag intelligence from `pypi.org`.
- **Am I charged for `404` package typos?** No. Only `HTTP 200` metadata retrievals trigger `package-analyzed`.

# Actor input Schema

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

List of registry-prefixed packages to audit (e.g. 'pypi:requests', 'npm:axios', 'npm:@types/node'). Programmatic callers may also pass {'registry': 'pypi'|'npm', 'name': '...'} objects.

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

Per-request HTTP timeout in seconds for registry and download stats queries (3-30).

## `includeDownloadStats` (type: `boolean`):

Fetch recent download counts from pypistats.org (PyPI) and api.npmjs.org (npm) with graceful null fallback if rate-limited or unavailable.

## `conciseMcpMode` (type: `boolean`):

Trim verbose maintainer lists, auxiliary project URLs, and long summaries to stay lightweight inside LLM / MCP context windows.

## Actor input object example

```json
{
  "packages": [
    "pypi:requests",
    "npm:axios"
  ],
  "timeoutSeconds": 12,
  "includeDownloadStats": true,
  "conciseMcpMode": true
}
```

# Actor output Schema

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

Structured per-package release freshness, license, maintainer, download stats, maintenanceHealthScore, and riskFlags records.

# 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": [
        "pypi:requests",
        "npm:axios"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("the_magic_dragon/pypi-npm-package-health-mcp").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": [
        "pypi:requests",
        "npm:axios",
    ] }

# Run the Actor and wait for it to finish
run = client.actor("the_magic_dragon/pypi-npm-package-health-mcp").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": [
    "pypi:requests",
    "npm:axios"
  ]
}' |
apify call the_magic_dragon/pypi-npm-package-health-mcp --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,the_magic_dragon/pypi-npm-package-health-mcp"
        }
    }
}
```

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/PKtwitCeeRZzB4OG5/builds/vuJTfAFdRnVjyg1aW/openapi.json
