loading…
Search for a command to run...
loading…
A local RAG-powered documentation search system that uses vector embeddings and Qdrant to enable semantic search across markdown, HTML, and other file formats.
A local RAG-powered documentation search system that uses vector embeddings and Qdrant to enable semantic search across markdown, HTML, and other file formats. It provides an MCP interface for AI tools like Cursor to intelligently query and retrieve information from local knowledge bases.
A production-ready RAG (Retrieval-Augmented Generation) system that enables semantic search across local documentation using vector embeddings and similarity search. Built with TypeScript, this tool demonstrates modern AI integration patterns including vector databases, embedding generation, and MCP (Model Context Protocol) tooling.
Perfect for: Engineering teams needing intelligent documentation search, knowledge bases, or RAG system implementations.
local_lense is a RAG (Retrieval-Augmented Generation) powered documentation search tool that:
local_lense uses a RAG (Retrieval-Augmented Generation) architecture:
Indexing Phase:
Search Phase:
Refresh Mechanism:
MCP Integration (Future):
git clone <repository-url>
cd local_lense
npm install
docker-compose up -d
This starts a Qdrant container on localhost:6333. The data persists in a Docker volume.
Edit configs.json:
{
"sourcePath": "~/Documents/my-docs",
"searchResultLimit": 3
}
sourcePath: Path to your documentation directory (supports ~ for home directory)searchResultLimit: Maximum number of search results to returnnpm run build
Currently, the tool runs as a test script. Edit src/main.ts to configure your search query, then:
npm run dev
The main user configuration file located in the project root:
sourcePath (string, required): Path to your documentation directory
~ (tilde) for home directory expansion"/Users/username/Documents/my-docs" instead of "~/Documents/my-docs"searchResultLimit (number, optional): Maximum number of results per search
3keywordBoost (boolean, optional): Enable keyword-based score boosting to improve relevance with local embedding models
truekeywordBoostWeight (number, optional): Controls the strength of keyword boosting (0.0 to 1.0)
0.2 (20% boost weight)Note: Collection management is handled automatically by the system. The system uses a single "docs" collection that is always dropped and re-indexed on initialization.
The docker-compose.yaml file configures Qdrant:
6333 (Qdrant HTTP API)qdrant_storageThe default FileSourceProcessor (see src/ragIndexer/implementations/fileSourceProcessor.ts) supports the following file types:
.md, .markdown.html, .htm.json.yaml, .yml.txt, .textFiles with unsupported extensions are processed as ContentType.OTHER. While they will be indexed, the content may not be optimally formatted for search.
The processor recursively scans directories and automatically detects file types based on their extensions. All supported files are read as UTF-8 text.
local_lense uses a pluggable source processor architecture. While the default implementation processes local files, you can implement custom source processors to index content from other sources.
To create a custom source processor, implement the ISourceProcessor interface (see src/ragIndexer/types.ts):
import { ISourceProcessor, SourceItem } from './types';
export class MyCustomProcessor implements ISourceProcessor {
public get sourceItems(): ReadonlyArray<SourceItem> {
// Return processed source items
}
public process(): ReadonlyArray<SourceItem> {
// Fetch and process content from your source
// Return array of SourceItem objects with:
// - sourceLocation: identifier (file path, URL, etc.)
// - contentType: ContentType enum value
// - content: the actual content string
}
}
See src/ragIndexer/types.ts for the complete interface definition and type definitions.
Prerequisites: Before using local_lense in Cursor, ensure Docker is running and Qdrant is started:
# In your local_lense directory
docker-compose up -d
This starts the Qdrant vector database on localhost:6333, which the MCP tool requires.
Configuration: Add local_lense to your Cursor MCP server settings:
{
"mcpServers": {
"local_lense": {
"command": "node",
"args": ["/full/path/to/your/local_lense/build/index.js"],
"env": {}
}
}
}
Important Notes:
build/index.js in the args fieldWhen documentation is indexed from paths OUTSIDE Cursor's working directory:
/Users/name/Documents/my-docs, /Users/name/notes, separate directory from codebaseWhen documentation is indexed from paths WITHIN Cursor's working directory:
grep instead of the MCP toolconfigs.json (see Configuration section above)┌─────────────────────────────────────────────────────────┐
│ RAG Pipeline │
└─────────────────────────────────────────────────────────┘
Indexing Flow:
┌──────────────┐ ┌──────────────┐ ┌──────────────┐
│ Documents │ --> │ Chunking │ --> │ Embeddings │
│ (MD/HTML) │ │ Strategy │ │ Generation │
└──────────────┘ └──────────────┘ └──────┬───────┘
│
▼
┌──────────────┐
│ Qdrant │
│ Vector Store │
└──────┬───────┘
│
Search Flow: │
┌──────────────┐ ┌──────────────┐ │
│ User Query │ --> │ Embed │ ----------┘
│ (Natural Lang)│ │ Query │
└──────────────┘ └──────────────┘
│
▼
┌──────────────┐
│ Similarity │
│ Search │
└──────┬───────┘
│
▼
┌──────────────┐
│ Ranked │
│ Results │
└──────────────┘
docker psdocker-compose pscurl http://localhost:6333/healthsourcePath in configs.json exists (see Configuration section for path requirements)await ragIndexer.init() in main.tsnpm installnode --version (should be v18+)rm -rf build && npm run buildlocal-lense becomes local)local_lense instead of local-lense)local_lense/
├── src/
│ ├── main.ts # Entry point (test script)
│ ├── services/ # Core services
│ │ ├── configService.ts # Configuration management
│ │ └── embedService.ts # Embedding generation
│ ├── ragIndexer/ # Indexing logic
│ │ ├── ragIndexer.ts
│ │ └── implementations/
│ │ └── fileSourceProcessor.ts
│ └── ragSearch/ # Search logic
│ ├── ragSearch.ts
│ └── implementations/
│ ├── qdrantVectorSearchService.ts
│ ├── qdrantVectorCollectionService.ts
│ └── qdrantVectorStorageService.ts
├── configs.json # Configuration file
├── docker-compose.yaml # Qdrant setup
└── package.json
npm run build
Output goes to build/ directory.
npm run dev
Uses tsx to run TypeScript directly without building.
ISC
Добавь это в claude_desktop_config.json и перезапусти Claude Desktop.
{
"mcpServers": {
"local-lense": {
"command": "npx",
"args": []
}
}
}