@mhalder/qdrant-mcp-server 3.1.1 → 3.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +16 -0
- package/CONTRIBUTING.md +28 -130
- package/README.md +51 -30
- package/build/code/indexer.d.ts.map +1 -1
- package/build/code/indexer.js +37 -27
- package/build/code/indexer.js.map +1 -1
- package/build/tools/federated.d.ts +96 -0
- package/build/tools/federated.d.ts.map +1 -0
- package/build/tools/federated.js +375 -0
- package/build/tools/federated.js.map +1 -0
- package/build/tools/federated.test.d.ts +2 -0
- package/build/tools/federated.test.d.ts.map +1 -0
- package/build/tools/federated.test.js +592 -0
- package/build/tools/federated.test.js.map +1 -0
- package/build/tools/index.d.ts.map +1 -1
- package/build/tools/index.js +5 -0
- package/build/tools/index.js.map +1 -1
- package/build/tools/schemas.d.ts +13 -0
- package/build/tools/schemas.d.ts.map +1 -1
- package/build/tools/schemas.js +35 -0
- package/build/tools/schemas.js.map +1 -1
- package/examples/README.md +32 -0
- package/examples/advanced-search/README.md +348 -0
- package/package.json +3 -1
- package/prompts.example.json +102 -0
- package/src/code/indexer.ts +42 -29
- package/src/tools/federated.test.ts +752 -0
- package/src/tools/federated.ts +569 -0
- package/src/tools/index.ts +6 -0
- package/src/tools/schemas.ts +39 -0
- package/tests/code/indexer.test.ts +60 -0
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Federated and contextual search tools registration
|
|
3
|
+
*
|
|
4
|
+
* Provides advanced search capabilities:
|
|
5
|
+
* - contextual_search: Combined git + code search for a single repository
|
|
6
|
+
* - federated_search: Search across multiple indexed repositories
|
|
7
|
+
*/
|
|
8
|
+
import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
9
|
+
import type { CodeIndexer } from "../code/indexer.js";
|
|
10
|
+
import type { CodeSearchResult } from "../code/types.js";
|
|
11
|
+
import type { GitHistoryIndexer } from "../git/indexer.js";
|
|
12
|
+
import type { GitSearchResult } from "../git/types.js";
|
|
13
|
+
export interface FederatedToolDependencies {
|
|
14
|
+
codeIndexer: CodeIndexer;
|
|
15
|
+
gitHistoryIndexer: GitHistoryIndexer;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Links a code chunk to commits that modified the file
|
|
19
|
+
*/
|
|
20
|
+
export interface CodeCommitCorrelation {
|
|
21
|
+
codeResult: CodeSearchResult;
|
|
22
|
+
relatedCommits: Array<{
|
|
23
|
+
shortHash: string;
|
|
24
|
+
subject: string;
|
|
25
|
+
author: string;
|
|
26
|
+
date: string;
|
|
27
|
+
}>;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Combined code + git search results with correlations
|
|
31
|
+
*/
|
|
32
|
+
export interface ContextualSearchResult {
|
|
33
|
+
codeResults: CodeSearchResult[];
|
|
34
|
+
gitResults: GitSearchResult[];
|
|
35
|
+
correlations: CodeCommitCorrelation[];
|
|
36
|
+
metadata: {
|
|
37
|
+
path: string;
|
|
38
|
+
query: string;
|
|
39
|
+
codeResultCount: number;
|
|
40
|
+
gitResultCount: number;
|
|
41
|
+
correlationCount: number;
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Result with repository attribution
|
|
46
|
+
*/
|
|
47
|
+
export type FederatedResult = (CodeSearchResult & {
|
|
48
|
+
resultType: "code";
|
|
49
|
+
repoPath: string;
|
|
50
|
+
}) | (GitSearchResult & {
|
|
51
|
+
resultType: "git";
|
|
52
|
+
repoPath: string;
|
|
53
|
+
});
|
|
54
|
+
/**
|
|
55
|
+
* Federated search response with results and metadata
|
|
56
|
+
*/
|
|
57
|
+
export interface FederatedSearchResponse {
|
|
58
|
+
results: FederatedResult[];
|
|
59
|
+
metadata: {
|
|
60
|
+
query: string;
|
|
61
|
+
searchType: "code" | "git" | "both";
|
|
62
|
+
repositoriesSearched: string[];
|
|
63
|
+
totalResults: number;
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Build correlations between code results and git history
|
|
68
|
+
* Links code chunks to commits that modified the same file
|
|
69
|
+
*/
|
|
70
|
+
export declare function buildCorrelations(codeResults: CodeSearchResult[], gitResults: GitSearchResult[]): CodeCommitCorrelation[];
|
|
71
|
+
/**
|
|
72
|
+
* Check if two paths refer to the same file by comparing path segments from the end.
|
|
73
|
+
* This handles relative vs absolute paths while avoiding false positives.
|
|
74
|
+
*
|
|
75
|
+
* Examples:
|
|
76
|
+
* - "app/models/user.ts" vs "models/user.ts" → true (suffix match)
|
|
77
|
+
* - "app/models/user.ts" vs "lib/user.ts" → false (different parent dir)
|
|
78
|
+
* - "src/user.ts" vs "user.ts" → true (suffix match)
|
|
79
|
+
*/
|
|
80
|
+
export declare function pathsMatch(path1: string, path2: string): boolean;
|
|
81
|
+
/**
|
|
82
|
+
* Normalize scores to [0, 1] range using min-max normalization
|
|
83
|
+
*/
|
|
84
|
+
export declare function normalizeScores<T extends {
|
|
85
|
+
score: number;
|
|
86
|
+
}>(results: T[]): T[];
|
|
87
|
+
/**
|
|
88
|
+
* Calculate Reciprocal Rank Fusion score
|
|
89
|
+
* RRF formula: sum(1 / (k + rank)) where k=60 prevents high ranks from dominating
|
|
90
|
+
*/
|
|
91
|
+
export declare function calculateRRFScore(ranks: number[]): number;
|
|
92
|
+
/**
|
|
93
|
+
* Register federated search tools on the MCP server
|
|
94
|
+
*/
|
|
95
|
+
export declare function registerFederatedTools(server: McpServer, deps: FederatedToolDependencies): void;
|
|
96
|
+
//# sourceMappingURL=federated.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"federated.d.ts","sourceRoot":"","sources":["../../src/tools/federated.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACzE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,KAAK,EAA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,GAAG,MAAM,CAAC;QACpC,oBAAoB,EAAE,MAAM,EAAE,CAAC;QAC/B,YAAY,EAAE,MAAM,CAAC;KACtB,CAAC;CACH;AAMD;;;GAGG;AACH,wBAAgB,iBAAiB,CAC/B,WAAW,EAAE,gBAAgB,EAAE,EAC/B,UAAU,EAAE,eAAe,EAAE,GAC5B,qBAAqB,EAAE,CAgCzB;AASD;;;;;;;;GAQG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAgBhE;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,CAAC,SAAS;IAAE,KAAK,EAAE,MAAM,CAAA;CAAE,EACzD,OAAO,EAAE,CAAC,EAAE,GACX,CAAC,EAAE,CAiBL;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,MAAM,CAGzD;AAmND;;GAEG;AACH,wBAAgB,sBAAsB,CACpC,MAAM,EAAE,SAAS,EACjB,IAAI,EAAE,yBAAyB,GAC9B,IAAI,CAwKN"}
|
|
@@ -0,0 +1,375 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Federated and contextual search tools registration
|
|
3
|
+
*
|
|
4
|
+
* Provides advanced search capabilities:
|
|
5
|
+
* - contextual_search: Combined git + code search for a single repository
|
|
6
|
+
* - federated_search: Search across multiple indexed repositories
|
|
7
|
+
*/
|
|
8
|
+
import * as schemas from "./schemas.js";
|
|
9
|
+
// ============================================================================
|
|
10
|
+
// Helper Functions
|
|
11
|
+
// ============================================================================
|
|
12
|
+
/**
|
|
13
|
+
* Build correlations between code results and git history
|
|
14
|
+
* Links code chunks to commits that modified the same file
|
|
15
|
+
*/
|
|
16
|
+
export function buildCorrelations(codeResults, gitResults) {
|
|
17
|
+
const correlations = [];
|
|
18
|
+
for (const codeResult of codeResults) {
|
|
19
|
+
const relatedCommits = [];
|
|
20
|
+
// Find commits that modified this file
|
|
21
|
+
for (const gitResult of gitResults) {
|
|
22
|
+
// Check if any file in the commit matches the code result's file path
|
|
23
|
+
const matchesFile = gitResult.files.some((file) => pathsMatch(codeResult.filePath, file));
|
|
24
|
+
if (matchesFile) {
|
|
25
|
+
relatedCommits.push({
|
|
26
|
+
shortHash: gitResult.shortHash,
|
|
27
|
+
subject: gitResult.subject,
|
|
28
|
+
author: gitResult.author,
|
|
29
|
+
date: gitResult.date,
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
if (relatedCommits.length > 0) {
|
|
34
|
+
correlations.push({
|
|
35
|
+
codeResult,
|
|
36
|
+
relatedCommits,
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
return correlations;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Normalize a file path for comparison
|
|
44
|
+
*/
|
|
45
|
+
function normalizePath(path) {
|
|
46
|
+
return path.replace(/\\/g, "/").toLowerCase();
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Check if two paths refer to the same file by comparing path segments from the end.
|
|
50
|
+
* This handles relative vs absolute paths while avoiding false positives.
|
|
51
|
+
*
|
|
52
|
+
* Examples:
|
|
53
|
+
* - "app/models/user.ts" vs "models/user.ts" → true (suffix match)
|
|
54
|
+
* - "app/models/user.ts" vs "lib/user.ts" → false (different parent dir)
|
|
55
|
+
* - "src/user.ts" vs "user.ts" → true (suffix match)
|
|
56
|
+
*/
|
|
57
|
+
export function pathsMatch(path1, path2) {
|
|
58
|
+
const segments1 = normalizePath(path1).split("/").filter(Boolean);
|
|
59
|
+
const segments2 = normalizePath(path2).split("/").filter(Boolean);
|
|
60
|
+
// Compare from the end - shorter path must be a suffix of longer path
|
|
61
|
+
const shorter = segments1.length <= segments2.length ? segments1 : segments2;
|
|
62
|
+
const longer = segments1.length <= segments2.length ? segments2 : segments1;
|
|
63
|
+
const offset = longer.length - shorter.length;
|
|
64
|
+
for (let i = 0; i < shorter.length; i++) {
|
|
65
|
+
if (shorter[i] !== longer[offset + i]) {
|
|
66
|
+
return false;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
return shorter.length > 0;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Normalize scores to [0, 1] range using min-max normalization
|
|
73
|
+
*/
|
|
74
|
+
export function normalizeScores(results) {
|
|
75
|
+
if (results.length === 0)
|
|
76
|
+
return [];
|
|
77
|
+
if (results.length === 1)
|
|
78
|
+
return results.map((r) => ({ ...r, score: 1 }));
|
|
79
|
+
const scores = results.map((r) => r.score);
|
|
80
|
+
const minScore = Math.min(...scores);
|
|
81
|
+
const maxScore = Math.max(...scores);
|
|
82
|
+
// If all scores are identical, normalize to 1
|
|
83
|
+
if (maxScore === minScore) {
|
|
84
|
+
return results.map((r) => ({ ...r, score: 1 }));
|
|
85
|
+
}
|
|
86
|
+
return results.map((r) => ({
|
|
87
|
+
...r,
|
|
88
|
+
score: (r.score - minScore) / (maxScore - minScore),
|
|
89
|
+
}));
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Calculate Reciprocal Rank Fusion score
|
|
93
|
+
* RRF formula: sum(1 / (k + rank)) where k=60 prevents high ranks from dominating
|
|
94
|
+
*/
|
|
95
|
+
export function calculateRRFScore(ranks) {
|
|
96
|
+
const k = 60;
|
|
97
|
+
return ranks.reduce((sum, rank) => sum + 1 / (k + rank), 0);
|
|
98
|
+
}
|
|
99
|
+
// ============================================================================
|
|
100
|
+
// Tool Implementations
|
|
101
|
+
// ============================================================================
|
|
102
|
+
/**
|
|
103
|
+
* Perform contextual search across code and git history
|
|
104
|
+
*/
|
|
105
|
+
async function performContextualSearch(codeIndexer, gitHistoryIndexer, params) {
|
|
106
|
+
const { path, query, codeLimit = 5, gitLimit = 5, correlate = true } = params;
|
|
107
|
+
// Validate both indexes exist
|
|
108
|
+
const [codeStatus, gitStatus] = await Promise.all([
|
|
109
|
+
codeIndexer.getIndexStatus(path),
|
|
110
|
+
gitHistoryIndexer.getIndexStatus(path),
|
|
111
|
+
]);
|
|
112
|
+
if (codeStatus.status !== "indexed") {
|
|
113
|
+
throw new Error(`Code index not found for "${path}". Run index_codebase first.`);
|
|
114
|
+
}
|
|
115
|
+
if (gitStatus.status !== "indexed") {
|
|
116
|
+
throw new Error(`Git history index not found for "${path}". Run index_git_history first.`);
|
|
117
|
+
}
|
|
118
|
+
// Execute searches in parallel
|
|
119
|
+
const [codeResults, gitResults] = await Promise.all([
|
|
120
|
+
codeIndexer.searchCode(path, query, { limit: codeLimit }),
|
|
121
|
+
gitHistoryIndexer.searchHistory(path, query, { limit: gitLimit }),
|
|
122
|
+
]);
|
|
123
|
+
// Build correlations if requested
|
|
124
|
+
const correlations = correlate
|
|
125
|
+
? buildCorrelations(codeResults, gitResults)
|
|
126
|
+
: [];
|
|
127
|
+
return {
|
|
128
|
+
codeResults,
|
|
129
|
+
gitResults,
|
|
130
|
+
correlations,
|
|
131
|
+
metadata: {
|
|
132
|
+
path,
|
|
133
|
+
query,
|
|
134
|
+
codeResultCount: codeResults.length,
|
|
135
|
+
gitResultCount: gitResults.length,
|
|
136
|
+
correlationCount: correlations.length,
|
|
137
|
+
},
|
|
138
|
+
};
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* Perform federated search across multiple repositories
|
|
142
|
+
*/
|
|
143
|
+
async function performFederatedSearch(codeIndexer, gitHistoryIndexer, params) {
|
|
144
|
+
const { paths, query, searchType = "both", limit = 20 } = params;
|
|
145
|
+
// Fail-fast validation: check all paths are indexed
|
|
146
|
+
const validationPromises = paths.map(async (path) => {
|
|
147
|
+
const errors = [];
|
|
148
|
+
if (searchType === "code" || searchType === "both") {
|
|
149
|
+
const codeStatus = await codeIndexer.getIndexStatus(path);
|
|
150
|
+
if (codeStatus.status !== "indexed") {
|
|
151
|
+
errors.push(`Code index not found for "${path}"`);
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
if (searchType === "git" || searchType === "both") {
|
|
155
|
+
const gitStatus = await gitHistoryIndexer.getIndexStatus(path);
|
|
156
|
+
if (gitStatus.status !== "indexed") {
|
|
157
|
+
errors.push(`Git history index not found for "${path}"`);
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
return { path, errors };
|
|
161
|
+
});
|
|
162
|
+
const validationResults = await Promise.all(validationPromises);
|
|
163
|
+
const allErrors = validationResults.flatMap((v) => v.errors);
|
|
164
|
+
if (allErrors.length > 0) {
|
|
165
|
+
throw new Error(`Index validation failed:\n${allErrors.join("\n")}`);
|
|
166
|
+
}
|
|
167
|
+
// Parallel search across all repositories
|
|
168
|
+
const searchPromises = [];
|
|
169
|
+
for (const path of paths) {
|
|
170
|
+
if (searchType === "code" || searchType === "both") {
|
|
171
|
+
searchPromises.push(codeIndexer
|
|
172
|
+
.searchCode(path, query, { limit: Math.ceil(limit / paths.length) })
|
|
173
|
+
.then((results) => results.map((r) => ({
|
|
174
|
+
...r,
|
|
175
|
+
resultType: "code",
|
|
176
|
+
repoPath: path,
|
|
177
|
+
}))));
|
|
178
|
+
}
|
|
179
|
+
if (searchType === "git" || searchType === "both") {
|
|
180
|
+
searchPromises.push(gitHistoryIndexer
|
|
181
|
+
.searchHistory(path, query, {
|
|
182
|
+
limit: Math.ceil(limit / paths.length),
|
|
183
|
+
})
|
|
184
|
+
.then((results) => results.map((r) => ({
|
|
185
|
+
...r,
|
|
186
|
+
resultType: "git",
|
|
187
|
+
repoPath: path,
|
|
188
|
+
}))));
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
const searchResults = await Promise.all(searchPromises);
|
|
192
|
+
const allResults = searchResults.flat();
|
|
193
|
+
// Normalize scores per result type to ensure fair comparison
|
|
194
|
+
const codeResults = allResults.filter((r) => r.resultType === "code");
|
|
195
|
+
const gitResults = allResults.filter((r) => r.resultType === "git");
|
|
196
|
+
const normalizedCode = normalizeScores(codeResults);
|
|
197
|
+
const normalizedGit = normalizeScores(gitResults);
|
|
198
|
+
const normalizedResults = [...normalizedCode, ...normalizedGit];
|
|
199
|
+
// Apply RRF ranking
|
|
200
|
+
// Rank within each repo+type group for fair cross-repo interleaving
|
|
201
|
+
// This ensures top results from each repo get similar RRF scores
|
|
202
|
+
const groupedResults = new Map();
|
|
203
|
+
for (const result of normalizedResults) {
|
|
204
|
+
const key = `${result.repoPath}:${result.resultType}`;
|
|
205
|
+
if (!groupedResults.has(key)) {
|
|
206
|
+
groupedResults.set(key, []);
|
|
207
|
+
}
|
|
208
|
+
groupedResults.get(key).push(result);
|
|
209
|
+
}
|
|
210
|
+
// Sort each group by score and create rank lookup
|
|
211
|
+
const rankLookup = new Map();
|
|
212
|
+
for (const group of groupedResults.values()) {
|
|
213
|
+
group.sort((a, b) => b.score - a.score);
|
|
214
|
+
group.forEach((result, index) => {
|
|
215
|
+
rankLookup.set(result, index + 1);
|
|
216
|
+
});
|
|
217
|
+
}
|
|
218
|
+
// Calculate RRF scores based on per-repo ranks
|
|
219
|
+
const rankedResults = normalizedResults.map((result) => {
|
|
220
|
+
const rank = rankLookup.get(result) ?? 1;
|
|
221
|
+
return {
|
|
222
|
+
result,
|
|
223
|
+
rank,
|
|
224
|
+
rrfScore: calculateRRFScore([rank]),
|
|
225
|
+
};
|
|
226
|
+
});
|
|
227
|
+
// Sort by RRF score (higher is better)
|
|
228
|
+
rankedResults.sort((a, b) => b.rrfScore - a.rrfScore);
|
|
229
|
+
// Return top results up to limit
|
|
230
|
+
const topResults = rankedResults.slice(0, limit).map((r) => r.result);
|
|
231
|
+
return {
|
|
232
|
+
results: topResults,
|
|
233
|
+
metadata: {
|
|
234
|
+
query,
|
|
235
|
+
searchType,
|
|
236
|
+
repositoriesSearched: paths,
|
|
237
|
+
totalResults: topResults.length,
|
|
238
|
+
},
|
|
239
|
+
};
|
|
240
|
+
}
|
|
241
|
+
// ============================================================================
|
|
242
|
+
// Tool Registration
|
|
243
|
+
// ============================================================================
|
|
244
|
+
/**
|
|
245
|
+
* Register federated search tools on the MCP server
|
|
246
|
+
*/
|
|
247
|
+
export function registerFederatedTools(server, deps) {
|
|
248
|
+
const { codeIndexer, gitHistoryIndexer } = deps;
|
|
249
|
+
// contextual_search
|
|
250
|
+
server.registerTool("contextual_search", {
|
|
251
|
+
title: "Contextual Search",
|
|
252
|
+
description: "Combined semantic search across code and git history for a single repository. " +
|
|
253
|
+
"Returns code chunks, relevant commits, and correlations showing which commits " +
|
|
254
|
+
"modified which files. Useful for understanding code evolution and finding related changes.",
|
|
255
|
+
inputSchema: schemas.ContextualSearchSchema,
|
|
256
|
+
}, async ({ path, query, codeLimit, gitLimit, correlate }) => {
|
|
257
|
+
try {
|
|
258
|
+
const result = await performContextualSearch(codeIndexer, gitHistoryIndexer, { path, query, codeLimit, gitLimit, correlate });
|
|
259
|
+
// Format output
|
|
260
|
+
const sections = [];
|
|
261
|
+
// Code results section
|
|
262
|
+
if (result.codeResults.length > 0) {
|
|
263
|
+
sections.push("## Code Results\n");
|
|
264
|
+
result.codeResults.forEach((r, idx) => {
|
|
265
|
+
sections.push(`### ${idx + 1}. ${r.filePath}:${r.startLine}-${r.endLine} (score: ${r.score.toFixed(3)})\n` +
|
|
266
|
+
`Language: ${r.language}\n` +
|
|
267
|
+
"```" +
|
|
268
|
+
r.language +
|
|
269
|
+
"\n" +
|
|
270
|
+
r.content +
|
|
271
|
+
"\n```\n");
|
|
272
|
+
});
|
|
273
|
+
}
|
|
274
|
+
// Git results section
|
|
275
|
+
if (result.gitResults.length > 0) {
|
|
276
|
+
sections.push("\n## Git History Results\n");
|
|
277
|
+
result.gitResults.forEach((r, idx) => {
|
|
278
|
+
sections.push(`### ${idx + 1}. ${r.shortHash} - ${r.subject} (score: ${r.score.toFixed(3)})\n` +
|
|
279
|
+
`Author: ${r.author} | Date: ${r.date} | Type: ${r.commitType}\n` +
|
|
280
|
+
`Files: ${r.files.slice(0, 5).join(", ")}${r.files.length > 5 ? ` (+${r.files.length - 5} more)` : ""}\n`);
|
|
281
|
+
});
|
|
282
|
+
}
|
|
283
|
+
// Correlations section
|
|
284
|
+
if (result.correlations.length > 0) {
|
|
285
|
+
sections.push("\n## Correlations (Code ↔ Commits)\n");
|
|
286
|
+
result.correlations.forEach((c) => {
|
|
287
|
+
const commits = c.relatedCommits
|
|
288
|
+
.slice(0, 3)
|
|
289
|
+
.map((commit) => ` - ${commit.shortHash}: ${commit.subject}`)
|
|
290
|
+
.join("\n");
|
|
291
|
+
sections.push(`**${c.codeResult.filePath}:${c.codeResult.startLine}** modified by:\n${commits}\n`);
|
|
292
|
+
});
|
|
293
|
+
}
|
|
294
|
+
// Summary
|
|
295
|
+
const summary = `\n---\nFound ${result.metadata.codeResultCount} code result(s), ` +
|
|
296
|
+
`${result.metadata.gitResultCount} git result(s), ` +
|
|
297
|
+
`${result.metadata.correlationCount} correlation(s).`;
|
|
298
|
+
sections.push(summary);
|
|
299
|
+
return {
|
|
300
|
+
content: [{ type: "text", text: sections.join("\n") }],
|
|
301
|
+
};
|
|
302
|
+
}
|
|
303
|
+
catch (error) {
|
|
304
|
+
return {
|
|
305
|
+
content: [
|
|
306
|
+
{
|
|
307
|
+
type: "text",
|
|
308
|
+
text: `Error: ${error instanceof Error ? error.message : String(error)}`,
|
|
309
|
+
},
|
|
310
|
+
],
|
|
311
|
+
isError: true,
|
|
312
|
+
};
|
|
313
|
+
}
|
|
314
|
+
});
|
|
315
|
+
// federated_search
|
|
316
|
+
server.registerTool("federated_search", {
|
|
317
|
+
title: "Federated Search",
|
|
318
|
+
description: "Search across multiple indexed repositories simultaneously. " +
|
|
319
|
+
"Combines and ranks results using Reciprocal Rank Fusion (RRF) for fair cross-repository comparison. " +
|
|
320
|
+
"Supports code-only, git-only, or combined search modes.",
|
|
321
|
+
inputSchema: schemas.FederatedSearchSchema,
|
|
322
|
+
}, async ({ paths, query, searchType, limit }) => {
|
|
323
|
+
try {
|
|
324
|
+
const response = await performFederatedSearch(codeIndexer, gitHistoryIndexer, { paths, query, searchType, limit });
|
|
325
|
+
if (response.results.length === 0) {
|
|
326
|
+
return {
|
|
327
|
+
content: [
|
|
328
|
+
{
|
|
329
|
+
type: "text",
|
|
330
|
+
text: `No results found for query "${query}" across ${paths.length} repository(ies).`,
|
|
331
|
+
},
|
|
332
|
+
],
|
|
333
|
+
};
|
|
334
|
+
}
|
|
335
|
+
// Format results
|
|
336
|
+
const sections = [
|
|
337
|
+
`# Federated Search Results\n` +
|
|
338
|
+
`Query: "${query}" | Type: ${response.metadata.searchType} | ` +
|
|
339
|
+
`Repositories: ${response.metadata.repositoriesSearched.length}\n`,
|
|
340
|
+
];
|
|
341
|
+
response.results.forEach((r, idx) => {
|
|
342
|
+
if (r.resultType === "code") {
|
|
343
|
+
sections.push(`## ${idx + 1}. [CODE] ${r.filePath}:${r.startLine}-${r.endLine}\n` +
|
|
344
|
+
`Repository: ${r.repoPath} | Language: ${r.language} | Score: ${r.score.toFixed(3)}\n` +
|
|
345
|
+
"```" +
|
|
346
|
+
r.language +
|
|
347
|
+
"\n" +
|
|
348
|
+
r.content +
|
|
349
|
+
"\n```\n");
|
|
350
|
+
}
|
|
351
|
+
else {
|
|
352
|
+
sections.push(`## ${idx + 1}. [GIT] ${r.shortHash} - ${r.subject}\n` +
|
|
353
|
+
`Repository: ${r.repoPath} | Author: ${r.author} | Date: ${r.date} | Score: ${r.score.toFixed(3)}\n` +
|
|
354
|
+
`Type: ${r.commitType} | Files: ${r.files.slice(0, 3).join(", ")}${r.files.length > 3 ? ` (+${r.files.length - 3} more)` : ""}\n`);
|
|
355
|
+
}
|
|
356
|
+
});
|
|
357
|
+
sections.push(`\n---\nTotal: ${response.metadata.totalResults} result(s) from ${response.metadata.repositoriesSearched.length} repository(ies).`);
|
|
358
|
+
return {
|
|
359
|
+
content: [{ type: "text", text: sections.join("\n") }],
|
|
360
|
+
};
|
|
361
|
+
}
|
|
362
|
+
catch (error) {
|
|
363
|
+
return {
|
|
364
|
+
content: [
|
|
365
|
+
{
|
|
366
|
+
type: "text",
|
|
367
|
+
text: `Error: ${error instanceof Error ? error.message : String(error)}`,
|
|
368
|
+
},
|
|
369
|
+
],
|
|
370
|
+
isError: true,
|
|
371
|
+
};
|
|
372
|
+
}
|
|
373
|
+
});
|
|
374
|
+
}
|
|
375
|
+
//# sourceMappingURL=federated.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"federated.js","sourceRoot":"","sources":["../../src/tools/federated.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAOH,OAAO,KAAK,OAAO,MAAM,cAAc,CAAC;AA4DxC,+EAA+E;AAC/E,mBAAmB;AACnB,+EAA+E;AAE/E;;;GAGG;AACH,MAAM,UAAU,iBAAiB,CAC/B,WAA+B,EAC/B,UAA6B;IAE7B,MAAM,YAAY,GAA4B,EAAE,CAAC;IAEjD,KAAK,MAAM,UAAU,IAAI,WAAW,EAAE,CAAC;QACrC,MAAM,cAAc,GAA4C,EAAE,CAAC;QAEnE,uCAAuC;QACvC,KAAK,MAAM,SAAS,IAAI,UAAU,EAAE,CAAC;YACnC,sEAAsE;YACtE,MAAM,WAAW,GAAG,SAAS,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAChD,UAAU,CAAC,UAAU,CAAC,QAAQ,EAAE,IAAI,CAAC,CACtC,CAAC;YAEF,IAAI,WAAW,EAAE,CAAC;gBAChB,cAAc,CAAC,IAAI,CAAC;oBAClB,SAAS,EAAE,SAAS,CAAC,SAAS;oBAC9B,OAAO,EAAE,SAAS,CAAC,OAAO;oBAC1B,MAAM,EAAE,SAAS,CAAC,MAAM;oBACxB,IAAI,EAAE,SAAS,CAAC,IAAI;iBACrB,CAAC,CAAC;YACL,CAAC;QACH,CAAC;QAED,IAAI,cAAc,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YAC9B,YAAY,CAAC,IAAI,CAAC;gBAChB,UAAU;gBACV,cAAc;aACf,CAAC,CAAC;QACL,CAAC;IACH,CAAC;IAED,OAAO,YAAY,CAAC;AACtB,CAAC;AAED;;GAEG;AACH,SAAS,aAAa,CAAC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