[Integrations](https://spiral.ai/integrations) › [opencode](https://spiral.ai/integrations/opencode) › [npm package search](https://spiral.ai/integrations/opencode/npm-package-search)

# How to Use npm package search in opencode

Returns matching npm packages and a reported result total, with pagination. Use it to build a shortlist from a topic or description before fetching package details.

|  |  |
| --- | --- |
| Model | npm package search |
| Available through | Alexandria |
| Category | E-commerce |
| Price | $0.00873 per call. |
| Returns | json |
| Runs | In the background |
| Setup | About 2 minutes, no API key |

## Prompts to try with npm package search in opencode

- Use npm package search to find JSON Schema validators, then compare the returned descriptions with this project's validation requirements.
- Use npm package search to look this up and give me the result as a table. Save the result in ./assets.
- Pull the latest numbers from npm package search and tell me what changed since last week.
- Check npm package search and summarize what you find in three bullet points.
- Pull the newest data from npm package search and give me the result as a table.

## How to set up npm package search in opencode

Pick the way that suits you. Each takes about two minutes.

### Use Spiral's MCP server

1. **Add the server**: Leave out `--global` to add Spiral to the current project only. No header and no client ID or secret: opencode registers itself with Spiral.

```bash
opencode mcp add spiral --global --url https://api.spiral.ai/mcp
```

2. **Sign in**: Your browser opens. Sign in to Spiral, pick the organization and click Authorize, then return to the terminal. No API key. Inside opencode, `/mcps` starts the same sign-in.

```bash
opencode mcp auth spiral
```

3. **Check it**: Spiral shows as connected.

```bash
opencode mcp list
```

### Use the Spiral skill

1. **Send opencode this message**: Your agent reads Spiral's skill and sets itself up.

```
set up https://spiral.ai/SKILL.md
```

2. **Sign in or paste a key**: Approve Spiral in the browser, or give the agent a key from the console.

### Use the Spiral CLI

1. **Install and sign in**: Installs the Spiral CLI, signs you in and adds its skill to your coding agents.

```bash
npx -y spiral-cli@latest init
```

### Call the Spiral API

1. **Create an API key**: In the console, under API keys.

2. **Run npm package search**: One request; the result comes back by polling or a webhook.

```bash
curl https://api.spiral.ai/v1/runs \
  -H "Authorization: Bearer $SPIRAL_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: $(uuidgen)" \
  -d '{
    "provider": "alexandria",
    "model": "npmjs-com/packages/search_packages",
    "input": {
      "query": "<query>"
    }
  }'
```

Then paste one of the prompts above: opencode finds npm package search on Spiral, shows the price and runs it.

Setup guide in the docs: https://spiral.ai/docs/quickstarts/opencode

## npm package search tools and prices

- [npm · Search packages](https://spiral.ai/tools/alexandria/npmjs-com/packages/search_packages) (Alexandria): $0.00873 per call.

## Settings you can ask for

| Setting | Allowed values | Default | Description |
| --- | --- | --- | --- |
| size | 1 to 250 | 20 | Hits per page (registry maximum 250). |
| cursor |  | — | `next_cursor` from a previous page (the registry `from` offset). Pattern: ^[0-9]+$. |

## What can you do with npm package search in opencode?

Produce an npm dependency review tied to your project's requirements. Turn returned package metadata, discovery results, or download measurements into evidence for the review.

### Compare dependency candidates

Find package names for schema validation, inspect published metadata and release requirements, and compare download totals, daily patterns, and version shares. Build a shortlist for a project trial.

### Review a publisher's public catalog

Inventory an npm organization's packages, use search and name suggestions to locate packages of interest, and inspect their descriptions and repositories. Produce a catalog organized by purpose.

### Check package references in developer documentation

Resolve package names with search and suggestions, check publisher catalogs, and inspect package and release metadata. Use the results to correct package references and dependency requirements in a tutorial.

### Find downstream integrations

Start with dependent packages and publisher catalogs, then use search and name suggestions to find related integrations. Review descriptions and download totals to select packages for compatibility testing.

### Research package adoption

Define a package sample through search and publisher listings. Compare download totals, daily trends, version shares, and downstream package relationships for an adoption report.

### Check package identity before evaluation

Resolve a partial package name, compare search matches with publisher listings, and inspect repository and release metadata. Produce an identity check before testing the package.

## Overview

- [Alexandria](https://spiral.ai/providers/alexandria)
- [All opencode guides](https://spiral.ai/integrations/opencode)

## npm package search in other agents

- [Amp](https://spiral.ai/integrations/amp/npm-package-search)
- [ChatGPT](https://spiral.ai/integrations/chatgpt/npm-package-search)
- [Claude](https://spiral.ai/integrations/claude-desktop/npm-package-search)
- [Claude Code](https://spiral.ai/integrations/claude-code/npm-package-search)
- [Cline](https://spiral.ai/integrations/cline/npm-package-search)
- [Codex](https://spiral.ai/integrations/codex/npm-package-search)
- [Cursor](https://spiral.ai/integrations/cursor/npm-package-search)
- [Devin](https://spiral.ai/integrations/devin/npm-package-search)
- [dots](https://spiral.ai/integrations/dots/npm-package-search)
- [Factory Droid](https://spiral.ai/integrations/factory-droid/npm-package-search)
- [Gemini](https://spiral.ai/integrations/gemini/npm-package-search)
- [Gemini CLI](https://spiral.ai/integrations/gemini-cli/npm-package-search)
- [Google Antigravity](https://spiral.ai/integrations/antigravity/npm-package-search)
- [goose](https://spiral.ai/integrations/goose/npm-package-search)
- [Grok](https://spiral.ai/integrations/grok/npm-package-search)
- [Grok Build](https://spiral.ai/integrations/grok-build/npm-package-search)
- [Hermes](https://spiral.ai/integrations/hermes/npm-package-search)
- [Instinct](https://spiral.ai/integrations/instinct/npm-package-search)
- [Manus](https://spiral.ai/integrations/manus/npm-package-search)
- [Muse](https://spiral.ai/integrations/muse/npm-package-search)
- [Muse Code](https://spiral.ai/integrations/muse-code/npm-package-search)
- [n8n](https://spiral.ai/integrations/n8n/npm-package-search)
- [Notion](https://spiral.ai/integrations/notion/npm-package-search)
- [OpenClaw](https://spiral.ai/integrations/openclaw/npm-package-search)
- [Perplexity](https://spiral.ai/integrations/perplexity/npm-package-search)
- [Raycast](https://spiral.ai/integrations/raycast/npm-package-search)
- [VS Code](https://spiral.ai/integrations/vscode/npm-package-search)
- [Windsurf](https://spiral.ai/integrations/windsurf/npm-package-search)
- [Zapier](https://spiral.ai/integrations/zapier/npm-package-search)

## More opencode guides

- [npm package name suggestions](https://spiral.ai/integrations/opencode/npm-package-name-suggestions)
- [npm package version details](https://spiral.ai/integrations/opencode/npm-package-version-details)
- [npm package download totals](https://spiral.ai/integrations/opencode/npm-package-download-totals)
- [npm publisher packages](https://spiral.ai/integrations/opencode/npm-publisher-packages)
- [npm package details](https://spiral.ai/integrations/opencode/npm-package-details)
- [AWS price file metadata](https://spiral.ai/integrations/opencode/aws-price-file-metadata)

## Questions about npm package search in opencode

**Can opencode use npm package search?**

Yes. Add Spiral to opencode as an MCP server, and opencode can find and run npm package search like any built-in tool.

**How much does npm package search cost in opencode?**

$0.00873 per call. You pay from your Spiral balance as you go, with no subscription, and a failed run is not charged. Your opencode plan is separate.

**Do I need an Alexandria account to use npm package search in opencode?**

No. Spiral runs npm package search on its own Alexandria account. You sign in to Spiral once and never paste a key.

**How long does it take to set up npm package search in opencode?**

About two minutes: add the server, then sign in, then check it.

**Does opencode wait while npm package search runs?**

npm package search runs in the background. opencode starts the run, checks on it and gives you the json when it's ready.

**How fresh are npm download statistics?**

npm documents a daily process that aggregates the previous day's logs after UTC midnight. Download statistics therefore describe completed reporting days.

**Why might a published package be missing from npm search?**

npm says newly published packages can take up to two weeks to appear. Deprecated packages are excluded from search results.

**Do npm download counts represent unique users?**

No. npm counts successful package tarball responses, including downloads from automated builds, mirrors, and analysis robots.

**How much download history can npm return at once?**

npm limits download queries other than bulk queries to 18 months per request. Per-version download counts cover only the previous seven days.

**Does npm search return every match in one response?**

npm registry search returns at most 250 matches per request and supports offset pagination. The response also reports a total.

