Ken logo

Ken

Hybrid local code search for agents, combining BM25, semantic embeddings, fusion, and code-aware reranking in a Go binary.

Install Ken

Run the project’s own setup commands, in order.

Setup steps from the project

ken installs with its own steps rather than a config we can generate, so these are copied as-is. Follow them in order and run the commands in a terminal. Source: github.com

  1. 1. Install
    brew install --cask townsendmerino/tap/ken
    
  2. 2. Install
    scoop bucket add townsendmerino https://github.com/townsendmerino/scoop-bucket
    
  3. 3. Install
    scoop install ken
    
  4. 4. Install
    go install github.com/townsendmerino/ken/cmd/ken@latest
    
  5. 5. Install
    go install github.com/townsendmerino/ken/cmd/ken-mcp@latest
    
  6. 6. Add to Claude Code
    claude mcp add ken -s user -- /absolute/path/to/ken-mcp
    

Overview

ken is a pure-Go MCP code-search server that indexes local repositories and exposes `search` and `find_related` over JSON-RPC stdio or Streamable HTTP. It combines BM25 lexical search, an in-process Model2Vec embedding model, reciprocal-rank fusion, and code-aware reranking. Use it when an agent needs relevant code context rather than exhaustive file enumeration, with no Python, API key, GPU, or vector database. Its watcher reindexes repository changes so edits made during an agent session can be searched without restarting.

Use cases

  • Search a local repository for code that answers an agent's implementation question
  • Find code related to a retrieved function or concept
  • Keep search results current while an agent edits a repository
  • Serve one indexed codebase to multiple remote agents over authenticated HTTP

Key features

  • Hybrid BM25 and Model2Vec semantic search
  • Code-aware reranking with reciprocal-rank fusion
  • Single static Go binary with CPU-only inference
  • Repository watching with nested .gitignore support
  • Stdio and Streamable HTTP MCP transports
  • Automatic or explicit embedding-model installation

Tools2

What Ken lets your agent do. Expand a tool for its parameters.

Self-reported~5 tokens of context

Security & health

What it can reach and how reliably it runs — from our own checks, not the maintainer’s claims.

ActiveLast checked

Recent health check succeeded.

9/9 checks healthy over the last 33d

Adoption & maintenance

Factual signals from GitHub, npm, and our automated checks — not a rating.

GitHub stars34Stargazers on the source repository.
Last commit4d agoMost recent push to the default branch.
Tools exposed2Callable tools this server registers over MCP.
Directory activity1 viewsConfig copies, upvotes, and views on AllMCPs.

How Ken works

What ken does

ken provides local code retrieval for coding agents through the Model Context Protocol. Its two core MCP tools are search, which finds repository content for a query, and find_related, which retrieves related code. Both use the same argument shapes and markdown output format as MinishLab’s semble server, allowing an existing semble-oriented MCP configuration to switch to the ken-mcp executable.

The search pipeline supports three modes: hybrid, BM25-only, and semantic. Hybrid combines lexical matching with Model2Vec embeddings, reciprocal-rank fusion, and a code-aware reranker. The default model is a 16-million-parameter Model2Vec model that runs inside the process on the CPU.

How it works

ken-mcp indexes a local repository and watches it for changes. The MCP process keeps running, applies a two-second debounce to updates, and reindexes changed content so an agent can retrieve files it has just modified. Repository discovery respects nested .gitignore files using per-directory Git-style matching.

The server is distributed as a single static Go binary and does not depend on cgo, Python, a hosted embedding API, or a vector database. The model is fetched automatically on first use by default, or can be downloaded explicitly with ken download-model. Until the model is available, model-dependent modes serve BM25 results; the CLI can also be placed explicitly in BM25 mode.

Setup and configuration

Install the ken and ken-mcp binaries with Homebrew on macOS and Linux, Scoop on Windows, or Go 1.26+ using the package paths documented by the project. Configure an MCP client with the absolute path to ken-mcp. Claude Code, Cursor, VS Code, and Codex examples are provided using local subprocess transport.

For a pre-indexed repository, set KEN_MCP_DEFAULT_REPO; this allows tool calls to omit the repository argument. KEN_MCP_MODE selects hybrid, bm25, or semantic, while KEN_MCP_MODEL_DIR points to a Model2Vec snapshot. KEN_MCP_AUTO_FETCH=0 disables automatic model retrieval.

The default transport is stdio and keeps the repository local to the client process. Streamable HTTP can serve multiple agents from a centralized machine by setting KEN_MCP_TRANSPORT=http. HTTP deployments require KEN_MCP_AUTH_TOKEN_FILE, should use KEN_MCP_DEFAULT_REPO, and can set KEN_MCP_ADDR and KEN_MCP_RATE_LIMIT. TLS must be terminated by a reverse proxy; ken-mcp does not provide TLS itself.

Tools and capabilities

  • search for lexical, semantic, or hybrid repository retrieval.
  • find_related for locating code related to an existing result or concept.
  • Automatic repository watching and reindexing in MCP mode.
  • CPU-only Model2Vec inference with no external service credentials.
  • CLI commands for searching, indexing, downloading the model, and checking setup with ken doctor.
  • Optional lower-memory watched dense storage through KEN_ANN=flat-i8.

Limitations and notes

ken is designed for finding the code chunk that answers a question, not for exhaustive enumeration. Refactors, pre-rename audits, and other completeness-sensitive tasks may still be better served by grep. Without the embedding model, retrieval falls back to BM25 and does not use the default hybrid path.

HTTP mode exposes the service to a network and therefore requires authentication. It rejects startup without a token, rejects sampled database values when KEN_DB_SAMPLE_ROWS is greater than zero, and applies per-client-IP rate limiting by default. Local stdio mode is unaffected by these HTTP-specific guards.

Written by AllMCPs with AI assistance from the project’s README and listing data. How we build listings

Reviews

No reviews yet — be the first to share how it worked for you.

Frequently Asked Questions about Ken

ken is an MCP server that connects coding agents to local source repositories and exposes `search` and `find_related` tools. It combines BM25 lexical retrieval, Model2Vec semantic embeddings, reciprocal-rank fusion, and code-aware reranking in a pure-Go binary, using stdio locally or authenticated Streamable HTTP for remote access.

Install `ken` and `ken-mcp` with Homebrew, Scoop, or Go 1.26+, then configure your MCP client with the absolute path to `ken-mcp`. The Go installation uses the `github.com/townsendmerino/ken/cmd/ken` and `cmd/ken-mcp` packages.

Yes, ken works with Cursor through its MCP configuration. Add a local `mcpServers` entry whose `command` points to the absolute `ken-mcp` path, or configure a remote MCP URL with an Authorization bearer token.

Set `KEN_MCP_TRANSPORT=http`, configure an authentication token with `KEN_MCP_AUTH_TOKEN_FILE`, and optionally set `KEN_MCP_ADDR`, `KEN_MCP_DEFAULT_REPO`, and `KEN_MCP_RATE_LIMIT`. Put a TLS-terminating reverse proxy in front because ken-mcp does not provide TLS.

No, ken does not need Python, cgo, an API key, a GPU, or a vector database. Its Model2Vec model, BM25 search, fusion, and reranking run locally in the Go process on the CPU.

Related MCP servers

Add a badge to your READMEShow it’s listed — live SVG, Markdown or HTML.

AllMCPs Directory Badge

Full Badge Customizer

Showcase your server listing on GitHub or your project documentation. Embed this dynamic SVG badge to highlight official listing status and live engagement.

Badge Style:
Live Dynamic SVG PreviewKen AllMCPs Directory Badge
Markdown (GitHub README)
[![AllMCPs](https://allmcps.com/api/badge/ken?style=directory)](https://allmcps.com/mcp/ken)
HTML Embed
<a href="https://allmcps.com/mcp/ken"><img src="https://allmcps.com/api/badge/ken?style=directory" alt="Ken on AllMCPs" /></a>