知识检索工具 是 AI Skill Hub 本期精选MCP工具之一。综合评分 8.0 分,整体质量较高。我们强烈推荐将其纳入你的 AI 工具库,帮助提升工作效率。
知识检索工具 是一款遵循 MCP(Model Context Protocol)标准协议的 AI 工具扩展。通过 MCP 协议,它可以让 Claude、Cursor 等主流 AI 客户端直接访问和操作外部工具、数据源和服务,实现 AI 能力的无缝扩展。无论是文件操作、数据库查询还是 API 调用,都可以通过自然语言在 AI 对话中直接触发,极大提升生产效率。
知识检索工具 是一款遵循 MCP(Model Context Protocol)标准协议的 AI 工具扩展。通过 MCP 协议,它可以让 Claude、Cursor 等主流 AI 客户端直接访问和操作外部工具、数据源和服务,实现 AI 能力的无缝扩展。无论是文件操作、数据库查询还是 API 调用,都可以通过自然语言在 AI 对话中直接触发,极大提升生产效率。
# 方式一:通过 Claude Code CLI 一键安装
claude skill install https://github.com/lyonzin/knowledge-rag
# 方式二:手动配置 claude_desktop_config.json
{
"mcpServers": {
"------": {
"command": "npx",
"args": ["-y", "knowledge-rag"]
}
}
}
# 配置文件位置
# macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
# Windows: %APPDATA%/Claude/claude_desktop_config.json
# 安装后在 Claude 对话中直接使用 # 示例: 用户: 请帮我用 知识检索工具 执行以下任务... Claude: [自动调用 知识检索工具 MCP 工具处理请求] # 查看可用工具列表 # 在 Claude 中输入:"列出所有可用的 MCP 工具"
// claude_desktop_config.json 配置示例
{
"mcpServers": {
"______": {
"command": "npx",
"args": ["-y", "knowledge-rag"],
"env": {
// "API_KEY": "your-api-key-here"
}
}
}
}
// 保存后重启 Claude Desktop 生效
gpu: false), BASE_DIR resolution fix for editable installs<3.13 upper bound — 3.13 and 3.14 now supportedSee Changelog for full history.
---
| Feature | Description |
|---|---|
| **Hybrid Search** | Semantic + BM25 keyword search with Reciprocal Rank Fusion |
| **Cross-Encoder Reranker** | Xenova/ms-marco-MiniLM-L-6-v2 re-scores top candidates for precision |
| **GPU Acceleration** | Optional ONNX CUDA support for 5-10x faster indexing |
| **YAML Configuration** | Fully customizable via config.yaml with domain-specific presets |
| **Query Expansion** | Configurable synonym mappings (69 security-term defaults) |
| **Markdown-Aware Chunking** | .md files split by ##/### sections instead of fixed windows |
| **In-Process Embeddings** | FastEmbed ONNX Runtime (BAAI/bge-small-en-v1.5, 384D) |
| **Keyword Routing** | Word-boundary aware routing for domain-specific queries |
| **20 Format Parsers** | MD, TXT, PDF, PY, C, H, CPP, JS, JSX, TS, TSX, JSON, XML, CSV, DOCX, XLSX, PPTX, IPYNB + opt-in MQH/MQ4 |
| **Category Organization** | Organize docs by folder, auto-tagged by path |
| **Incremental Indexing** | Change detection via mtime/size — only re-indexes modified files |
| **Chunk Deduplication** | SHA256 content hashing prevents duplicate chunks |
| **Query Cache** | LRU cache with 5-min TTL for instant repeat queries |
| **Document CRUD** | Add, update, remove documents via MCP tools |
| **URL Ingestion** | Fetch URLs, strip HTML, convert to markdown, index |
| **Similarity Search** | Find documents similar to a reference document |
| **Retrieval Evaluation** | Built-in MRR@5 and Recall@5 metrics |
| **File Watcher** | Auto-reindex on document changes via watchdog (5s debounce) |
| **Exclude Patterns** | Glob-based file/directory exclusion during indexing |
| **MMR Diversification** | Maximal Marginal Relevance reduces redundant results |
| **Persistent Model Cache** | Embedding models cached in models_cache/ — survives reboots |
| **Auto-Migration** | Detects embedding dimension mismatch and rebuilds automatically |
| **12 MCP Tools** | Full CRUD + search + evaluation via Claude Code |
---
pip install knowledge-rag[gpu] + models.embedding.gpu: true in config)npx -y knowledge-rag # NPM — zero setup, auto-manages Python venv
pip install knowledge-rag # PyPI — classic Python install
curl -fsSL .../install.sh | bash # One-line installer (Linux/macOS/Windows)
docker pull ghcr.io/lyonzin/knowledge-rag # Docker — models pre-downloaded
git clone ... && pip install -r ... # From source
All methods produce the same MCP server. See Installation for full instructions.
Pick one — all produce the same running server.
Requires Node.js 16+. Handles Python venv, pip install, and version upgrades automatically.
claude mcp add knowledge-rag -s user -- npx -y knowledge-rag
That's it. On first run, npx creates a venv at ~/.knowledge-rag/, installs the PyPI package, and starts the MCP server. Subsequent runs reuse the cached venv.
```bash
reindex_documents(force=True)
reindex_documents(full_rebuild=True) ```
```
```bash
With ~200 documents, expect ~300-500MB RAM. The embedding model (~200MB ONNX runtime resident, lazy-loaded on first query since v3.8.0) and reranker (~25MB, lazy-loaded) are loaded into memory only when actually used. For very large knowledge bases (1000+ documents), consider enabling GPU acceleration and using exclude patterns to limit index scope.
Knowledge RAG is fully configurable via a config.yaml file in the project root. If no config.yaml exists, sensible defaults are used — the system works out of the box with zero configuration.
cp presets/cybersecurity.yaml config.yaml # Offensive/defensive security, CTFs cp presets/developer.yaml config.yaml # Software engineering, APIs, DevOps cp presets/research.yaml config.yaml # Academic research, papers, studies cp presets/general.yaml config.yaml # Blank slate, pure semantic search
cp config.example.yaml config.yaml
```
Restart Claude Code after changing config.yaml.
```yaml
| Field | Default | Description |
|---|---|---|
paths.documents_dir | ./documents | Root folder scanned recursively for documents |
paths.data_dir | ./data | Internal storage for ChromaDB and index metadata |
paths.models_cache_dir | ./models_cache | Persistent cache for embedding models (~250MB). Survives reboots |
Relative paths resolve from the project root. Absolute paths work too.
| Field | Default | Description |
|---|---|---|
documents.supported_formats | .md .txt .pdf .py .json .docx .xlsx .pptx .csv .ipynb | File extensions to index |
documents.exclude_patterns | [] (empty) | Glob patterns for files/dirs to skip during indexing |
documents.chunking.chunk_size | 1000 | Max characters per chunk |
documents.chunking.chunk_overlap | 200 | Characters shared between consecutive chunks |
Chunking guidelines: Short notes → 500/100. General use → 1000/200. Long technical docs → 1500/300.
For .md files, chunking splits at ## and ### header boundaries first. Sections larger than chunk_size are sub-chunked with overlap. Non-markdown files use fixed-size chunking.
| Field | Default | Description |
|---|---|---|
models.embedding.model | BAAI/bge-small-en-v1.5 | Embedding model (ONNX, runs locally) |
models.embedding.dimensions | 384 | Vector dimensions (must match model) |
models.embedding.gpu | false | Enable CUDA GPU acceleration. Requires pip install knowledge-rag[gpu] |
models.reranker.enabled | true | Enable cross-encoder reranking |
models.reranker.model | Xenova/ms-marco-MiniLM-L-6-v2 | Reranker model |
models.reranker.top_k_multiplier | 3 | Fetch N*multiplier candidates for reranking |
If the reranker model is not available locally and the machine cannot download it, search now falls back to the RRF order from hybrid semantic+BM25 retrieval. This keeps search_knowledge available offline, but result ordering may be less precise for ambiguous queries until the reranker model is cached.
Embedding model options (fastest → most accurate): - BAAI/bge-small-en-v1.5 — 384D, ~33MB (default) - BAAI/bge-base-en-v1.5 — 768D, ~130MB - BAAI/bge-large-en-v1.5 — 1024D, ~335MB - intfloat/multilingual-e5-small — 384D, 100+ languages
Warning: Changing the embedding model after indexing requires reindex_documents(full_rebuild=True).
| Field | Default | Description |
|---|---|---|
search.default_results | 5 | Results returned when no limit specified |
search.max_results | 20 | Hard cap even if client requests more |
search.collection_name | knowledge_base | ChromaDB collection — change for separate KBs |
Map folder paths to category names. Documents in matching folders get auto-tagged, enabling filtered searches.
category_mappings:
"security/redteam": "redteam"
"security": "security"
Set category_mappings: {} to disable — documents are still searchable, just without category filters.
Route queries to categories based on keywords. When a query contains listed keywords, results from that category are prioritized (not filtered — other categories still appear, ranked lower).
keyword_routes:
redteam:
- pentest
- exploit
- sqli
Single-word keywords use regex word boundaries (\b) — "api" won't match "RAPID". Multi-word keywords use substring matching.
Set keyword_routes: {} for pure semantic search.
Expand search terms with synonyms before BM25 search. Supports single tokens, bigrams, and full query matches.
query_expansions:
sqli:
- sql injection
- sqli
k8s:
- kubernetes
- k8s
Set query_expansions: {} for no expansion.
models: embedding: model: "BAAI/bge-small-en-v1.5" # ONNX, ~33MB, auto-downloaded dimensions: 384 gpu: false # Set true + pip install knowledge-rag[gpu] reranker: enabled: true # Falls back to RRF if model is unavailable model: "Xenova/ms-marco-MiniLM-L-6-v2" top_k_multiplier: 3 # Candidates fetched before reranking
高质量的开源MCP工具,支持多种格式解析
AI Skill Hub 为第三方内容聚合平台,本页面信息基于公开数据整理,不对工具功能和质量作任何法律背书。
建议在沙箱或测试环境中充分验证后,再部署至生产环境,并做好必要的安全评估。
✅ MIT 协议 — 最宽松的开源协议之一,可自由商用、修改、分发,仅需保留版权声明。
经综合评估,知识检索工具 在MCP工具赛道中表现稳健,质量优秀。如果你已有明确的使用需求,可以直接上手体验;如果还在评估阶段,建议对比同类工具后再做决策。
| 原始名称 | knowledge-rag |
| 原始描述 | 开源MCP工具:Drop docs, search instantly from Claude Code — 12 MCP tools, 20 format parsers, 。⭐84 · Python |
| Topics | mcpbm25chromadbclaudedocument-search |
| GitHub | https://github.com/lyonzin/knowledge-rag |
| License | MIT |
| 语言 | Python |
收录时间:2026-05-25 · 更新时间:2026-05-26 · License:MIT · AI Skill Hub 不对第三方内容的准确性作法律背书。
选择 Agent 类型,复制安装指令后粘贴到对应客户端