@kenkaiiii/kencode-search
v0.1.17
Published
Code search and reference discovery MCP server for AI agents. Curated UI, agent, CRM, automation, social, publishing, and workflow sources plus live GitHub repo discovery.
Maintainers
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.
Three tools, one backend abstraction:
referenceSources— curated, categorized map of high-signal GitHub repos for styling inspiration, product UI, coding agents, agent infrastructure, LLM apps, app starters, real products, CRMs, automations, social/community apps, and content/blog/CMS systems.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.ripgrep— your local directory of<owner>/<name>checkouts.
referenceSources gives agents a deterministic curated repo map before they search: React Bits, Uiverse, 21st.dev, real product repos, coding-agent implementations, MCP/tooling infrastructure, modern app starters, Twenty/Chatwoot/Odoo-style business apps, Activepieces/n8n/Windmill-style automation systems, Bluesky/Mastodon/Discourse-style social/community apps, and Payload/Ghost/Strapi-style publishing systems. discoverRepos handles fresh/top GitHub discovery when popularity, stars, language, or topics matter. searchCode 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-searchor run on demand without installing:
npx @kenkaiiii/kencode-searchRequirements
- Node.js ≥ 20
- For the
ripgrepbackend only:ripgreponPATH(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
# Local repo tree:
CFM_BACKEND=ripgrep CFM_REPOS_DIR=/path/to/repos kencode-searchBuild from source
git clone https://github.com/KenKaiii/kencode-search.git
cd kencode-search
npm install
npm run build
node dist/index.jsPin 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 inspectorTest
npm test # offline smoke (ripgrep backend)
npm run test:sourcegraph # live integration (hits sourcegraph.com)
npm run test:all # bothSkip the network leg with CFM_SKIP_NETWORK=1.
Suggested workflow
- Use
referenceSourcesfor known-good curated sources when the request is broad: styling inspiration, product UI, coding-agent workflows, MCP/tooling, LLM apps, SaaS starters, real production apps, CRMs/business apps, automations/workflows, social/media/community features, blog/publishing/CMS systems, auth/data plumbing, etc. - Use
discoverReposwhen you need fresh GitHub popularity/ranking or sources outside the curated map. - Fetch README/source/examples for the best candidate repos.
- Use
searchCodewith concrete anchors: repo names, imports, API calls, component names, config keys, or file paths.
Tool: referenceSources
Use for categorized curated GitHub repositories. It is deterministic and does not hit the network. It intentionally prefers repos an agent can inspect directly: concrete inspiration sources, real products, and coding-agent workflows over generic library lists. Every entry is repo-backed, curated from currently reachable public GitHub repositories, and includes a Verified line in results.
| Field | Type | Notes |
|---|---|---|
| domain | string? | ui, product-ui, agents, agent-infra, llm-apps, app-starters, real-apps, business-apps, automation, social-community, content-publishing, auth-data. |
| category | string[]? | e.g. styling-inspiration, component-galleries, coding-agents, mcp, browser-automation, chatbots, saas-starter, real-app-screens, crm, customer-support, workflow-automation, background-jobs, social-apps, community-forums, blogging, cms, documentation, auth, database. |
| stack | string[]? | e.g. React, Next.js, TypeScript, Python, Tailwind CSS, MCP, Claude Code, Vercel AI SDK, Stripe, Drizzle, Rails, Vue, Astro, Payload CMS, Ghost. |
| style | string[]? | e.g. inspiration, animated, copy-paste, marketing, real-product, coding-agent, cli, tool-use, workflow, automation, integrations, social, community, publishing, content, docs. |
| query | string? | Text filter over curated metadata. |
| maxResults | number? | Default 8, hard cap 40. |
| includeSearchHints | boolean? | Include suggested searchCode anchors. Default true. |
Example:
{
"domain": "automation",
"category": ["workflow-automation"],
"style": ["automation"],
"maxResults": 5
}Tool: discoverRepos
Use for live GitHub repository discovery sorted by stars by default. This returns repo metadata, not code snippets.
| Field | Type | Notes |
|---|---|---|
| query | string | Repository search keywords, e.g. "openai agents framework", "animated react components", "open source CRM", "workflow automation". |
| language | string[]? | GitHub language filters. Multiple languages are searched separately and merged. |
| topic | string[]? | GitHub topic filters, e.g. ai-agents, react, tailwindcss. |
| minStars | number? | Default 500. |
| sort | "stars" \| "forks" \| "updated" \| "best-match"? | Default "stars". |
| maxResults | number? | Default 10, hard cap 30. |
| includeArchived | boolean? | Default false. |
Unauthenticated GitHub search is limited; set CFM_GITHUB_TOKEN for higher limits.
Tool: searchCode
Use when you already know a literal anchor to search. Start broad or with peek: true; add repo/path only after the anchor is known to exist.
| 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; can overconstrain. |
| path | string? | Literal file-path substring filter, not a concept/category. |
| 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. |
| CFM_GITHUB_TOKEN | (unset) | Optional GitHub token for discoverRepos and license/freshness metadata lookup. |
| CFM_DISABLE_LICENSE | (unset) | Set 1/true to skip GitHub metadata lookup. |
Architecture
MCP client (agent)
│ stdio
▼
src/index.ts ── McpServer ┬─ referenceSources tool
├─ 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, no rate limit hit
node bench/compare.mjs 20 10Roadmap
- [x] MCP server +
searchCodetool with grep.app-style output - [x] Curated categorized references (
referenceSources) - [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
