npm API: Search packages
Searches the npm registry for JavaScript packages by description or keywords, in npm's search order, and returns each package's latest version, weekly downloads and publish date.
Unofficial. Not affiliated with or endorsed by npm.
Inputs
Values from the run on Oct 23, 2026, shown under Output.
- Query, required
query What the package should do, or keywords, such as date formatting.
date formatting
- Max Results optional
max_results Maximum number of packages to return, such as 20.
20 (default)
Whole number from 1 to 250.
Input as JSON
{ "query": "date formatting"}Output
{ "packages": [ { "name": "fecha", "publisher": "taylorhakes", "description": "Date formatting and parsing", "search_score": 776.5016, "npm_page_link": "https://www.npmjs.com/package/fecha" , "latest_version": "4.2.3", "weekly_downloads": 14434131, "last_publish_date": "2022-04-15" }, { "name": "@kev_nz/daylight" , "publisher": "kev_nz", "description": "lightweight javascript date formatting", "search_score": 327.087, "npm_page_link": "https://www.npmjs.com/package/@kev_nz/daylight" , "latest_version": "1.0.1", "weekly_downloads": 1216, "last_publish_date": "2019-12-02" }, { "name": "small-date", "publisher": "rofrischmann", "description": "Tiny (0.8kb) date formatting library with built-in i18n", "search_score": 324.78616, "npm_page_link": "https://www.npmjs.com/package/small-date" , "latest_version": "2.0.1", "weekly_downloads": 3929, "last_publish_date": "2024-11-06" } ]}Code
curl https://api.fous.com/v1/runs \ -H "Authorization: Bearer $FOUS_API_KEY" \ -H "Content-Type: application/json" \ -d '{"method":"npmjs.com/search_packages","input":{"query":"date formatting"}}' # Save as fous.py, then run: python3 fous.pyimport json, os, timefrom urllib.error import HTTPErrorfrom urllib.request import Request, urlopenAPI = "https://api.fous.com/v1/runs" KEY = os.environ["FOUS_API_KEY"]HEADERS = { "Authorization": f"Bearer {KEY}", "Content-Type": "application/json" ,}def call(url, body=None): data = json.dumps(body).encode() if body else None request = Request(url, data, HEADERS) try: with urlopen(request, timeout=120) as r: return r.status, json.load(r) except HTTPError as error: message = json.load(error)["error"]["message"] raise RuntimeError(message) from errorstatus, run = call(API, { "method": "npmjs.com/search_packages" , "input": { "query": "date formatting" }})# 202: still going after 30 s. Ask again until it ends.while status == 202: time.sleep(2) status, run = call(f"{API}/{run['id']}")print(json.dumps(run["data"], indent=2))// Save as fous.mjs, then run: node fous.mjsconst api = "https://api.fous.com/v1/runs" ;const headers = { Authorization: `Bearer ${process.env.FOUS_API_KEY}`, "Content-Type": "application/json" ,};let response = await fetch(api, { method: "POST", headers, body: JSON.stringify({ "method": "npmjs.com/search_packages" , "input": { "query": "date formatting" } }), signal: AbortSignal.timeout(120_000),});let run = await response.json();// 202: still going after 30 s. Ask again until it ends.while (response.status === 202) { await new Promise((done) => setTimeout(done, 2_000)); response = await fetch(`${api}/${run.id}`, { headers }); run = await response.json();}if (!response.ok) throw new Error(run.error.message);console.log(run.data);# Connect your agent to Fous once, over MCP (Streamable HTTP):# https://api.fous.com/mcp# Set FOUS_API_KEY first: create a key at https://app.fous.com/keys.# Claude Codeclaude mcp add \ --scope user \ --transport http fous https://api.fous.com/mcp \ --header "Authorization: Bearer ${FOUS_API_KEY:?Set FOUS_API_KEY to your Fous API key}"# Codexcodex mcp add fous \ --url https://api.fous.com/mcp \ --bearer-token-env-var FOUS_API_KEY# Cursor, VS Code, Windsurf, Cline and morenpx -y add-mcp https://api.fous.com/mcp -g -n fous \ --header "Authorization: Bearer ${FOUS_API_KEY:?Set FOUS_API_KEY to your Fous API key}"# Then ask your agent:# "Use Fous to run npmjs.com/search_packages# with {"query":"date formatting"}"Over HTTP, the answer’s data holds the output. A run still going after 30 seconds answers 202 with its id: ask GET /v1/runs/{id} until it ends.
Schema
Input schema
{ "type": "object", "required": [ "query" ], "properties": { "query": { "type": "string", "minLength": 1, "description": "What the package should do, or keywords, such as date formatting." }, "max_results": { "type": "integer", "default": 20, "maximum": 250, "minimum": 1, "description": "Maximum number of packages to return, such as 20.", "x-fous-developer": true } }, "additionalProperties": false}Output schema
{ "type": "object", "required": [ "packages" ], "properties": { "packages": { "type": "array", "items": { "type": "object", "required": [ "name", "latest_version", "description", "weekly_downloads", "last_publish_date", "publisher", "npm_page_link", "search_score" ], "properties": { "name": { "type": "string", "description": "Package name." }, "publisher": { "type": [ "string", "null" ], "description": "Publisher username." }, "description": { "type": [ "string", "null" ], "description": "Package description." }, "search_score": { "type": [ "number", "null" ], "description": "npm search ranking score.", "x-fous-developer": true }, "npm_page_link": { "type": "string", "format": "uri", "description": "Package page on npm." }, "latest_version": { "type": [ "string", "null" ], "description": "Latest published version." }, "weekly_downloads": { "type": [ "integer", "null" ], "description": "Downloads in the past week." }, "last_publish_date": { "type": [ "string", "null" ], "format": "date", "description": "Date of the latest package publish." } }, "additionalProperties": false }, "description": "Matching packages in npm search order." } }, "additionalProperties": false}- Price
- 1 credit per completed run (1¢ with pay as you go); failed runs are free.
- Method
npmjs.com/search_packages- Returns
- name, latest version, description, weekly downloads, last publish date, publisher, npm page link, search score
Use it from your agent
Give your agent this line. It reads SKILL.md, gets a Fous API key and connects the Fous MCP server. Its run then takes the method npmjs.com/search_packages with the inputs above.
Ask your agent
- Find npm packages for parsing CSV files in Node, show top 10 by weekly downloads
- I need a JavaScript library that validates email addresses, list the most popular options
- Which packages handle timezone-aware date formatting? Give me the latest versions and publish dates
- Search npmjs.com for lightweight markdown-to-HTML converters with at least 20 results
- Look up JavaScript packages for generating PDF invoices, sorted by search relevance
See more
All npm methodsLooks up a public npm package by name or npm link. Returns its latest version, weekly downloads, maintainers, links, dates and version count.
npmjs.com/get_packageReturns total and daily or Monday-start weekly npm downloads for a package over the last week, month, or year.
npmjs.com/get_download_statsSearches PyPI by keywords and returns matching packages in relevance order, each with its latest version and that version's release date. Returns up to 100 results.
pypi.org/search_packagesFinds public Docker Hub container images matching a software name, in Docker Hub search order, with publisher, badge, stars, last update and exact total pulls when Docker Hub publishes them. Can keep only Docker Official Images and Verified Publisher images.
hub.docker.com/search_container_imagesFinds Rust crates on crates.io by keywords, sorted by relevance, total downloads, recent downloads, or newest creation.
crates.io/search_cratesFinds Android apps on Google Play by keywords, in Play search order, with each listing's developer, star rating, price and currency for the chosen country, download range and link. Results are limited to apps shown on the public search page.
play.google.com/search_appsFinds Chrome Web Store extensions by keywords in store order, with each listing's developer, users, rating, rating count, short description and store link. Some listings omit developer, users or ratings.
chromewebstore.google.com/search_extensionsSearches the WordPress.org plugin directory by description and returns matches in directory search order, with ratings, installations, compatibility and plugin page links.
wordpress.org/search_plugins