Skip to main content

embgrep

한국어 문서

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

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

Quick Start

Python API

from embgrep import EmbGrep

eg = EmbGrep()

# Index a directory
eg.index("./my-project", patterns=["*.py", "*.md"])

# Semantic search
results = 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 statistics
status = eg.status()
print(f"{status.total_files} files, {status.total_chunks} chunks, {status.index_size_mb} MB")

eg.close()

CLI

# Index a project
embgrep index ./my-project --patterns "*.py,*.md"

# Search
embgrep search "error handling patterns"

# Filter by file type
embgrep search "async database query" --path-filter "%.py"

# Check status
embgrep status

# Update changed files
embgrep update

Convenience functions

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:

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

Or with uvx:

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

MCP Tools

Tool Description
index_directory Index files in a directory for semantic search
semantic_search Search indexed files using natural language
index_status Get current index statistics
update_index Incremental update — re-index changed files only

How It Works

  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

Parameter Default Description
db_path ~/.local/share/embgrep/embgrep.db SQLite database location
model BAAI/bge-small-en-v1.5 fastembed model name
max_chunk_size 1000 chars Maximum chunk size for fixed-size splitting
top_k 5 Number of search results

QuartzUnit Ecosystem

Package Description
markgrab HTML/YouTube/PDF/DOCX to LLM-ready markdown
snapgrab URL to screenshot + metadata
docpick OCR + LLM document structure extraction
browsegrab Local LLM browser agent
feedkit RSS feed collection + MCP
embgrep Local semantic search for files

License

MIT

Release files for embgrep 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for embgrep 0.1.1
File Size Uploaded
embgrep-0.1.1.tar.gz 20.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for embgrep 0.1.1
File Interpreter ABI Platform
embgrep-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size:35.7 kB

Release files / embgrep-0.1.1.tar.gz

Download URL embgrep-0.1.1.tar.gz
Size 20.5 kB
Tags Source
SHA-256 checksum
How to use checksums
8d48ad0c5c5e67ee178c3744866cdde39589835d74a0fc2182cdf5e668328bc3
BLAKE2b-256 checksum
How to use checksums
8e984b76bb54df2162c6b2d0894659bef542d573d7b0d7578137510ff3dd0a27
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Mar 25, 2026.

Transparency log

Release files / embgrep-0.1.1-py3-none-any.whl

Download URL embgrep-0.1.1-py3-none-any.whl
Size 15.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6e05921223f884c57b2bd3a1483083769b5b627007df2c025b35577d98707064
BLAKE2b-256 checksum
How to use checksums
91d022517f4caeb216124b0f8be45a5e6a98946e7e8ac8a262095cb6abc19abb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Mar 25, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page