embedocs-mcp
Version:
Transform any GitHub repository into searchable vector embeddings. MCP server with smart indexing, voyage-context-3 embeddings, and semantic search for Claude/Cursor IDEs.
82 lines • 2.87 kB
TypeScript
/**
* SINGLE Search Service - Implements MongoDB Atlas Vector Search + Hybrid Search
* Based on official MongoDB documentation
* @see https://github.com/mongodb/mongo/blob/master/src/mongo/db/pipeline/document_source_rank_fusion.h
*/
export interface SearchResult {
documentId: string;
content: string;
score: number;
title?: string;
product?: string;
metadata?: Record<string, any>;
}
export declare class SearchService {
private static instance;
private embeddingService;
private storageService;
private voyageApiKey;
private constructor();
static getInstance(): SearchService;
/**
* Hybrid Search using Reciprocal Rank Fusion (RRF) algorithm
* NOTE: We implement RRF manually since $rankFusion is not yet available in MongoDB 8.0
* This follows the same algorithm that MongoDB will use when $rankFusion becomes available
* @see https://github.com/JohnGUnderwood/atlas-hybrid-search for reference implementation
*/
hybridSearch(query: string, limit?: number): Promise<SearchResult[]>;
/**
* Pure Vector Search using MongoDB Atlas $vectorSearch
* @see https://github.com/mongodb/laravel-mongodb/blob/master/src/Query/Builder.php
*/
vectorSearch(query: string, limit?: number): Promise<SearchResult[]>;
/**
* MMR Vector Search - Maximum Marginal Relevance
* Balances relevance and diversity for superior results
* Based on Harry-231's approach: +21.2% retrieval accuracy improvement
*
* @param query - Search query string
* @param options - MMR configuration options
*/
mmrVectorSearch(query: string, options?: {
limit?: number;
fetchK?: number;
lambdaMult?: number;
filter?: any;
}): Promise<SearchResult[]>;
/**
* Reciprocal Rank Fusion (RRF) - Standard hybrid search algorithm
* Implements the same algorithm that MongoDB $rankFusion will use (not yet available in 8.0)
* Formula: score = Σ(weight / (k + rank_i))
* k=60 is the standard constant from RRF research papers
*/
private reciprocalRankFusion;
/**
* Rerank results using Voyage AI Reranker
* Using latest rerank-2.5 model (2025)
* @see voyage-ai documentation
*/
private rerankResults;
/**
* Get search statistics
*/
getStats(): Promise<{
embeddingConfig: {
model: "voyage-context-3";
dimensions: 1024;
maxBatchSize: 8;
};
searchConfig: {
reranker: "rerank-2.5";
minVectorScore: 0.7;
vectorWeight: 0.6;
keywordWeight: 0.4;
mmr: {
readonly fetchK: 20;
readonly lambdaMult: 0.7;
readonly defaultLimit: 5;
};
};
}>;
}
//# sourceMappingURL=search.d.ts.map