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.1.11

Published

Self-hosted code search MCP server for AI agents. No rate limits, no shared infra. Searches 2M+ public repos via Sourcegraph or any local checkout via ripgrep.

Downloads

1,369

Readme

@kenkaiiii/kencode-search

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

Self-hosted code search MCP server. Your own grep.app for your AI agents — no rate limits, no shared infra.

One tool (searchCode), two backends:

  • sourcegraph (default) — 2M+ public repos via Sourcegraph's public streaming API. Free, no auth.
  • ripgrep — your local directory of <owner>/<name> checkouts.

Schema mirrors grep.app's searchGitHub so agents already trained on that surface "just work" against this server. 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, no rate limits.

Run manually

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

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

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.

Tool: searchCode

| Field | Type | Notes | |---|---|---| | query | string | Literal pattern (or regex if useRegexp: true). | | useRegexp | boolean? | RE2 regex syntax. Prefix (?s) for multi-line. | | matchCase | boolean? | Default false. | | matchWholeWords | boolean? | Honored by ripgrep; ignored by sourcegraph (use \b in regex). | | language | string[]? | e.g. ["TypeScript"], ["Python"]. | | repo | string? | owner/name substring match. | | path | string? | File path substring filter. | | maxResults | number? | Default 50, hard cap 200. | | contextLines | number? | Lines of context per side. Default 5. |

Environment

| Var | Default | Purpose | |---|---|---| | CFM_BACKEND | sourcegraph | sourcegraph or ripgrep. | | CFM_REPOS_DIR | ./repos | Root for ripgrep backend. | | CFM_SOURCEGRAPH_URL | https://sourcegraph.com | Override base URL. | | CFM_SOURCEGRAPH_TOKEN | (unset) | Optional access token for higher limits. |

Architecture

MCP client (agent)
      │  stdio
      ▼
src/index.ts ── McpServer ── 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, no rate limit hit
node bench/compare.mjs 20 10

Roadmap

  • [x] MCP server + searchCode tool with grep.app-style output
  • [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