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

opencode-metasearch2

v0.1.2

Published

OpenCode plugin for web search powered by metasearch2

Downloads

429

Readme

opencode-metasearch2

OpenCode plugin that adds a web_search tool powered by metasearch2 -- a fast meta-search engine that aggregates results from Google, Bing, Brave, and others. No API keys required.

Credits

Built on metasearch2 by mat-1 -- an awesome open-source meta-search engine written in Rust. All the heavy lifting (search aggregation, ranking, deduplication) happens there.

Quick start

npm install opencode-metasearch2

Add to your opencode.json:

{
  "plugins": {
    "metasearch": "opencode-metasearch2"
  }
}

That's it. The plugin ships with pre-built binaries for macOS, Linux, and Windows -- no Rust toolchain needed. On first run it spawns metasearch2 locally and exposes a web_search tool to your agent.

Tool

web_search

Search the web using a local metasearch engine that aggregates results from Google, Bing, Brave, and others. Returns raw JSON with search results, featured snippets, direct answers, and infoboxes.

| Argument | Type | Default | Description | |---|---|---|---| | query | string | (required) | The search query | | type | "all" \| "images" | "all" | "all" for web results, "images" for image search |

Web search response

[{
  "search_results": [
    {
      "result": { "url": "https://...", "title": "...", "description": "..." },
      "engines": ["google", "bing", "brave"],
      "score": 1.55
    }
  ],
  "featured_snippet": {
    "url": "https://...", "title": "...", "description": "...", "engine": "google"
  },
  "answer": { "html": "42", "engine": "numbat" },
  "infobox": { "html": "<h2>...</h2>", "engine": "wikipedia" }
}]

All fields except search_results are optional -- they appear when metasearch2 finds a direct answer, featured snippet, or infobox (Wikipedia, GitHub, StackOverflow, MDN, docs.rs).

Image search response

[{
  "image_results": [
    {
      "result": {
        "image_url": "https://...",
        "page_url": "https://...",
        "title": "...",
        "width": 1200,
        "height": 800
      },
      "engines": ["google", "bing"],
      "score": 1.5
    }
  ]
}]

How it works

  1. Locates or installs the metasearch binary
  2. Writes a config to ~/.config/metasearch/config.toml enabling the JSON API and image search
  3. Spawns the binary as a child process
  4. Polls until the HTTP API is healthy (up to 10s)
  5. Exposes a web_search tool to your agent

The metasearch2 process is killed automatically when the session ends.

Configuration

| Variable | Default | Description | |---|---|---| | METASEARCH_BIN | (auto-resolved) | Path to the metasearch2 binary | | METASEARCH_PORT | 28019 | Port for the local HTTP API | | METASEARCH_AUTO_INSTALL | true | Set to false to skip auto cargo install | | XDG_CONFIG_HOME | ~/.config | Base directory for the config file |

Advanced: engine configuration

The plugin generates a default ~/.config/metasearch/config.toml on first run. You can edit it to enable/disable engines, adjust ranking weights, or block domains:

api = true
bind = "0.0.0.0:28019"

[image_search]
enabled = true

[engines]
google_scholar = true       # enable (off by default)
marginalia = false          # disable

[engines.brave]
weight = 2.0               # boost Brave results

[urls.weight]
".quora.com" = 0            # hide Quora results
".pinterest.com" = 0        # hide Pinterest results

Available engines: google (default), bing (default), brave (default), marginalia (default), google_scholar, rightdao, stract, yep. See the metasearch2 docs for all options.

Binary resolution

The plugin checks for the binary in order:

  1. METASEARCH_BIN environment variable
  2. Bundled platform package (@galelmalah/metasearch2-*) -- installed automatically as an optionalDependency
  3. $CARGO_HOME/bin/metasearch (default: ~/.cargo/bin/metasearch)
  4. /tmp/metasearch2-build/bin/metasearch
  5. Auto-install: runs cargo install metasearch if none of the above exist

Benchmark

npx tsx benchmark.ts       # 5 queries
npx tsx benchmark.ts 20    # 20 queries

Reports startup timing (binary resolution, config, spawn, health check) and per-query search latencies with min/max/avg/p50/p95.

Development

git clone https://github.com/galElmalah/opencode-metasearch2.git
cd opencode-metasearch2
npm install
npm run build
npx tsx --test test.ts

License

MIT