Embgrep

io.github.ArkNill由 GitHub 帳號 ArkNill 發布v0.1.0更新於 Oct 24, 2026

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

概覽

AI 產生的概覽

Embgrep 是本地 MCP 伺服器,會將檔案索引成向量嵌入,讓助理能對程式碼庫或文件進行語意搜尋。

可以做什麼
它提供四個工具:index_directory 用來索引目錄中的檔案,semantic_search 用自然語言查詢已索引的檔案,index_status 取得索引統計資訊,update_index 只針對變更過的檔案進行增量重建索引。檔案會依函式層級或標題層級切分成片段,使用 fastembed 與 ONNX Runtime 在本機產生嵌入,並以向量形式存進單一 SQLite 檔案。搜尋依餘弦相似度排序,回傳檔案路徑、行號範圍與分數。
適用情境
適合助理需要依語意而非精確關鍵字尋找程式碼或文件的情況,例如定位驗證中介軟體或資料庫連線池相關邏輯。也適合本機專案,希望在不必把檔案內容送到雲端服務、也不用另外執行向量資料庫的前提下進行語意搜尋。
執行需求
以本機行程在使用者電腦上執行,從 PyPI 安裝 embgrep 並加上 mcp 擴充(例如透過 uvx)。需要具備 fastembed 與 numpy 的 Python 環境,首次使用時會下載 BAAI/bge-small-en-v1.5 模型。不需要 API 金鑰、帳號或外部服務。索引預設儲存在 ~/.local/share/embgrep/embgrep.db。
安裝前請注意
此伺服器會讀取你指定目錄中的檔案,並將索引資料庫寫入磁碟,因此索引某個目錄會使其內容進入本機索引。預設模型偏向英文(BGE-small-en-v1.5),對其他語言的品質可能較差。不涉及憑證或付費。

安裝

在 SourceWeft 中

  1. 開啟 儀表板中的 Embgrep,將其新增到工作區。
  2. 為需要使用其工具的對話啟用該服務。

Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。

其他 MCP 客戶端

參照 儲存庫 中的啟動說明。

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.

來源:README.md,提交 3e4f6da

工具

0
SourceWeft 尚未在沙箱中啟動過該軟體包,因此其工具未知。

版本歷史

1
  1. v0.1.0最新Sep 16, 2026

評分

已滿足適用檢查項的 50%

該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。

  • 近 30 天內可連通25 分

    請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。

  • 已宣告認證方式10 分

    請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。

  • 已列出工具15 分

    請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。

  • 描述必需15 分
  • 圖示10 分
  • 文件15 分
  • 授權條款10 分