
momokun7/xgrep
Developer toolsこのページは AI により自動翻訳されています。技術的な詳細は原文をご確認ください。 原文を見る
Ultra-fast indexed code search engine — faster than ripgrep on repeated searches, lighter than zoekt. Built-in MCP server for AI agents. Also does fast file finding (fd/find alternative).
概要
Ultra-fast indexed code search engine with MCP server for AI coding tools. Pre-builds a trigram inverted index, then searches in milliseconds. Designed for repeated searches on large codebases — by humans and AI agents alike. - — trigram inverted index makes repeated searches 2-46x faster than ripgrep - — --find mode locates files 2-15x faster than fd - — built-in Model Context Protocol server for AI coding tools (Claude Code, Cursor, etc.) - — --format llm produces Markdown with language tags, context lines, and token-aware truncation - — search only changed files (--changed), recent commits (--since 1h), respects .gitignore - — install via cargo/npm/pip, then xg "pattern". Index builds automatically on first search - — files edited since the last index build are rescanned on every search; on Linux, xg serve watches the tree so this check costs ~0.
README
以下は原文 README の抜粋です。原文を見る。
xgrep
Ultra-fast indexed code search engine with MCP server for AI coding tools.
Pre-builds a trigram inverted index, then searches in milliseconds. Designed for repeated searches on large codebases — by humans and AI agents alike.
Features
- Indexed search — trigram inverted index makes repeated searches 2-46x faster than ripgrep
- File discovery —
--findmode locates files 2-15x faster than fd - MCP server — built-in Model Context Protocol server for AI coding tools (Claude Code, Cursor, etc.)
- LLM-optimized output —
--format llmproduces Markdown with language tags, context lines, and token-aware truncation - Git-aware — search only changed files (
--changed), recent commits (--since 1h), respects.gitignore - Zero config — install via cargo/npm/pip, then
xg "pattern". Index builds automatically on first search - Always fresh — files edited since the last index build are rescanned on every search; on Linux,
xg servewatches the tree so this check costs ~0.1ms - Syntax-aware — tree-sitter outlines (
--outline), enclosing-block results (--expand block), definitions, references and a repo map for Rust, Python, JS/TS, Go, Java, C/C++ and Ruby - Boolean and history search — file-level
--and/--not, search insidegit diff(--in-diff) or commit messages (--log)
Why xgrep?
| ripgrep | zoekt | xgrep | |
|---|---|---|---|
| Setup | None | Server required | None (cargo/npm/pip) |
| First search | Instant | After server start | Auto-builds index |
| Repeated search (Linux kernel) | 1,687ms | 170ms (server) | 37ms |
| File discovery (next.js, 26K files) | N/A | N/A | 9ms (fd: 191ms) |
| Index size | N/A | 155% of source | ~13% of source (+6% build-only sidecar) |
| AI agent integration | None | None | MCP server built-in |
xgrep is not a ripgrep replacement. Use ripgrep for one-off searches. Use xgrep when you search the same codebase repeatedly — the index pays for itself after ~2 searches.
Installation
Choose your package manager:
# Rust (recommended — native binary, no runtime)
cargo install xgrep-search # Requires Rust 1.85+
# npm (Node.js 18+)
npm install -g xgrep
# pip (Python 3.8+)
pip install xgrep-search
Prebuilt binaries are also available on the Releases page.
インストール
This server does not publish a one-line install command.
Open the repository installation guide MCP 初心者?mcpskill.org のガイドから始めましょう →設定
{
"mcpServers": {
"xgrep": {
"command": "xg",
"args": ["serve"]
}
}
}