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

@kenkaiiii/kencode-search

v0.3.4

Published

Code search MCP server for AI agents. Grep-style literal search across 2M+ public GitHub repos, plus live repo discovery.

Readme

@kenkaiiii/kencode-search

npm: @kenkaiiii/kencode-search · github: KenKaiii/kencode-search

Code search MCP server for AI agents. Point an agent at code you just wrote and it finds how real projects implement the same thing.

Two tools, one backend abstraction:

  • discoverRepos — live GitHub repository discovery by keyword, language, topic, stars, and recency.
  • searchCode — literal grep-style code search for known anchors.

Two search backends:

  • sourcegraph (default) — 2M+ public repos via Sourcegraph's public streaming API. Free, no auth, but unmetered and intermittently flaky: it can return empty results and never complete. The tool retries once and reports a backend fault rather than pretending your query found nothing.
  • ripgrep — your local directory of <owner>/<name> checkouts.

searchCode is the core tool: give it a literal anchor from your code (an import, API call, config key) and it returns matching implementations with snippets, stars, and licence. discoverRepos finds candidate repos by popularity when you don't have an anchor yet. Output is LLM-optimized: snippet merging, junk-path filtering (no node_modules/tests/generated noise), per-repo diversity cap, peek mode, pagination, total-count summary.

Why this exists

grep.app's MCP is rate-limited. Their open API is gated by a Vercel bot challenge, so scripts can't hit it. Sourcegraph's public stream API has none of those problems and indexes more repos. We wrap it cleanly.

Install

npm install -g @kenkaiiii/kencode-search

or run on demand without installing:

npx @kenkaiiii/kencode-search

Requirements

  • Node.js ≥ 20
  • For the ripgrep backend only: ripgrep on PATH (brew install ripgrep).

Quick start

Most MCP clients (Claude Code, Cursor, Windsurf, etc.) take this in their config:

{
  "mcpServers": {
    "kencode-search": {
      "command": "npx",
      "args": ["-y", "@kenkaiiii/kencode-search"]
    }
  }
}

That's it — default sourcegraph backend, no config.

Run manually

# Default: sourcegraph backend, no config needed.
kencode-search

# Local repo tree:
CFM_BACKEND=ripgrep CFM_REPOS_DIR=/path/to/repos kencode-search

Build from source

git clone https://github.com/KenKaiii/kencode-search.git
cd kencode-search
npm install
npm run build
node dist/index.js

Pin to the ripgrep backend

{
  "mcpServers": {
    "kencode-search": {
      "command": "npx",
      "args": ["-y", "@kenkaiiii/kencode-search"],
      "env": {
        "CFM_BACKEND": "ripgrep",
        "CFM_REPOS_DIR": "/absolute/path/to/repos"
      }
    }
  }
}

Inspector

npm run inspector

Test

npm test                    # offline smoke (ripgrep backend)
npm run test:sourcegraph    # live integration (hits sourcegraph.com)
npm run test:all            # both

Skip the network leg with CFM_SKIP_NETWORK=1.

Suggested workflow

  1. Use discoverRepos when you need fresh GitHub popularity/ranking or sources outside the curated map.
  2. Fetch README/source/examples for the best candidate repos.
  3. Use searchCode with concrete anchors: repo names, imports, API calls, component names, config keys, or file paths.

Architecture

MCP client (agent)
      │  stdio
      ▼
src/index.ts ── McpServer ┬─ discoverRepos tool
                          └─ searchCode tool
                          │
                          ▼
                  SearchBackend (interface)
                       │              │
                       ▼              ▼
              SourcegraphBackend  RipgrepBackend
              (default; remote)   (local; CFM_REPOS_DIR)

The backend boundary is the whole point: tomorrow we can add Zoekt, on-demand cold-path clones, or stack backends without touching the MCP layer.

Benchmarks

bench/compare.mjs compares sourcegraph.com to grep.app's open API. As of last run:

  • grep.app direct API: 0/30 successful (Vercel bot challenge, 429 on every call)
  • sourcegraph.com: 30/30 successful, p50 ≈ 1.3s. Later testing found this is not reliable — see the backend note above.
node bench/compare.mjs 20 10

Roadmap

  • [x] MCP server + searchCode tool with grep.app-style output
  • [x] Live GitHub repository discovery (discoverRepos)
  • [x] Ripgrep backend (works against any local checkout tree)
  • [x] Sourcegraph backend (2M+ public repos, context fetched from raw endpoint)
  • [ ] Optional fallback chain (Sourcegraph → ripgrep)
  • [ ] Repo crawler for ripgrep corpus (clone top-N by stars, incremental refresh)
  • [ ] Zoekt backend (sub-100ms regex on a self-hosted index)
  • [ ] On-demand cold path (clone + index any GitHub repo on first miss)
  • [ ] HTTP transport for remote hosting