npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

polysearch

v0.0.15

Published

Unified search interface supporting multiple search engines with deduplication and weighted ranking

Readme

polysearch

npm version npm downloads npm license Contributor Covenant

Unified search interface supporting multiple search engines with intelligent result merging and weighted ranking

Installation

npm install polysearch
yarn add polysearch
pnpm add polysearch

Quick Start

import { createPolySearch } from "polysearch";
import googleDriver from "polysearch/drivers/google";
import duckduckgoDriver from "polysearch/drivers/duckduckgo";
import githubRepoDriver from "polysearch/drivers/github-repo";
import npmDriver from "polysearch/drivers/npm";
import polyDriver from "polysearch/drivers/poly";

const search = createPolySearch({ driver: googleDriver() });

const results = await search.search({ query: "TypeScript", perPage: 10 });
console.log(`Found ${results.results.length} results`);

const suggestions = await search.suggest({ query: "TypeS" });
console.log("Suggestions:", suggestions);

Available Drivers

| Driver | Import | Description | | ------------- | ---------------------------------- | ------------------------------------- | | Google | polysearch/drivers/google | Google search via Playwright | | Google CSE | polysearch/drivers/google-cse | Google Custom Search Engine API | | DuckDuckGo | polysearch/drivers/duckduckgo | Privacy-focused search | | NPM | polysearch/drivers/npm | NPM package registry search | | GitHub Repo | polysearch/drivers/github-repo | GitHub repository search | | GitHub Code | polysearch/drivers/github-code | GitHub code search | | GitHub Issue | polysearch/drivers/github-issue | GitHub issue search | | GitHub Commit | polysearch/drivers/github-commit | GitHub commit search | | GitHub User | polysearch/drivers/github-user | GitHub user search | | GitHub Label | polysearch/drivers/github-label | GitHub label search | | GitHub Topic | polysearch/drivers/github-topic | GitHub topic search | | HTTP | polysearch/drivers/http | Connect to any HTTP search API | | Poly | polysearch/drivers/poly | Combine multiple drivers with weights |

Driver Options Example

Each driver accepts its own configuration options. For example, the GitHub repo driver supports sorting and ordering:

import githubRepoDriver from "polysearch/drivers/github-repo";

const driver = githubRepoDriver({ token: process.env.GITHUB_TOKEN });

const results = await driver.search({
  query: "polysearch",
  perPage: 10,
  sort: "stars",
  order: "desc",
});

See each driver's TypeScript type definitions for available options.

Caching

All drivers support optional caching:

// Default LRU cache
const search = createPolySearch({
  driver: duckduckgoDriver({ cache: { perPage: 20, ttl: 3600, maxItems: 200 } }),
});

// Disable caching
const noCache = createPolySearch({ driver: duckduckgoDriver({ cache: false }) });

// Custom storage
import { createStorage } from "unstorage";
import memoryDriver from "unstorage/drivers/memory";

const custom = createPolySearch({
  driver: duckduckgoDriver({
    cache: { storage: createStorage({ driver: memoryDriver() }), ttl: 600 },
  }),
});

Server

HTTP Server

import { createSearchServer } from "polysearch/servers/http";
import duckduckgoDriver from "polysearch/drivers/duckduckgo";

const server = createSearchServer({ driver: duckduckgoDriver() });
server.serve(3000);

// GET /search?q=query&page=1&perPage=10
// GET /suggest?q=query

MCP Server

import { createMcpServer } from "polysearch/servers/mcp";

// Default: duckduckgo + google-cse (if GOOGLE_CSE_CX is set)
const server = createMcpServer();
server.serve(3000);

// Custom driver combination
const server = createMcpServer({ drivers: ["duckduckgo", "npm", "github-repo"] });

// Use handler directly
const { handler } = createMcpServer({ drivers: ["duckduckgo"] });

MCP server exposes JSON-RPC 2.0 endpoint at /mcp with tools: search, suggest.

Configure in Claude Code

Add to .claude/settings.json:

{
  "mcpServers": {
    "polysearch": {
      "command": "npx",
      "args": ["polysearch", "mcp"]
    }
  }
}

With custom drivers:

{
  "mcpServers": {
    "polysearch": {
      "command": "npx",
      "args": ["polysearch", "mcp", "--drivers", "duckduckgo,npm,github-repo"]
    }
  }
}

Types

interface SearchResponse {
  results: SearchResult[];
  totalResults?: number;
  pagination?: { page?: number; perPage?: number };
}

interface SearchResult {
  title: string;
  url: string;
  snippet?: string;
  sources?: string[];
}

License