Full-text search inside Word, PPT, Excel and PDF files, with precise locators.
Full-text search inside Word, PowerPoint, Excel and PDF — for agents.
grep cannot see a single character inside a .docx. officegrep extracts the text, indexes it into one SQLite file, and hands it to any agent over MCP.
$ officegrep search "bending moment"
Found 3 hits:
F:\reports\pole-design.docx [table p 89]
design bending moment (load point 0.25 m from tip); deflection limit; test moment = 2× …
F:\notes\composites.md [line 32]
… utilization 81%. **test bending moment = 2× the standard test moment** …
中文说明:README.zh-CN.md
grep / ripgrep only read plain text. .docx is a zip of XML, .xlsx keeps strings in a shared table, .pdf is a compressed stream.pip install git+https://github.com/Asgoresmilelong/officegrep
# optional PDF support
pip install "officegrep[pdf] @ git+https://github.com/Asgoresmilelong/officegrep"
Runtime deps: lxml, openpyxl. PDF needs optional pypdf.
officegrep index ~/Documents ~/Downloads # build / update (incremental)
officegrep search "island reef" --limit 5
officegrep search "wind load" --under ~/Documents
officegrep stats
The index lives in ~/.officegrep/index.db; override with --db or OFFICEGREP_DB.
officegrep mcp
Client config (Claude Desktop / Cursor / Codex / any MCP host):
{
"mcpServers": {
"officegrep": {
"command": "officegrep",
"args": ["mcp", "--db", "/Users/me/.officegrep/index.db"]
}
}
}
| Tool | What it does |
|---|---|
search_docs | Full-text search → file path, locator (p 42, slide 3, Sheet1!12, page 7), highlighted snippet |
list_docs | Indexed files with block counts |
index_folder | Build / refresh the index (incremental) |
The protocol is a hand-written JSON-RPC over stdio — no MCP SDK dependency.
docx / pptx → zipfile + lxml, read the XML directly
xlsx → openpyxl (read_only)
pdf → pypdf (optional)
txt / md → line chunks, line numbers kept
trigram tokenizer: substring matching for both CJK and Latin text, no word segmenter required, ranked by bm25().(size, mtime) first, hash with SHA-1 only when they differ.Benchmark on a real engineering corpus:
| Metric | Value |
|---|---|
| Files | 43 (docx / pptx / xlsx / md, incl. an 8.6 MB deck) |
| Text blocks | 2,260 |
| First index | 2.16 s |
| Database | 1.9 MiB |
MIT
This listing does not have a supported local package template. Use the maintainer’s documentation for its hosted endpoint, authentication, and client-specific setup. No install command has been inferred.
https://github.com/Asgoresmilelong/officegrep/releases/download/v0.1.3/officegrep-0.1.3.mcpbotherofficegrep works with any MCP-compatible client. Copy the config snippet from the Configuration section above and add it to the file shown for your client, then restart the application.
~/Library/Application Support/Claude/claude_desktop_config.jsonRestart Claude Desktop completely for changes to take effect.~/.cursor/mcp.jsonRestart Cursor for changes to take effect..vscode/mcp.jsonReload VS Code window for changes to take effect.~/.codeium/windsurf/mcp_config.jsonRestart Windsurf for changes to take effect..mcp.jsonSave at the project root, then start Claude Code in that project and review the MCP server approval prompt. Keep real credentials out of shared files.