# Npm — how to use (mcp.ai)

Connect your Npm account and use 12 tools for developer tools straight from your AI agent. Connect with your own API key. npm is the default package manager for JavaScript and Node.js, facilitating the sharing and reuse of code, managing dependencies, and streamlining project workflows.

## Option A — via MCP (recommended)
Remote MCP endpoint (HTTP, streamable): `https://api.mcp.ai/p_npm?ms=1787291220000`
Add it as a custom/remote MCP connector in your client (Claude, Cursor, VS Code…), then authenticate when prompted. Once connected, ask the agent to use the server's tools (e.g. `npm_delete_user_token_legacy`).

## Option B — via direct REST API
Base URL: `https://api.mcp.ai/api/npm`
Auth: `Authorization: Bearer sk_live_…` — create a workspace API key at https://mcp.ai/settings/api-keys
Discover endpoints: `GET https://api.mcp.ai/api/npm/_endpoints`

### Endpoints
- `POST https://api.mcp.ai/api/npm/delete/user/token/legacy` — Tool to delete a user authentication token using the legacy endpoint. Use when you need to revoke or remove a specific token from the npm registry.
  - body: { token: string, npm_otp?: string }
- `POST https://api.mcp.ai/api/npm/get/all/packages/download/point` — Get total npm registry download statistics for all packages for a specified time period. Returns aggregate download counts across the entire npm registry with start/end dates. Supports preset periods 
  - body: { period: string }
- `POST https://api.mcp.ai/api/npm/get/download/counts/point` — Get npm package download statistics for a specified time period. Returns total download counts with start/end dates for single packages, scoped packages, or bulk queries (up to 128 packages). Supports
  - body: { period: string, package: string }
- `POST https://api.mcp.ai/api/npm/get/download/counts/range/package` — Tool to get download counts for an npm package over a specified date range. Use when you need historical daily download data.
  - body: { end: string, start: string, package: string }
- `POST https://api.mcp.ai/api/npm/get/download/range/all` — Tool to get daily download counts for all npm packages over a specified period. Use when you need aggregate download statistics across the entire npm registry.
  - body: { period: string }
- `POST https://api.mcp.ai/api/npm/get/registry/changes` — Tool to get a stream of registry changes for replication purposes. Returns CouchDB-style change feed for following registry updates.
  - body: { limit?: integer, since?: integer }
- `POST https://api.mcp.ai/api/npm/get/registry/meta` — Retrieves npm registry metadata via meta endpoints. Use 'ping' to verify registry connectivity or 'whoami' to get the authenticated username.
  - body: { endpoint: string }
- `POST https://api.mcp.ai/api/npm/get/version/downloads` — Tool to get download counts for specific versions of a package over the last 7 days. Use when you need to understand which versions are most popular.
  - body: { package: string }
- `POST https://api.mcp.ai/api/npm/query/bulk/security/advisories` — Tool to bulk query security advisories for multiple npm packages. Use when you need to check vulnerability information for multiple packages and versions at once.
  - body: { packages: object }
- `POST https://api.mcp.ai/api/npm/registry/get/package` — Tool to fetch metadata for a specified npm package. Use after confirming the exact package name, including scope. Responses can be large; prefer reading top-level fields like 'dist-tags', 'description
  - body: { package: string, version?: string }
- `POST https://api.mcp.ai/api/npm/registry/get/root` — Fetches npm registry root metadata including total package count and update sequence. Returns database statistics from the npm replication service. No parameters required. Use this to get current regi
- `POST https://api.mcp.ai/api/npm/registry/search/packages` — Tool to search for packages in the npm registry. Use when you need to find packages matching a search term. Results are returned in an 'objects' array; each element contains package metadata under a '
  - body: { size?: integer, text: string, offset?: integer, quality?: number, popularity?: number, maintenance?: number }

## Example prompts
- "What can I do in Npm?"
- "Show me a summary of my Npm account"

## More
- Page: https://mcp.ai/npm
- Agent spec (llms.txt): https://mcp.ai/npm/llms.txt
- Postman collection: https://mcp.ai/npm/postman.json
