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 分