Embgrep

io.github.ArkNillPublished by GitHub account ArkNillv0.1.0Updated Oct 24, 2026

Local semantic search — embedding-powered grep for files, zero external services.

Overview

AI-generated overview

Embgrep is a local MCP server that indexes files into embeddings and lets an assistant run semantic searches over a codebase or documentation.

What you can do
It exposes four tools: index_directory to index files in a directory, semantic_search to query indexed files in natural language, index_status for index statistics, and update_index for incremental re-indexing of changed files. Files are split into function-level or heading-level chunks, embedded locally with fastembed and ONNX Runtime, and stored as vectors in a single SQLite file. Search ranks chunks by cosine similarity and returns file paths, line ranges, and scores.
When to use it
Use it when an assistant needs to find code or documentation by meaning rather than exact keywords, for example locating authentication middleware or database connection pooling logic. It suits local projects where you want semantic search without sending file contents to a cloud service or running a separate vector database.
Requirements
Runs as a local process on the user's machine, installed from PyPI as embgrep with the mcp extra (for example via uvx). It needs a Python environment with fastembed and numpy, and downloads the BAAI/bge-small-en-v1.5 model on first use. No API keys, accounts, or external services are required. The index is stored by default at ~/.local/share/embgrep/embgrep.db.
Before you install
The server reads files from directories you point it at and writes an index database to disk, so indexing a directory makes its contents part of the local index. The default model is English-oriented (BGE-small-en-v1.5), which may reduce quality for other languages. No credentials or payments are involved.

Installation

In SourceWeft

  1. Open Embgrep in the dashboard and add it to a workspace.
  2. Enable the server for the chats that should use its tools.

Desktop only via STDIO. STDIO servers start a local process, so they need the SourceWeft desktop host.

Other MCP clients

Follow the launch instructions in the repository.

README

embgrep

한국어 문서 · llms.txt

Local semantic search — embedding-powered grep for files, zero external services.

[PyPI] [Python] [License: MIT]

Search your codebase and documentation by meaning, not just keywords. embgrep indexes files into local embeddings and lets you run semantic queries — no API keys, no cloud services, no vector database servers.

Features

  • Local embeddings — Uses fastembed (ONNX Runtime), no API keys needed
  • SQLite storage — Single-file index, no external vector DB
  • Incremental indexing — Only re-indexes changed files (SHA-256 hash comparison)
  • Smart chunking — Function-level splitting for code, heading-level for docs
  • MCP native — 4-tool FastMCP server for LLM agent integration
  • 15+ file types — .py, .js, .ts, .java, .go, .rs, .md, .txt, .yaml, .json, .toml, and more

Install

bash
pip install embgrep              # core (fastembed + numpy)pip install embgrep[cli]         # + click/rich CLIpip install embgrep[mcp]         # + FastMCP serverpip install embgrep[all]         # everything

Quick Start

Python API

python
from embgrep import EmbGrep
eg = EmbGrep()
# Index a directoryeg.index("./my-project", patterns=["*.py", "*.md"])
# Semantic searchresults = eg.search("database connection pooling", top_k=5)for r in results:    print(f"{r.file_path}:{r.line_start}-{r.line_end} (score: {r.score:.4f})")    print(f"  {r.chunk_text[:80]}...")
# Incremental update (only changed files)eg.update()
# Index statisticsstatus = eg.status()print(f"{status.total_files} files, {status.total_chunks} chunks, {status.index_size_mb} MB")
eg.close()

CLI

bash
# Index a projectembgrep index ./my-project --patterns "*.py,*.md"
# Searchembgrep search "error handling patterns"
# Filter by file typeembgrep search "async database query" --path-filter "%.py"
# Check statusembgrep status
# Update changed filesembgrep update

Convenience functions

python
import embgrep
embgrep.index("./src")results = embgrep.search("authentication middleware")status = embgrep.status()embgrep.update()

MCP Server

Add to your Claude Desktop / MCP client configuration:

json
{  "mcpServers": {    "embgrep": {      "command": "embgrep-mcp"    }  }}

Or with uvx:

json
{  "mcpServers": {    "embgrep": {      "command": "uvx",      "args": ["--from", "embgrep[mcp]", "embgrep-mcp"]    }  }}

MCP Tools

ToolDescription
index_directoryIndex files in a directory for semantic search
semantic_searchSearch indexed files using natural language
index_statusGet current index statistics
update_indexIncremental update — re-index changed files only

How It Works

mermaid
flowchart TD    A["📁 Files"] --> B["Smart Chunking\ncode: function-level\ndocs: heading-level"]    B --> C["fastembed\nlocal embeddings"]    C --> D["SQLite\nvector index"]    D --> E["🔍 Query"]    E --> F["Cosine Similarity\nranked results"]    F --> G["✅ Matches\nwith context"]
  1. Chunking — Files are split into semantically meaningful chunks:

    • Code files (.py, .js, .ts, etc.): split by function/class boundaries
    • Documents (.md, .txt): split by headings or paragraph breaks
    • Config files: fixed-size chunking
  2. Embedding — Each chunk is converted to a 384-dimensional vector using BGE-small-en-v1.5 via ONNX Runtime (no PyTorch needed)

  3. Storage — Embeddings are stored as BLOBs in a local SQLite database

  4. Search — Query text is embedded and compared against all chunks using cosine similarity

Configuration

ParameterDefaultDescription
db_path~/.local/share/embgrep/embgrep.dbSQLite database location
modelBAAI/bge-small-en-v1.5fastembed model name
max_chunk_size1000 charsMaximum chunk size for fixed-size splitting
top_k5Number of search results

QuartzUnit Ecosystem

PackageDescription
markgrabHTML/YouTube/PDF/DOCX to LLM-ready markdown
snapgrabURL to screenshot + metadata
docpickOCR + LLM document structure extraction
browsegrabLocal LLM browser agent
feedkitRSS feed collection + MCP
embgrepLocal semantic search for files

Used in

  • newswatch — RSS news monitoring pipeline (feedkit → markgrab → embgrep → diffgrab)

License

MIT


Part of the QuartzUnit ecosystem — composable Python libraries for data collection, extraction, search, and AI agent safety.

Source: README.md at commit 3e4f6da

Tools

0
SourceWeft has not started this package in its sandbox yet, so its tools are not known.

Version history

1
  1. v0.1.0LatestSep 16, 2026

Score

50% of the applicable checks met

How complete this listing is, computed from the registry entry, the endpoint and public sources. Not a rating of the server and not a statement that it is safe or working today: reachability is a dated check, and no installs or reviews go into the score.

  • Reached in the last 30 days25 pts

    Keep the endpoint answering the MCP handshake; SourceWeft probes it every 30 days.

  • Auth declared10 pts

    Declare the credential headers in the registry entry, or keep the endpoint answering the probe so its auth can be classified.

  • Tools listed15 pts

    Answer tools/list without a credential, or ship a package that starts in a sandbox without one.

  • DescriptionRequired15 pts
  • Logo10 pts
  • Documentation15 pts
  • License10 pts