@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/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,14 @@
|
|
|
1
|
+
## 3.2.0 (2026-01-24)
|
|
2
|
+
|
|
3
|
+
* Merge pull request #51 from mhalder/feat/advanced-search ([e99311b](https://github.com/mhalder/qdrant-mcp-server/commit/e99311b)), closes [#51](https://github.com/mhalder/qdrant-mcp-server/issues/51)
|
|
4
|
+
* fix(federated): rank within repo+type groups for fair RRF interleaving ([958411a](https://github.com/mhalder/qdrant-mcp-server/commit/958411a))
|
|
5
|
+
* fix(federated): use segment comparison for path matching ([9de2b85](https://github.com/mhalder/qdrant-mcp-server/commit/9de2b85))
|
|
6
|
+
* docs(contributing): simplify and remove redundancy ([393a918](https://github.com/mhalder/qdrant-mcp-server/commit/393a918))
|
|
7
|
+
* docs(readme): fix Claude Code MCP config path and format ([4c338f0](https://github.com/mhalder/qdrant-mcp-server/commit/4c338f0))
|
|
8
|
+
* docs(readme): simplify quick start config and add usage examples ([e3a8978](https://github.com/mhalder/qdrant-mcp-server/commit/e3a8978))
|
|
9
|
+
* feat(tools): add contextual and federated search tools ([48d880e](https://github.com/mhalder/qdrant-mcp-server/commit/48d880e))
|
|
10
|
+
* chore(prompts): add git indexing prompt templates ([38607a8](https://github.com/mhalder/qdrant-mcp-server/commit/38607a8))
|
|
11
|
+
|
|
1
12
|
## <small>3.1.2 (2026-01-23)</small>
|
|
2
13
|
|
|
3
14
|
* Merge pull request #50 from mhalder/fix/pathpattern-filter ([b12517f](https://github.com/mhalder/qdrant-mcp-server/commit/b12517f)), closes [#50](https://github.com/mhalder/qdrant-mcp-server/issues/50)
|
package/CONTRIBUTING.md
CHANGED
|
@@ -2,171 +2,69 @@
|
|
|
2
2
|
|
|
3
3
|
Thank you for your interest in contributing!
|
|
4
4
|
|
|
5
|
-
##
|
|
5
|
+
## Quick Start
|
|
6
6
|
|
|
7
7
|
```bash
|
|
8
|
-
#
|
|
8
|
+
# Fork and clone
|
|
9
9
|
git clone https://github.com/YOUR_USERNAME/qdrant-mcp-server.git
|
|
10
10
|
cd qdrant-mcp-server
|
|
11
11
|
npm install
|
|
12
12
|
|
|
13
|
-
#
|
|
13
|
+
# Create feature branch
|
|
14
14
|
git checkout -b feat/your-feature-name
|
|
15
15
|
|
|
16
|
-
#
|
|
17
|
-
|
|
18
|
-
# 4. Verify
|
|
16
|
+
# Make changes, then verify
|
|
19
17
|
npm test -- --run
|
|
20
18
|
npm run type-check
|
|
21
19
|
npm run build
|
|
22
20
|
|
|
23
|
-
#
|
|
21
|
+
# Commit with conventional format
|
|
24
22
|
git commit -m "feat: add new feature"
|
|
25
23
|
```
|
|
26
24
|
|
|
27
25
|
## Development Commands
|
|
28
26
|
|
|
29
|
-
| Command
|
|
30
|
-
|
|
|
31
|
-
| `npm run build`
|
|
32
|
-
| `npm run dev`
|
|
33
|
-
| `npm test`
|
|
34
|
-
| `npm run test:
|
|
35
|
-
| `npm run
|
|
36
|
-
| `npm run test:providers` | Provider verification |
|
|
37
|
-
| `npm run type-check` | TypeScript validation |
|
|
27
|
+
| Command | Purpose |
|
|
28
|
+
| ----------------------- | -------------------- |
|
|
29
|
+
| `npm run build` | Build for production |
|
|
30
|
+
| `npm run dev` | Dev with auto-reload |
|
|
31
|
+
| `npm test` | Run test suite |
|
|
32
|
+
| `npm run test:coverage` | Coverage report |
|
|
33
|
+
| `npm run type-check` | TypeScript check |
|
|
38
34
|
|
|
39
35
|
## Commit Convention
|
|
40
36
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
### Format
|
|
37
|
+
Use [Conventional Commits](https://www.conventionalcommits.org/):
|
|
44
38
|
|
|
45
39
|
```
|
|
46
40
|
<type>(<scope>): <subject>
|
|
47
|
-
|
|
48
|
-
<body>
|
|
49
|
-
|
|
50
|
-
<footer>
|
|
51
|
-
```
|
|
52
|
-
|
|
53
|
-
### Types
|
|
54
|
-
|
|
55
|
-
| Type | Description | Version Bump |
|
|
56
|
-
| ---------- | ----------------------- | ------------- |
|
|
57
|
-
| `feat` | New feature | Minor (1.x.0) |
|
|
58
|
-
| `fix` | Bug fix | Patch (1.0.x) |
|
|
59
|
-
| `docs` | Documentation | Patch |
|
|
60
|
-
| `refactor` | Code refactoring | Patch |
|
|
61
|
-
| `perf` | Performance improvement | Patch |
|
|
62
|
-
| `test` | Adding/updating tests | None |
|
|
63
|
-
| `chore` | Build/dependencies | None |
|
|
64
|
-
| `ci` | CI/CD changes | None |
|
|
65
|
-
| `style` | Code style/formatting | None |
|
|
66
|
-
|
|
67
|
-
### Breaking Changes
|
|
68
|
-
|
|
69
|
-
Add `BREAKING CHANGE:` in body/footer or append `!` after type:
|
|
70
|
-
|
|
71
|
-
```bash
|
|
72
|
-
feat!: remove Node 16 support
|
|
73
|
-
|
|
74
|
-
BREAKING CHANGE: Node 16 is no longer supported
|
|
75
41
|
```
|
|
76
42
|
|
|
77
|
-
|
|
43
|
+
**Types:** `feat`, `fix`, `docs`, `refactor`, `perf`, `test`, `chore`, `ci`
|
|
78
44
|
|
|
79
|
-
|
|
45
|
+
**Examples:**
|
|
80
46
|
|
|
81
47
|
```bash
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
fix(search): correct similarity score calculation
|
|
87
|
-
|
|
88
|
-
# Documentation
|
|
89
|
-
docs: update installation instructions
|
|
90
|
-
|
|
91
|
-
# Breaking change
|
|
92
|
-
feat!: change collection schema format
|
|
48
|
+
feat(embeddings): add new provider
|
|
49
|
+
fix(search): correct score calculation
|
|
50
|
+
docs: update installation guide
|
|
51
|
+
feat!: breaking change (major version bump)
|
|
93
52
|
```
|
|
94
53
|
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
Commitlint enforces:
|
|
54
|
+
## Pull Requests
|
|
98
55
|
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
- Subject must not start with uppercase
|
|
56
|
+
1. Add tests for changes
|
|
57
|
+
2. Update docs if needed
|
|
58
|
+
3. Pass CI checks (build, type-check, tests)
|
|
59
|
+
4. Use conventional commit format for PR title
|
|
104
60
|
|
|
105
|
-
##
|
|
61
|
+
## Releases
|
|
106
62
|
|
|
107
|
-
|
|
108
|
-
2. **Add tests** for changes
|
|
109
|
-
3. **Pass CI checks** (build, type-check, tests)
|
|
110
|
-
4. **Request review**
|
|
111
|
-
5. **Merge** after approval
|
|
112
|
-
|
|
113
|
-
### PR Title
|
|
114
|
-
|
|
115
|
-
Use conventional commit format:
|
|
116
|
-
|
|
117
|
-
```
|
|
118
|
-
feat: add new search feature
|
|
119
|
-
fix: resolve connection timeout
|
|
120
|
-
docs: improve setup documentation
|
|
121
|
-
```
|
|
122
|
-
|
|
123
|
-
## Release Process
|
|
124
|
-
|
|
125
|
-
Automated via [semantic-release](https://semantic-release.gitbook.io/):
|
|
126
|
-
|
|
127
|
-
- Releases on merge to `main`
|
|
128
|
-
- Version follows [Semantic Versioning](https://semver.org/)
|
|
129
|
-
- Changelog auto-generated from commits
|
|
130
|
-
- Packages published to npm
|
|
131
|
-
|
|
132
|
-
### Version Bumps
|
|
63
|
+
Automated via [semantic-release](https://semantic-release.gitbook.io/) on merge to `main`:
|
|
133
64
|
|
|
134
65
|
- `feat` → minor (1.x.0)
|
|
135
|
-
- `fix`, `
|
|
136
|
-
- `BREAKING CHANGE` → major (x.0.0)
|
|
137
|
-
|
|
138
|
-
## Testing
|
|
139
|
-
|
|
140
|
-
- Write tests for all new features and bug fixes
|
|
141
|
-
- Maintain or improve code coverage
|
|
142
|
-
- Run full test suite before submitting PRs
|
|
143
|
-
- Include both unit and integration tests
|
|
144
|
-
|
|
145
|
-
## Project Structure
|
|
146
|
-
|
|
147
|
-
```
|
|
148
|
-
qdrant-mcp-server/
|
|
149
|
-
├── src/ # Source code
|
|
150
|
-
│ ├── code/ # Code indexing and vectorization
|
|
151
|
-
│ │ ├── chunker/ # AST-aware code chunking
|
|
152
|
-
│ │ └── sync/ # File synchronization with Merkle trees
|
|
153
|
-
│ ├── embeddings/ # Embedding providers (Ollama, OpenAI, Cohere, Voyage)
|
|
154
|
-
│ ├── prompts/ # MCP prompt templates and registration
|
|
155
|
-
│ ├── qdrant/ # Qdrant vector database client
|
|
156
|
-
│ ├── resources/ # MCP resource definitions
|
|
157
|
-
│ └── tools/ # MCP tool implementations
|
|
158
|
-
│ ├── code.ts # Code indexing tools
|
|
159
|
-
│ ├── collection.ts # Collection management
|
|
160
|
-
│ ├── document.ts # Document operations
|
|
161
|
-
│ ├── search.ts # Search tools (semantic + hybrid)
|
|
162
|
-
│ ├── schemas.ts # Zod validation schemas
|
|
163
|
-
│ └── index.ts # Tool registration orchestrator
|
|
164
|
-
├── build/ # Compiled output
|
|
165
|
-
├── examples/ # Usage examples
|
|
166
|
-
├── scripts/ # Utility scripts
|
|
167
|
-
├── .github/ # GitHub Actions workflows
|
|
168
|
-
└── .husky/ # Git hooks
|
|
169
|
-
```
|
|
66
|
+
- `fix`, `docs`, `refactor`, `perf` → patch (1.0.x)
|
|
67
|
+
- `BREAKING CHANGE` or `!` → major (x.0.0)
|
|
170
68
|
|
|
171
69
|
## Questions?
|
|
172
70
|
|
package/README.md
CHANGED
|
@@ -11,6 +11,7 @@ A Model Context Protocol (MCP) server providing semantic search capabilities usi
|
|
|
11
11
|
- **Privacy-First**: Local embeddings and vector storage - data never leaves your machine
|
|
12
12
|
- **Code Vectorization**: Intelligent codebase indexing with AST-aware chunking and semantic code search
|
|
13
13
|
- **Git History Search**: Index commit history for semantic search over past changes, fixes, and patterns
|
|
14
|
+
- **Advanced Search**: Contextual search (code + git with correlations) and federated search across multiple repositories
|
|
14
15
|
- **Multiple Providers**: Ollama (default), OpenAI, Cohere, and Voyage AI
|
|
15
16
|
- **Hybrid Search**: Combine semantic and keyword search for better results
|
|
16
17
|
- **Semantic Search**: Natural language search with metadata filtering
|
|
@@ -57,43 +58,34 @@ npm run build
|
|
|
57
58
|
|
|
58
59
|
#### Local Setup (stdio transport)
|
|
59
60
|
|
|
60
|
-
|
|
61
|
+
```bash
|
|
62
|
+
claude mcp add --transport stdio qdrant -- node /path/to/qdrant-mcp-server/build/index.js
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
Or add to `~/.claude.json`:
|
|
61
66
|
|
|
62
67
|
```json
|
|
63
68
|
{
|
|
64
69
|
"mcpServers": {
|
|
65
70
|
"qdrant": {
|
|
71
|
+
"type": "stdio",
|
|
66
72
|
"command": "node",
|
|
67
|
-
"args": ["/path/to/qdrant-mcp-server/build/index.js"]
|
|
68
|
-
"env": {
|
|
69
|
-
"QDRANT_URL": "http://localhost:6333",
|
|
70
|
-
"EMBEDDING_BASE_URL": "http://localhost:11434"
|
|
71
|
-
}
|
|
73
|
+
"args": ["/path/to/qdrant-mcp-server/build/index.js"]
|
|
72
74
|
}
|
|
73
75
|
}
|
|
74
76
|
}
|
|
75
77
|
```
|
|
76
78
|
|
|
77
|
-
|
|
79
|
+
For Qdrant Cloud or secured instances, add `--env QDRANT_API_KEY=your-key` or set in env config.
|
|
78
80
|
|
|
79
|
-
|
|
81
|
+
**Try it:**
|
|
80
82
|
|
|
81
|
-
```
|
|
82
|
-
|
|
83
|
-
"mcpServers": {
|
|
84
|
-
"qdrant": {
|
|
85
|
-
"command": "node",
|
|
86
|
-
"args": ["/path/to/qdrant-mcp-server/build/index.js"],
|
|
87
|
-
"env": {
|
|
88
|
-
"QDRANT_URL": "https://your-cluster.qdrant.io:6333",
|
|
89
|
-
"QDRANT_API_KEY": "your-api-key-here",
|
|
90
|
-
"EMBEDDING_BASE_URL": "http://localhost:11434"
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
}
|
|
83
|
+
```
|
|
84
|
+
Create a collection called "notes" and add a document about machine learning
|
|
95
85
|
```
|
|
96
86
|
|
|
87
|
+
**Enable example prompts:** Copy `prompts.example.json` to `prompts.json` and restart. Use `/prompt` to list available prompts.
|
|
88
|
+
|
|
97
89
|
#### Remote Setup (HTTP transport)
|
|
98
90
|
|
|
99
91
|
> **⚠️ Security Warning**: When deploying the HTTP transport in production:
|
|
@@ -111,12 +103,19 @@ For Qdrant Cloud or self-hosted instances with API key authentication:
|
|
|
111
103
|
TRANSPORT_MODE=http HTTP_PORT=3000 node build/index.js
|
|
112
104
|
```
|
|
113
105
|
|
|
114
|
-
**
|
|
106
|
+
**Option 1: Using `claude mcp add`**
|
|
107
|
+
|
|
108
|
+
```bash
|
|
109
|
+
claude mcp add --transport http qdrant http://your-server:3000/mcp
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
**Option 2: Add to `~/.claude.json`**
|
|
115
113
|
|
|
116
114
|
```json
|
|
117
115
|
{
|
|
118
116
|
"mcpServers": {
|
|
119
117
|
"qdrant": {
|
|
118
|
+
"type": "http",
|
|
120
119
|
"url": "http://your-server:3000/mcp"
|
|
121
120
|
}
|
|
122
121
|
}
|
|
@@ -177,6 +176,13 @@ See [Advanced Configuration](#advanced-configuration) section below for all opti
|
|
|
177
176
|
| `get_git_index_status` | Get indexing status and statistics for a repository's git history |
|
|
178
177
|
| `clear_git_index` | Delete all indexed git history data for a repository |
|
|
179
178
|
|
|
179
|
+
### Advanced Search
|
|
180
|
+
|
|
181
|
+
| Tool | Description |
|
|
182
|
+
| ------------------- | ----------------------------------------------------------------------------- |
|
|
183
|
+
| `contextual_search` | Combined code + git history search with file-commit correlations |
|
|
184
|
+
| `federated_search` | Search across multiple repositories with Reciprocal Rank Fusion (RRF) ranking |
|
|
185
|
+
|
|
180
186
|
### Resources
|
|
181
187
|
|
|
182
188
|
- `qdrant://collections` - List all collections
|
|
@@ -231,14 +237,18 @@ If you place `prompts.json` in the project root, no additional configuration is
|
|
|
231
237
|
|
|
232
238
|
See [`prompts.example.json`](prompts.example.json) for ready-to-use prompts including:
|
|
233
239
|
|
|
234
|
-
- `find_similar_docs` - Semantic search with result explanation
|
|
235
240
|
- `setup_rag_collection` - Create RAG-optimized collections
|
|
236
|
-
- `
|
|
237
|
-
- `
|
|
238
|
-
- `search_with_filter` - Metadata filtering assistance
|
|
239
|
-
- `compare_search_methods` - Semantic vs hybrid search comparison
|
|
240
|
-
- `collection_maintenance` - Maintenance and cleanup workflows
|
|
241
|
+
- `analyze_and_optimize` - Collection insights and recommendations
|
|
242
|
+
- `compare_search_strategies` - Semantic vs hybrid search comparison
|
|
241
243
|
- `migrate_to_hybrid` - Collection migration guide
|
|
244
|
+
- `debug_search_quality` - Troubleshoot poor search results
|
|
245
|
+
- `build_knowledge_base` - Structured documentation with metadata
|
|
246
|
+
- `index_git_history` - Index repository commit history for semantic search
|
|
247
|
+
- `search_project_history` - Search git history to understand feature implementations
|
|
248
|
+
- `investigate_code_with_history` - Deep dive into code with contextual search
|
|
249
|
+
- `cross_repo_search` - Search patterns across multiple repositories
|
|
250
|
+
- `trace_feature_evolution` - Track how features evolved over time
|
|
251
|
+
- `security_audit_search` - Find security-related code and fixes
|
|
242
252
|
|
|
243
253
|
### Template Syntax
|
|
244
254
|
|
|
@@ -484,6 +494,15 @@ Index and search your repository's git commit history using natural language. Pe
|
|
|
484
494
|
- **Learning from History**: "Show me examples of API endpoint implementations"
|
|
485
495
|
- **Code Archaeology**: "What changes were made to the payment system last year?"
|
|
486
496
|
|
|
497
|
+
## Advanced Search
|
|
498
|
+
|
|
499
|
+
Combine code and git history search for deeper codebase understanding. Requires repositories to be indexed with both `index_codebase` and `index_git_history` first.
|
|
500
|
+
|
|
501
|
+
- **Contextual Search**: Query code + git history together with automatic file-commit correlations
|
|
502
|
+
- **Federated Search**: Search across multiple repositories with RRF ranking
|
|
503
|
+
|
|
504
|
+
See **[Advanced Search Examples](examples/advanced-search/)** for detailed usage, workflows, and scenarios.
|
|
505
|
+
|
|
487
506
|
## Examples
|
|
488
507
|
|
|
489
508
|
See [examples/](examples/) directory for detailed guides:
|
|
@@ -494,6 +513,7 @@ See [examples/](examples/) directory for detailed guides:
|
|
|
494
513
|
- **[Advanced Filtering](examples/filters/)** - Complex boolean filters
|
|
495
514
|
- **[Rate Limiting](examples/rate-limiting/)** - Batch processing with cloud providers
|
|
496
515
|
- **[Code Search](examples/code-search/)** - Index codebases and semantic code search
|
|
516
|
+
- **[Advanced Search](examples/advanced-search/)** - Contextual and federated search across repositories
|
|
497
517
|
|
|
498
518
|
## Advanced Configuration
|
|
499
519
|
|
|
@@ -596,11 +616,12 @@ npm run test:coverage # Coverage report
|
|
|
596
616
|
|
|
597
617
|
### Testing
|
|
598
618
|
|
|
599
|
-
**
|
|
619
|
+
**748 tests** across 27 test files with **97%+ coverage**:
|
|
600
620
|
|
|
601
621
|
- **Unit Tests**: QdrantManager (56), Ollama (41), OpenAI (25), Cohere (29), Voyage (31), Factory (43), Prompts (50), Transport (15), MCP Server (19)
|
|
602
622
|
- **Integration Tests**: Code indexer (56), scanner (15), chunker (24), synchronizer (42), snapshot (26), merkle tree (28)
|
|
603
623
|
- **Git History Tests**: Git extractor (28), extractor integration (11), chunker (30), indexer (42), synchronizer (18)
|
|
624
|
+
- **Advanced Search Tests**: Federated tools (30) - normalizeScores, calculateRRFScore, buildCorrelations, contextual_search, federated_search
|
|
604
625
|
|
|
605
626
|
**CI/CD**: GitHub Actions runs build, type-check, and tests on Node.js 22.x and 24.x for every push/PR.
|
|
606
627
|
|
|
@@ -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,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACzD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAC3D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAOvD,MAAM,WAAW,yBAAyB;IACxC,WAAW,EAAE,WAAW,CAAC;IACzB,iBAAiB,EAAE,iBAAiB,CAAC;CACtC;AAED;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC,UAAU,EAAE,gBAAgB,CAAC;IAC7B,cAAc,EAAE,KAAK,CAAC;QACpB,SAAS,EAAE,MAAM,CAAC;QAClB,OAAO,EAAE,MAAM,CAAC;QAChB,MAAM,EAAE,MAAM,CAAC;QACf,IAAI,EAAE,MAAM,CAAC;KACd,CAAC,CAAC;CACJ;AAED;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACrC,WAAW,EAAE,gBAAgB,EAAE,CAAC;IAChC,UAAU,EAAE,eAAe,EAAE,CAAC;IAC9B,YAAY,EAAE,qBAAqB,EAAE,CAAC;IACtC,QAAQ,EAAE;QACR,IAAI,EAAE,MAAM,CAAC;QACb,KAAK,EAAE,MAAM,CAAC;QACd,eAAe,EAAE,MAAM,CAAC;QACxB,cAAc,EAAE,MAAM,CAAC;QACvB,gBAAgB,EAAE,MAAM,CAAC;KAC1B,CAAC;CACH;AAED;;GAEG;AACH,MAAM,MAAM,eAAe,GACvB,CAAC,gBAAgB,GAAG;IAAE,UAAU,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,CAAC,GAC7D,CAAC,eAAe,GAAG;IAAE,UAAU,EAAE,KAAK,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,CAAC,CAAC;AAEhE;;GAEG;AACH,MAAM,WAAW,uBAAuB;IACtC,OAAO,EAAE,eAAe,EAAE,CAAC;IAC3B,QAAQ,EAAE;QACR,KAAK,EAAE,MAAM,CAAC;QACd,UAAU,EAAE,MAAM,GAAG,KAAK,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"}
|