@mhalder/qdrant-mcp-server 3.1.2 → 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 +11 -0
- package/CONTRIBUTING.md +28 -130
- package/README.md +51 -30
- 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 +1 -1
- package/prompts.example.json +102 -0
- 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/build/tools/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAOH,OAAO,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAC9C,OAAO,EAAE,uBAAuB,EAAE,MAAM,iBAAiB,CAAC;AAC1D,OAAO,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAC;AACtD,OAAO,EAAE,uBAAuB,EAAE,MAAM,kBAAkB,CAAC;AAC3D,OAAO,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AASlD;;GAEG;AACH,MAAM,UAAU,gBAAgB,CAC9B,MAAiB,EACjB,IAAsB;IAEtB,uBAAuB,CAAC,MAAM,EAAE;QAC9B,MAA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,UAAU,EAAE,IAAI,CAAC,UAAU;KAC5B,CAAC,CAAC;IAEH,mBAAmB,CAAC,MAAM,EAAE;QAC1B,MAAM,EAAE,IAAI,CAAC,MAAM;QACnB,UAAU,EAAE,IAAI,CAAC,UAAU;KAC5B,CAAC,CAAC;IAEH,iBAAiB,CAAC,MAAM,EAAE;QACxB,WAAW,EAAE,IAAI,CAAC,WAAW;KAC9B,CAAC,CAAC;IAEH,uBAAuB,CAAC,MAAM,EAAE;QAC9B,iBAAiB,EAAE,IAAI,CAAC,iBAAiB;KAC1C,CAAC,CAAC;IAEH,sBAAsB,CAAC,MAAM,EAAE;QAC7B,WAAW,EAAE,IAAI,CAAC,WAAW;QAC7B,iBAAiB,EAAE,IAAI,CAAC,iBAAiB;KAC1C,CAAC,CAAC;AACL,CAAC;AAED,qCAAqC;AACrC,cAAc,cAAc,CAAC"}
|
package/build/tools/schemas.d.ts
CHANGED
|
@@ -96,4 +96,17 @@ export declare const GetGitIndexStatusSchema: {
|
|
|
96
96
|
export declare const ClearGitIndexSchema: {
|
|
97
97
|
path: z.ZodString;
|
|
98
98
|
};
|
|
99
|
+
export declare const ContextualSearchSchema: {
|
|
100
|
+
path: z.ZodString;
|
|
101
|
+
query: z.ZodString;
|
|
102
|
+
codeLimit: z.ZodOptional<z.ZodNumber>;
|
|
103
|
+
gitLimit: z.ZodOptional<z.ZodNumber>;
|
|
104
|
+
correlate: z.ZodOptional<z.ZodBoolean>;
|
|
105
|
+
};
|
|
106
|
+
export declare const FederatedSearchSchema: {
|
|
107
|
+
paths: z.ZodArray<z.ZodString, "many">;
|
|
108
|
+
query: z.ZodString;
|
|
109
|
+
searchType: z.ZodOptional<z.ZodEnum<["code", "git", "both"]>>;
|
|
110
|
+
limit: z.ZodOptional<z.ZodNumber>;
|
|
111
|
+
};
|
|
99
112
|
//# sourceMappingURL=schemas.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../src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MAAM,oBAAoB;;;;;CAQhC,CAAC;AAEF,eAAO,MAAM,kBAAkB;;;;;CAQ9B,CAAC;AAGF,eAAO,MAAM,mBAAmB;;;;;CAkB/B,CAAC;AAEF,eAAO,MAAM,gBAAgB;;;;;;CAiB5B,CAAC;AAEF,eAAO,MAAM,oBAAoB;;CAEhC,CAAC;AAEF,eAAO,MAAM,oBAAoB;;CAEhC,CAAC;AAEF,eAAO,MAAM,gBAAgB;;CAE5B,CAAC;AAGF,eAAO,MAAM,qBAAqB;;;;;CAgBjC,CAAC;AAEF,eAAO,MAAM,sBAAsB;;;;;;;;CA0ClC,CAAC;AAEF,eAAO,MAAM,qBAAqB;;CAEjC,CAAC;AAEF,eAAO,MAAM,uBAAuB;;CAEnC,CAAC;AAEF,eAAO,MAAM,mBAAmB;;CAE/B,CAAC;AAGF,eAAO,MAAM,sBAAsB;;;;;;CAmBlC,CAAC;AAGF,eAAO,MAAM,qBAAqB;;;;;CAcjC,CAAC"}
|
package/build/tools/schemas.js
CHANGED
|
@@ -175,4 +175,39 @@ export const GetGitIndexStatusSchema = {
|
|
|
175
175
|
export const ClearGitIndexSchema = {
|
|
176
176
|
path: z.string().describe("Path to git repository"),
|
|
177
177
|
};
|
|
178
|
+
// Contextual Search - Combined git + code search
|
|
179
|
+
export const ContextualSearchSchema = {
|
|
180
|
+
path: z
|
|
181
|
+
.string()
|
|
182
|
+
.describe("Path to git repository (must be indexed for both code and git history)"),
|
|
183
|
+
query: z.string().describe("Natural language search query"),
|
|
184
|
+
codeLimit: z
|
|
185
|
+
.number()
|
|
186
|
+
.optional()
|
|
187
|
+
.describe("Maximum number of code results (default: 5)"),
|
|
188
|
+
gitLimit: z
|
|
189
|
+
.number()
|
|
190
|
+
.optional()
|
|
191
|
+
.describe("Maximum number of git history results (default: 5)"),
|
|
192
|
+
correlate: z
|
|
193
|
+
.boolean()
|
|
194
|
+
.optional()
|
|
195
|
+
.describe("Link code chunks to commits that modified them (default: true)"),
|
|
196
|
+
};
|
|
197
|
+
// Federated Search - Multi-repository search
|
|
198
|
+
export const FederatedSearchSchema = {
|
|
199
|
+
paths: z
|
|
200
|
+
.array(z.string())
|
|
201
|
+
.min(1)
|
|
202
|
+
.describe("Array of repository paths to search (must all be indexed)"),
|
|
203
|
+
query: z.string().describe("Natural language search query"),
|
|
204
|
+
searchType: z
|
|
205
|
+
.enum(["code", "git", "both"])
|
|
206
|
+
.optional()
|
|
207
|
+
.describe("Type of search (default: both)"),
|
|
208
|
+
limit: z
|
|
209
|
+
.number()
|
|
210
|
+
.optional()
|
|
211
|
+
.describe("Total maximum results across all repositories (default: 20)"),
|
|
212
|
+
};
|
|
178
213
|
//# sourceMappingURL=schemas.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schemas.js","sourceRoot":"","sources":["../../src/tools/schemas.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,gCAAgC;AAChC,MAAM,CAAC,MAAM,sBAAsB,GAAG;IACpC,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,wBAAwB,CAAC;IACnD,QAAQ,EAAE,CAAC;SACR,IAAI,CAAC,CAAC,QAAQ,EAAE,QAAQ,EAAE,KAAK,CAAC,CAAC;SACjC,QAAQ,EAAE;SACV,QAAQ,CAAC,mCAAmC,CAAC;IAChD,YAAY,EAAE,CAAC;SACZ,OAAO,EAAE;SACT,QAAQ,EAAE;SACV,QAAQ,CAAC,2DAA2D,CAAC;CACzE,CAAC;AAEF,MAAM,CAAC,MAAM,sBAAsB,GAAG;IACpC,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,kCAAkC,CAAC;CAC9D,CAAC;AAEF,MAAM,CAAC,MAAM,uBAAuB,GAAG;IACrC,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,wBAAwB,CAAC;CACpD,CAAC;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AM,EAAE,CAAC,QAAQ,CAAC,+BAA+B,CAAC;IAC3D,UAAU,EAAE,CAAC;SACV,IAAI,CAAC,CAAC,MAAM,EAAE,KAAK,EAAE,MAAM,CAAC,CAAC;SAC7B,QAAQ,EAAE;SACV,QAAQ,CAAC,gCAAgC,CAAC;IAC7C,KAAK,EAAE,CAAC;SACL,MAAM,EAAE;SACR,QAAQ,EAAE;SACV,QAAQ,CAAC,6DAA6D,CAAC;CAC3E,CAAC"}
|
package/examples/README.md
CHANGED
|
@@ -91,10 +91,42 @@ Complex search filters with boolean logic
|
|
|
91
91
|
|
|
92
92
|
**Time:** 20-30 minutes | **Difficulty:** Intermediate to Advanced
|
|
93
93
|
|
|
94
|
+
---
|
|
95
|
+
|
|
96
|
+
### 💻 [Code Search](./code-search/)
|
|
97
|
+
|
|
98
|
+
Semantic code search with AST-aware chunking
|
|
99
|
+
|
|
100
|
+
- Indexing codebases with intelligent chunking
|
|
101
|
+
- Natural language queries for code
|
|
102
|
+
- Filtering by file type and path
|
|
103
|
+
- Incremental re-indexing
|
|
104
|
+
|
|
105
|
+
**Use cases:** Code exploration, onboarding, bug investigation, documentation
|
|
106
|
+
|
|
107
|
+
**Time:** 15-20 minutes | **Difficulty:** Intermediate
|
|
108
|
+
|
|
109
|
+
---
|
|
110
|
+
|
|
111
|
+
### 🚀 [Advanced Search](./advanced-search/)
|
|
112
|
+
|
|
113
|
+
Combined code + git search and multi-repository search
|
|
114
|
+
|
|
115
|
+
- **Contextual Search**: Query code and git history together with correlations
|
|
116
|
+
- **Federated Search**: Search across multiple repositories with RRF ranking
|
|
117
|
+
- Tracing feature evolution through history
|
|
118
|
+
- Cross-project pattern discovery
|
|
119
|
+
|
|
120
|
+
**Use cases:** Code archaeology, security audits, microservices, onboarding
|
|
121
|
+
|
|
122
|
+
**Time:** 20-30 minutes | **Difficulty:** Advanced
|
|
123
|
+
|
|
94
124
|
## Learning Path
|
|
95
125
|
|
|
96
126
|
```
|
|
97
127
|
Basic → Hybrid Search → Rate Limiting → Knowledge Base → Advanced Filtering
|
|
128
|
+
↓
|
|
129
|
+
Code Search → Advanced Search
|
|
98
130
|
```
|
|
99
131
|
|
|
100
132
|
## Common Patterns
|
|
@@ -0,0 +1,348 @@
|
|
|
1
|
+
# Advanced Search Examples
|
|
2
|
+
|
|
3
|
+
This example demonstrates how to use the advanced search features: contextual search (combined code + git) and federated search (multi-repository).
|
|
4
|
+
|
|
5
|
+
## Prerequisites
|
|
6
|
+
|
|
7
|
+
- Qdrant and Ollama running (see main README)
|
|
8
|
+
- Qdrant MCP server configured
|
|
9
|
+
- At least one repository indexed for both code AND git history
|
|
10
|
+
|
|
11
|
+
## Setup: Index a Repository
|
|
12
|
+
|
|
13
|
+
Before using advanced search, you need to index both code and git history:
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
# Step 1: Index the codebase
|
|
17
|
+
/mcp__qdrant__index_codebase /path/to/your/repo
|
|
18
|
+
|
|
19
|
+
# Step 2: Index git history
|
|
20
|
+
/mcp__qdrant__index_git_history /path/to/your/repo
|
|
21
|
+
|
|
22
|
+
# Verify both indexes exist
|
|
23
|
+
/mcp__qdrant__get_index_status /path/to/your/repo
|
|
24
|
+
/mcp__qdrant__get_git_index_status /path/to/your/repo
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
---
|
|
28
|
+
|
|
29
|
+
## Contextual Search
|
|
30
|
+
|
|
31
|
+
Contextual search queries both code and git history simultaneously, then correlates results to show which commits modified which code.
|
|
32
|
+
|
|
33
|
+
### Example 1: Basic Contextual Search
|
|
34
|
+
|
|
35
|
+
````bash
|
|
36
|
+
# Search for authentication-related code and commits
|
|
37
|
+
/mcp__qdrant__contextual_search /path/to/your/repo "user authentication"
|
|
38
|
+
|
|
39
|
+
# Expected output:
|
|
40
|
+
# ## Code Results
|
|
41
|
+
#
|
|
42
|
+
# ### 1. src/auth/middleware.ts:15-42 (score: 0.891)
|
|
43
|
+
# Language: typescript
|
|
44
|
+
# ```typescript
|
|
45
|
+
# export async function authenticateUser(req: Request) {
|
|
46
|
+
# const token = req.headers.authorization?.split(' ')[1];
|
|
47
|
+
# if (!token) throw new UnauthorizedError();
|
|
48
|
+
# // ...
|
|
49
|
+
# }
|
|
50
|
+
# ```
|
|
51
|
+
#
|
|
52
|
+
# ## Git History Results
|
|
53
|
+
#
|
|
54
|
+
# ### 1. abc123d - feat: add JWT authentication (score: 0.845)
|
|
55
|
+
# Author: John Doe | Date: 2024-01-15 | Type: feat
|
|
56
|
+
# Files: src/auth/middleware.ts, src/auth/jwt.ts
|
|
57
|
+
#
|
|
58
|
+
# ## Correlations (Code ↔ Commits)
|
|
59
|
+
#
|
|
60
|
+
# **src/auth/middleware.ts:15** modified by:
|
|
61
|
+
# - abc123d: feat: add JWT authentication
|
|
62
|
+
# - def456a: fix: handle expired tokens
|
|
63
|
+
#
|
|
64
|
+
# ---
|
|
65
|
+
# Found 5 code result(s), 5 git result(s), 3 correlation(s).
|
|
66
|
+
````
|
|
67
|
+
|
|
68
|
+
### Example 2: Adjust Result Limits
|
|
69
|
+
|
|
70
|
+
```bash
|
|
71
|
+
# Get more code results, fewer git results
|
|
72
|
+
/mcp__qdrant__contextual_search /path/to/your/repo "database queries" --codeLimit 10 --gitLimit 3
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
### Example 3: Disable Correlations
|
|
76
|
+
|
|
77
|
+
For faster results when you don't need file-commit linking:
|
|
78
|
+
|
|
79
|
+
```bash
|
|
80
|
+
# Skip correlation building
|
|
81
|
+
/mcp__qdrant__contextual_search /path/to/your/repo "API endpoints" --correlate false
|
|
82
|
+
|
|
83
|
+
# Output will show code and git results, but no correlations section
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
### Example 4: Bug Investigation Workflow
|
|
87
|
+
|
|
88
|
+
**Scenario**: A bug was reported in the payment system
|
|
89
|
+
|
|
90
|
+
```bash
|
|
91
|
+
# Step 1: Find related code and commits
|
|
92
|
+
/mcp__qdrant__contextual_search /workspace/app "payment processing error"
|
|
93
|
+
|
|
94
|
+
# Step 2: From the correlations, identify recent changes
|
|
95
|
+
# The output shows which commits modified the relevant files
|
|
96
|
+
|
|
97
|
+
# Step 3: Drill down into specific commits
|
|
98
|
+
/mcp__qdrant__search_git_history /workspace/app "payment" --commitTypes fix
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
### Example 5: Code Review Preparation
|
|
102
|
+
|
|
103
|
+
**Scenario**: Reviewing changes to the authentication system
|
|
104
|
+
|
|
105
|
+
```bash
|
|
106
|
+
# Understand the current state and history together
|
|
107
|
+
/mcp__qdrant__contextual_search /workspace/app "authentication middleware"
|
|
108
|
+
|
|
109
|
+
# The correlations show you:
|
|
110
|
+
# - Current code implementation
|
|
111
|
+
# - Who changed it and when
|
|
112
|
+
# - What the commit messages said about the changes
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
---
|
|
116
|
+
|
|
117
|
+
## Federated Search
|
|
118
|
+
|
|
119
|
+
Federated search queries multiple repositories at once, combining and ranking results using Reciprocal Rank Fusion (RRF).
|
|
120
|
+
|
|
121
|
+
### Setup: Index Multiple Repositories
|
|
122
|
+
|
|
123
|
+
```bash
|
|
124
|
+
# Index repository 1
|
|
125
|
+
/mcp__qdrant__index_codebase /projects/api-server
|
|
126
|
+
/mcp__qdrant__index_git_history /projects/api-server
|
|
127
|
+
|
|
128
|
+
# Index repository 2
|
|
129
|
+
/mcp__qdrant__index_codebase /projects/web-app
|
|
130
|
+
/mcp__qdrant__index_git_history /projects/web-app
|
|
131
|
+
|
|
132
|
+
# Index repository 3
|
|
133
|
+
/mcp__qdrant__index_codebase /projects/shared-lib
|
|
134
|
+
/mcp__qdrant__index_git_history /projects/shared-lib
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
### Example 6: Search Across All Repositories
|
|
138
|
+
|
|
139
|
+
````bash
|
|
140
|
+
# Search all repos for authentication code
|
|
141
|
+
/mcp__qdrant__federated_search ["/projects/api-server", "/projects/web-app", "/projects/shared-lib"] "authentication"
|
|
142
|
+
|
|
143
|
+
# Expected output:
|
|
144
|
+
# # Federated Search Results
|
|
145
|
+
# Query: "authentication" | Type: both | Repositories: 3
|
|
146
|
+
#
|
|
147
|
+
# ## 1. [CODE] src/auth/jwt.ts:10-35
|
|
148
|
+
# Repository: /projects/api-server | Language: typescript | Score: 0.923
|
|
149
|
+
# ```typescript
|
|
150
|
+
# export function verifyJWT(token: string) { ... }
|
|
151
|
+
# ```
|
|
152
|
+
#
|
|
153
|
+
# ## 2. [GIT] def456a - fix: patch auth bypass vulnerability
|
|
154
|
+
# Repository: /projects/web-app | Author: Jane Smith | Date: 2024-02-20 | Score: 0.891
|
|
155
|
+
# Type: fix | Files: src/auth.js, src/middleware.js
|
|
156
|
+
#
|
|
157
|
+
# ## 3. [CODE] lib/session/manager.py:45-78
|
|
158
|
+
# Repository: /projects/shared-lib | Language: python | Score: 0.867
|
|
159
|
+
# ```python
|
|
160
|
+
# class SessionManager: ...
|
|
161
|
+
# ```
|
|
162
|
+
#
|
|
163
|
+
# ---
|
|
164
|
+
# Total: 20 result(s) from 3 repository(ies).
|
|
165
|
+
````
|
|
166
|
+
|
|
167
|
+
### Example 7: Code-Only Search
|
|
168
|
+
|
|
169
|
+
```bash
|
|
170
|
+
# Search only code across repositories
|
|
171
|
+
/mcp__qdrant__federated_search ["/projects/api-server", "/projects/web-app"] "database connection" --searchType code
|
|
172
|
+
|
|
173
|
+
# Results will only contain [CODE] entries
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
### Example 8: Git-Only Search
|
|
177
|
+
|
|
178
|
+
```bash
|
|
179
|
+
# Search only git history across repositories
|
|
180
|
+
/mcp__qdrant__federated_search ["/projects/api-server", "/projects/web-app"] "security fix" --searchType git
|
|
181
|
+
|
|
182
|
+
# Results will only contain [GIT] entries
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
### Example 9: Limit Total Results
|
|
186
|
+
|
|
187
|
+
```bash
|
|
188
|
+
# Get top 5 results across all repositories
|
|
189
|
+
/mcp__qdrant__federated_search ["/repo1", "/repo2", "/repo3"] "error handling" --limit 5
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
### Example 10: Microservices Investigation
|
|
193
|
+
|
|
194
|
+
**Scenario**: Finding how a feature is implemented across microservices
|
|
195
|
+
|
|
196
|
+
```bash
|
|
197
|
+
# Search all services for user management code
|
|
198
|
+
/mcp__qdrant__federated_search [
|
|
199
|
+
"/services/user-service",
|
|
200
|
+
"/services/auth-service",
|
|
201
|
+
"/services/notification-service"
|
|
202
|
+
] "user profile update"
|
|
203
|
+
|
|
204
|
+
# Results show implementations across all services, ranked by relevance
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
### Example 11: Finding Best Practices
|
|
208
|
+
|
|
209
|
+
**Scenario**: Looking for error handling patterns across your organization
|
|
210
|
+
|
|
211
|
+
```bash
|
|
212
|
+
# Search across multiple projects
|
|
213
|
+
/mcp__qdrant__federated_search [
|
|
214
|
+
"/projects/project-a",
|
|
215
|
+
"/projects/project-b",
|
|
216
|
+
"/projects/project-c"
|
|
217
|
+
] "error handling middleware" --searchType code --limit 10
|
|
218
|
+
|
|
219
|
+
# Review how different teams implement similar patterns
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
---
|
|
223
|
+
|
|
224
|
+
## Use Cases
|
|
225
|
+
|
|
226
|
+
### 1. Onboarding New Developers
|
|
227
|
+
|
|
228
|
+
```bash
|
|
229
|
+
# Help new developer understand authentication across the stack
|
|
230
|
+
/mcp__qdrant__contextual_search /workspace/main-app "user login flow"
|
|
231
|
+
|
|
232
|
+
# Then search related microservices
|
|
233
|
+
/mcp__qdrant__federated_search ["/services/auth", "/services/user", "/services/session"] "login"
|
|
234
|
+
```
|
|
235
|
+
|
|
236
|
+
### 2. Security Audit
|
|
237
|
+
|
|
238
|
+
```bash
|
|
239
|
+
# Find all security-related code and fixes
|
|
240
|
+
/mcp__qdrant__federated_search ["/repo1", "/repo2"] "security vulnerability" --searchType git
|
|
241
|
+
/mcp__qdrant__federated_search ["/repo1", "/repo2"] "authentication bypass" --searchType code
|
|
242
|
+
```
|
|
243
|
+
|
|
244
|
+
### 3. Migration Planning
|
|
245
|
+
|
|
246
|
+
```bash
|
|
247
|
+
# Understand what needs to change for a database migration
|
|
248
|
+
/mcp__qdrant__contextual_search /workspace/app "database connection"
|
|
249
|
+
|
|
250
|
+
# Check how other projects handled similar migrations
|
|
251
|
+
/mcp__qdrant__federated_search ["/other-projects/migrated-app"] "database migration"
|
|
252
|
+
```
|
|
253
|
+
|
|
254
|
+
### 4. Technical Debt Assessment
|
|
255
|
+
|
|
256
|
+
```bash
|
|
257
|
+
# Find TODO comments and related commit history
|
|
258
|
+
/mcp__qdrant__contextual_search /workspace/app "TODO fixme refactor"
|
|
259
|
+
|
|
260
|
+
# The correlations show when tech debt was introduced
|
|
261
|
+
```
|
|
262
|
+
|
|
263
|
+
### 5. Cross-Repository Refactoring
|
|
264
|
+
|
|
265
|
+
```bash
|
|
266
|
+
# Before refactoring a shared pattern, find all usages
|
|
267
|
+
/mcp__qdrant__federated_search ["/app1", "/app2", "/app3"] "deprecated API usage" --searchType code
|
|
268
|
+
```
|
|
269
|
+
|
|
270
|
+
---
|
|
271
|
+
|
|
272
|
+
## Understanding RRF Ranking
|
|
273
|
+
|
|
274
|
+
Federated search uses **Reciprocal Rank Fusion (RRF)** to combine results from different repositories and search types:
|
|
275
|
+
|
|
276
|
+
```
|
|
277
|
+
RRF Score = Σ(1 / (k + rank)) where k=60
|
|
278
|
+
```
|
|
279
|
+
|
|
280
|
+
This means:
|
|
281
|
+
|
|
282
|
+
- Results are ranked by position within each category (code/git per repo)
|
|
283
|
+
- The constant k=60 prevents any single high-ranking result from dominating
|
|
284
|
+
- Results that appear highly ranked in multiple categories score higher
|
|
285
|
+
- Fair comparison across repositories with different sizes
|
|
286
|
+
|
|
287
|
+
### Why RRF?
|
|
288
|
+
|
|
289
|
+
1. **Handles score incomparability**: Scores from different indexes may not be directly comparable
|
|
290
|
+
2. **Rewards consistency**: Results relevant across multiple sources rank higher
|
|
291
|
+
3. **Prevents dominance**: No single repository can dominate results
|
|
292
|
+
4. **Simple and effective**: Well-proven algorithm for result fusion
|
|
293
|
+
|
|
294
|
+
---
|
|
295
|
+
|
|
296
|
+
## Error Handling
|
|
297
|
+
|
|
298
|
+
### Index Not Found
|
|
299
|
+
|
|
300
|
+
```bash
|
|
301
|
+
# If you see this error:
|
|
302
|
+
# Error: Code index not found for "/path/to/repo". Run index_codebase first.
|
|
303
|
+
|
|
304
|
+
# Solution: Index the repository
|
|
305
|
+
/mcp__qdrant__index_codebase /path/to/repo
|
|
306
|
+
/mcp__qdrant__index_git_history /path/to/repo
|
|
307
|
+
```
|
|
308
|
+
|
|
309
|
+
### Partial Indexing
|
|
310
|
+
|
|
311
|
+
```bash
|
|
312
|
+
# Contextual search requires BOTH indexes
|
|
313
|
+
# If only code is indexed:
|
|
314
|
+
# Error: Git history index not found for "/path/to/repo". Run index_git_history first.
|
|
315
|
+
|
|
316
|
+
# Solution: Index git history
|
|
317
|
+
/mcp__qdrant__index_git_history /path/to/repo
|
|
318
|
+
```
|
|
319
|
+
|
|
320
|
+
### Federated Search Validation
|
|
321
|
+
|
|
322
|
+
```bash
|
|
323
|
+
# Federated search validates ALL repositories before searching
|
|
324
|
+
# If ANY repository is missing an index, it fails fast:
|
|
325
|
+
# Error: Index validation failed:
|
|
326
|
+
# Code index not found for "/repo2"
|
|
327
|
+
# Git history index not found for "/repo3"
|
|
328
|
+
|
|
329
|
+
# Solution: Index all repositories before federated search
|
|
330
|
+
```
|
|
331
|
+
|
|
332
|
+
---
|
|
333
|
+
|
|
334
|
+
## Performance Tips
|
|
335
|
+
|
|
336
|
+
1. **Use searchType wisely**: If you only need code, use `--searchType code` to skip git searches
|
|
337
|
+
2. **Limit results**: Use `--limit` to reduce the number of results when exploring
|
|
338
|
+
3. **Disable correlations**: Use `--correlate false` when you don't need file-commit linking
|
|
339
|
+
4. **Index incrementally**: Use `reindex_changes` and `index_new_commits` to keep indexes fresh
|
|
340
|
+
5. **Local embeddings**: Use Ollama for fastest multi-repository searches
|
|
341
|
+
|
|
342
|
+
---
|
|
343
|
+
|
|
344
|
+
## Next Steps
|
|
345
|
+
|
|
346
|
+
- Set up [custom prompts](../../prompts.example.json) for advanced search workflows
|
|
347
|
+
- Explore [code search](../code-search/) for single-repository deep dives
|
|
348
|
+
- Check [hybrid search](../hybrid-search/) for combining semantic and keyword search
|
package/package.json
CHANGED
package/prompts.example.json
CHANGED
|
@@ -91,6 +91,108 @@
|
|
|
91
91
|
}
|
|
92
92
|
],
|
|
93
93
|
"template": "Build a structured knowledge base in '{{collection}}' for the {{domain}} domain:\n\n1. Create (or verify) the collection with hybrid search enabled for optimal retrieval\n2. Design a metadata schema appropriate for {{domain}}, such as:\n - category/topic fields for filtering\n - timestamps for temporal filtering\n - source/author for provenance\n - confidence/quality scores\n3. Provide guidance on document structure:\n - Optimal chunk sizes (typically 200-500 tokens)\n - How to maintain context across chunks\n - Metadata to include with each document\n4. Show example documents with proper formatting\n5. Explain search strategies for this knowledge base:\n - When to use metadata filters\n - When hybrid search adds value\n - How to handle multi-step queries"
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
"name": "index_git_history",
|
|
97
|
+
"description": "Index a repository's git commit history for semantic search",
|
|
98
|
+
"arguments": [
|
|
99
|
+
{
|
|
100
|
+
"name": "repoPath",
|
|
101
|
+
"description": "Path to the git repository to index",
|
|
102
|
+
"required": true
|
|
103
|
+
}
|
|
104
|
+
],
|
|
105
|
+
"template": "Index the git commit history for the repository at '{{repoPath}}':\n\n1. First, check the current indexing status using get_git_index_status to see if any commits are already indexed\n2. Run index_git_history to index the repository's commit history:\n - This will extract commit messages, authors, dates, and file changes\n - Each commit is embedded for semantic search\n3. After indexing completes, show the status summary:\n - Total commits indexed\n - Date range covered\n - Any errors or skipped commits\n4. Demonstrate a sample search to verify the index is working:\n - Search for 'bug fix' or 'refactor' to show semantic matching\n5. Explain how to keep the index updated:\n - Use index_new_commits for incremental updates\n - Consider setting up periodic re-indexing for active repositories"
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
"name": "search_project_history",
|
|
109
|
+
"description": "Search git history to understand how a feature or fix was implemented",
|
|
110
|
+
"arguments": [
|
|
111
|
+
{
|
|
112
|
+
"name": "repoPath",
|
|
113
|
+
"description": "Path to the git repository",
|
|
114
|
+
"required": true
|
|
115
|
+
},
|
|
116
|
+
{
|
|
117
|
+
"name": "query",
|
|
118
|
+
"description": "What to search for in the commit history",
|
|
119
|
+
"required": true
|
|
120
|
+
}
|
|
121
|
+
],
|
|
122
|
+
"template": "Search the git history of '{{repoPath}}' for '{{query}}':\n\n1. First, verify the repository is indexed using get_git_index_status\n - If not indexed, run index_git_history first\n2. Perform a semantic search using search_git_history:\n - Search for: '{{query}}'\n - Return the top 10 most relevant commits\n3. For each relevant commit, analyze:\n - The commit message and what it indicates about the change\n - The author and date for context\n - The files that were modified\n4. Summarize the findings:\n - How was this feature/fix implemented over time?\n - Who were the main contributors?\n - Are there related commits that provide additional context?\n5. Suggest follow-up searches if the initial results need refinement"
|
|
123
|
+
},
|
|
124
|
+
{
|
|
125
|
+
"name": "investigate_code_with_history",
|
|
126
|
+
"description": "Deep dive into code with its change history using contextual search",
|
|
127
|
+
"arguments": [
|
|
128
|
+
{
|
|
129
|
+
"name": "repo",
|
|
130
|
+
"description": "Path to the repository (must be indexed for both code and git)",
|
|
131
|
+
"required": true
|
|
132
|
+
},
|
|
133
|
+
{
|
|
134
|
+
"name": "topic",
|
|
135
|
+
"description": "Topic or feature to investigate (e.g., 'authentication', 'payment processing')",
|
|
136
|
+
"required": true
|
|
137
|
+
}
|
|
138
|
+
],
|
|
139
|
+
"template": "Investigate '{{topic}}' in the repository '{{repo}}' using contextual search:\n\n1. First, verify the repository is indexed for both code and git history:\n - Check code index status\n - Check git index status\n - If either is missing, guide the user to index first\n\n2. Run contextual_search for '{{topic}}' with codeLimit=10 and gitLimit=10\n\n3. Analyze the results:\n - Summarize the key code implementations found\n - List the most relevant commits and their authors\n - Highlight the correlations (which commits modified which code)\n\n4. Provide insights:\n - How has this code evolved over time?\n - Who are the main contributors to this area?\n - Are there any patterns in the commit types (fixes, features, refactors)?\n\n5. Suggest next steps:\n - Specific files to review in detail\n - Related areas to investigate\n - Potential issues or technical debt indicated by the history"
|
|
140
|
+
},
|
|
141
|
+
{
|
|
142
|
+
"name": "cross_repo_search",
|
|
143
|
+
"description": "Search for patterns or implementations across multiple repositories",
|
|
144
|
+
"arguments": [
|
|
145
|
+
{
|
|
146
|
+
"name": "repos",
|
|
147
|
+
"description": "Comma-separated list of repository paths",
|
|
148
|
+
"required": true
|
|
149
|
+
},
|
|
150
|
+
{
|
|
151
|
+
"name": "pattern",
|
|
152
|
+
"description": "Pattern or implementation to find (e.g., 'error handling', 'API authentication')",
|
|
153
|
+
"required": true
|
|
154
|
+
},
|
|
155
|
+
{
|
|
156
|
+
"name": "search_type",
|
|
157
|
+
"description": "Type of search: 'code', 'git', or 'both'",
|
|
158
|
+
"required": false
|
|
159
|
+
}
|
|
160
|
+
],
|
|
161
|
+
"template": "Search for '{{pattern}}' across multiple repositories: {{repos}}\n\n1. Parse the repository list and verify each is indexed:\n - For searchType='code' or 'both': verify code indexes\n - For searchType='git' or 'both': verify git indexes\n - Report any repositories that need indexing\n\n2. Run federated_search with:\n - paths: [parsed from {{repos}}]\n - query: '{{pattern}}'\n - searchType: '{{search_type}}' (default: 'both')\n - limit: 20\n\n3. Analyze the results:\n - Group results by repository\n - Identify common patterns across repos\n - Note any differences in implementation approaches\n\n4. Provide a summary:\n - Which repositories have the most relevant code?\n - Are there consistent patterns or divergent approaches?\n - Which implementations could serve as best practices?\n\n5. Recommendations:\n - Suggest standardization opportunities\n - Identify potential shared libraries or abstractions\n - Highlight any concerning inconsistencies"
|
|
162
|
+
},
|
|
163
|
+
{
|
|
164
|
+
"name": "trace_feature_evolution",
|
|
165
|
+
"description": "Trace how a feature evolved over time using code and git history",
|
|
166
|
+
"arguments": [
|
|
167
|
+
{
|
|
168
|
+
"name": "repo",
|
|
169
|
+
"description": "Path to the repository",
|
|
170
|
+
"required": true
|
|
171
|
+
},
|
|
172
|
+
{
|
|
173
|
+
"name": "feature",
|
|
174
|
+
"description": "Feature name or description to trace",
|
|
175
|
+
"required": true
|
|
176
|
+
}
|
|
177
|
+
],
|
|
178
|
+
"template": "Trace the evolution of '{{feature}}' in '{{repo}}':\n\n1. Run contextual_search for '{{feature}}' with:\n - codeLimit: 5 (focus on current implementation)\n - gitLimit: 15 (get more history)\n - correlate: true\n\n2. Build a timeline:\n - List commits chronologically that relate to this feature\n - Identify the initial implementation commit\n - Track major changes, refactors, and bug fixes\n\n3. Analyze the evolution:\n - How has the code changed from initial to current?\n - What problems were fixed along the way?\n - Were there any major rewrites or refactors?\n\n4. Identify contributors:\n - Who introduced the feature?\n - Who has made significant contributions since?\n - Is there a current owner/maintainer?\n\n5. Provide insights:\n - Stability assessment (frequent fixes = potential issues)\n - Technical debt indicators\n - Recommendations for future development"
|
|
179
|
+
},
|
|
180
|
+
{
|
|
181
|
+
"name": "security_audit_search",
|
|
182
|
+
"description": "Search for security-related code and fixes across repositories",
|
|
183
|
+
"arguments": [
|
|
184
|
+
{
|
|
185
|
+
"name": "repos",
|
|
186
|
+
"description": "Comma-separated list of repository paths to audit",
|
|
187
|
+
"required": true
|
|
188
|
+
},
|
|
189
|
+
{
|
|
190
|
+
"name": "focus_area",
|
|
191
|
+
"description": "Security focus area (e.g., 'authentication', 'input validation', 'encryption')",
|
|
192
|
+
"required": false
|
|
193
|
+
}
|
|
194
|
+
],
|
|
195
|
+
"template": "Perform a security-focused search across repositories: {{repos}}\n\n1. Search for security-related code:\n - Run federated_search with searchType='code' for:\n - '{{focus_area}} security' (if focus_area provided)\n - Common security patterns: 'authentication', 'authorization', 'encryption', 'input validation', 'sanitization'\n\n2. Search for security fixes in history:\n - Run federated_search with searchType='git' for:\n - 'security fix vulnerability'\n - 'CVE patch'\n - 'authentication bypass'\n - 'injection fix'\n\n3. Analyze findings:\n - List security-critical code areas found\n - Identify past security issues from git history\n - Note patterns in security fixes (common vulnerabilities)\n\n4. Risk assessment:\n - Which repositories have the most security-sensitive code?\n - Are there areas with frequent security fixes (potential weaknesses)?\n - Are security best practices consistently applied?\n\n5. Recommendations:\n - Specific areas that need security review\n - Patterns that should be standardized\n - Potential vulnerabilities to investigate further"
|
|
94
196
|
}
|
|
95
197
|
]
|
|
96
198
|
}
|