qdrant-loader-mcp-server 0.3.0b2__tar.gz
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.
- qdrant_loader_mcp_server-0.3.0b2/PKG-INFO +597 -0
- qdrant_loader_mcp_server-0.3.0b2/README.md +557 -0
- qdrant_loader_mcp_server-0.3.0b2/pyproject.toml +72 -0
- qdrant_loader_mcp_server-0.3.0b2/setup.cfg +4 -0
- qdrant_loader_mcp_server-0.3.0b2/src/qdrant_loader_mcp_server/__init__.py +0 -0
- qdrant_loader_mcp_server-0.3.0b2/src/qdrant_loader_mcp_server/__main__.py +6 -0
- qdrant_loader_mcp_server-0.3.0b2/src/qdrant_loader_mcp_server/cli.py +336 -0
- qdrant_loader_mcp_server-0.3.0b2/src/qdrant_loader_mcp_server/config.py +62 -0
- qdrant_loader_mcp_server-0.3.0b2/src/qdrant_loader_mcp_server/main.py +12 -0
- qdrant_loader_mcp_server-0.3.0b2/src/qdrant_loader_mcp_server/mcp/__init__.py +7 -0
- qdrant_loader_mcp_server-0.3.0b2/src/qdrant_loader_mcp_server/mcp/handler.py +348 -0
- qdrant_loader_mcp_server-0.3.0b2/src/qdrant_loader_mcp_server/mcp/models.py +23 -0
- qdrant_loader_mcp_server-0.3.0b2/src/qdrant_loader_mcp_server/mcp/protocol.py +164 -0
- qdrant_loader_mcp_server-0.3.0b2/src/qdrant_loader_mcp_server/search/__init__.py +1 -0
- qdrant_loader_mcp_server-0.3.0b2/src/qdrant_loader_mcp_server/search/engine.py +117 -0
- qdrant_loader_mcp_server-0.3.0b2/src/qdrant_loader_mcp_server/search/hybrid_search.py +325 -0
- qdrant_loader_mcp_server-0.3.0b2/src/qdrant_loader_mcp_server/search/models.py +15 -0
- qdrant_loader_mcp_server-0.3.0b2/src/qdrant_loader_mcp_server/search/processor.py +144 -0
- qdrant_loader_mcp_server-0.3.0b2/src/qdrant_loader_mcp_server/utils/__init__.py +5 -0
- qdrant_loader_mcp_server-0.3.0b2/src/qdrant_loader_mcp_server/utils/logging.py +174 -0
- qdrant_loader_mcp_server-0.3.0b2/src/qdrant_loader_mcp_server.egg-info/PKG-INFO +597 -0
- qdrant_loader_mcp_server-0.3.0b2/src/qdrant_loader_mcp_server.egg-info/SOURCES.txt +24 -0
- qdrant_loader_mcp_server-0.3.0b2/src/qdrant_loader_mcp_server.egg-info/dependency_links.txt +1 -0
- qdrant_loader_mcp_server-0.3.0b2/src/qdrant_loader_mcp_server.egg-info/entry_points.txt +2 -0
- qdrant_loader_mcp_server-0.3.0b2/src/qdrant_loader_mcp_server.egg-info/requires.txt +22 -0
- qdrant_loader_mcp_server-0.3.0b2/src/qdrant_loader_mcp_server.egg-info/top_level.txt +1 -0
|
@@ -0,0 +1,597 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: qdrant-loader-mcp-server
|
|
3
|
+
Version: 0.3.0b2
|
|
4
|
+
Summary: A Model Context Protocol (MCP) server that provides RAG capabilities to Cursor using Qdrant.
|
|
5
|
+
Author-email: Martin Papy <martin.papy@gmail.com>
|
|
6
|
+
License-Expression: GPL-3.0
|
|
7
|
+
Project-URL: Documentation, https://github.com/martin-papy/qdrant-loader#readme
|
|
8
|
+
Project-URL: Repository, https://github.com/martin-papy/qdrant-loader
|
|
9
|
+
Project-URL: Issues, https://github.com/martin-papy/qdrant-loader/issues
|
|
10
|
+
Keywords: qdrant,vector-database,mcp,cursor,rag,embeddings
|
|
11
|
+
Classifier: Development Status :: 3 - Alpha
|
|
12
|
+
Classifier: Intended Audience :: Developers
|
|
13
|
+
Classifier: Operating System :: OS Independent
|
|
14
|
+
Classifier: Programming Language :: Python :: 3
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
17
|
+
Requires-Python: >=3.12
|
|
18
|
+
Description-Content-Type: text/markdown
|
|
19
|
+
Requires-Dist: fastapi>=0.104.0
|
|
20
|
+
Requires-Dist: uvicorn>=0.24.0
|
|
21
|
+
Requires-Dist: qdrant-client>=1.6.0
|
|
22
|
+
Requires-Dist: openai>=1.3.0
|
|
23
|
+
Requires-Dist: pydantic>=2.4.2
|
|
24
|
+
Requires-Dist: python-dotenv>=1.0.0
|
|
25
|
+
Requires-Dist: jsonrpcclient>=4.0.3
|
|
26
|
+
Requires-Dist: jsonrpcserver>=5.0.7
|
|
27
|
+
Requires-Dist: structlog>=23.0.0
|
|
28
|
+
Requires-Dist: PyYAML>=6.0.0
|
|
29
|
+
Requires-Dist: rank-bm25>=0.2.2
|
|
30
|
+
Requires-Dist: numpy>=1.26.0
|
|
31
|
+
Requires-Dist: click>=8.0.0
|
|
32
|
+
Requires-Dist: tomli>=2.0.0
|
|
33
|
+
Requires-Dist: qdrant-loader
|
|
34
|
+
Provides-Extra: dev
|
|
35
|
+
Requires-Dist: pytest>=7.4.3; extra == "dev"
|
|
36
|
+
Requires-Dist: pytest-asyncio>=0.21.1; extra == "dev"
|
|
37
|
+
Requires-Dist: pytest-cov>=4.1.0; extra == "dev"
|
|
38
|
+
Requires-Dist: pytest-mock>=3.12.0; extra == "dev"
|
|
39
|
+
Requires-Dist: pre-commit>=3.5.0; extra == "dev"
|
|
40
|
+
|
|
41
|
+
# QDrant Loader MCP Server
|
|
42
|
+
|
|
43
|
+
A Model Context Protocol (MCP) server that provides Retrieval-Augmented Generation (RAG) capabilities to AI development tools like Cursor, Windsurf, and other LLM applications. Part of the QDrant Loader monorepo ecosystem.
|
|
44
|
+
|
|
45
|
+
## 🚀 Features
|
|
46
|
+
|
|
47
|
+
### Core Capabilities
|
|
48
|
+
|
|
49
|
+
- **MCP Protocol Implementation**: Full compliance with MCP 2024-11-05 specification
|
|
50
|
+
- **Semantic Search**: Advanced vector search across multiple data sources
|
|
51
|
+
- **Real-time Processing**: Streaming responses for large result sets
|
|
52
|
+
- **Multi-source Integration**: Search across Git, Confluence, Jira, documentation, and local file sources
|
|
53
|
+
- **Local File Support**: Index and search local files with configurable filtering and file type support
|
|
54
|
+
- **Natural Language Queries**: Intelligent query processing and expansion
|
|
55
|
+
|
|
56
|
+
### Advanced Features
|
|
57
|
+
|
|
58
|
+
- **Hybrid Search**: Combines semantic and keyword search for optimal results
|
|
59
|
+
- **Source Filtering**: Filter results by source type, project, or metadata
|
|
60
|
+
- **Result Ranking**: Intelligent ranking based on relevance and recency
|
|
61
|
+
- **Caching**: Optimized caching for frequently accessed content
|
|
62
|
+
- **Error Recovery**: Robust error handling and graceful degradation
|
|
63
|
+
|
|
64
|
+
## 🔌 Integration Support
|
|
65
|
+
|
|
66
|
+
| Tool | Status | Features |
|
|
67
|
+
|------|--------|----------|
|
|
68
|
+
| **Cursor** | ✅ Full Support | Context-aware code assistance, documentation lookup |
|
|
69
|
+
| **Windsurf** | ✅ Compatible | MCP protocol integration |
|
|
70
|
+
| **Claude Desktop** | ✅ Compatible | Direct MCP integration |
|
|
71
|
+
| **Custom Tools** | ✅ RESTful API | HTTP endpoints for custom integrations |
|
|
72
|
+
|
|
73
|
+
## 📦 Installation
|
|
74
|
+
|
|
75
|
+
### From PyPI (Recommended)
|
|
76
|
+
|
|
77
|
+
```bash
|
|
78
|
+
pip install qdrant-loader-mcp-server
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
### From Source (Development)
|
|
82
|
+
|
|
83
|
+
```bash
|
|
84
|
+
# Clone the monorepo
|
|
85
|
+
git clone https://github.com/martin-papy/qdrant-loader.git
|
|
86
|
+
cd qdrant-loader
|
|
87
|
+
|
|
88
|
+
# Install in development mode
|
|
89
|
+
pip install -e packages/qdrant-loader-mcp-server[dev]
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
### With QDrant Loader
|
|
93
|
+
|
|
94
|
+
For a complete RAG pipeline:
|
|
95
|
+
|
|
96
|
+
```bash
|
|
97
|
+
# Install both packages
|
|
98
|
+
pip install qdrant-loader qdrant-loader-mcp-server
|
|
99
|
+
|
|
100
|
+
# Or from source
|
|
101
|
+
pip install -e packages/qdrant-loader[dev]
|
|
102
|
+
pip install -e packages/qdrant-loader-mcp-server[dev]
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
## ⚡ Quick Start
|
|
106
|
+
|
|
107
|
+
### 1. Environment Setup
|
|
108
|
+
|
|
109
|
+
```bash
|
|
110
|
+
# Required environment variables
|
|
111
|
+
export QDRANT_URL="http://localhost:6333" # or your QDrant Cloud URL
|
|
112
|
+
export QDRANT_API_KEY="your_api_key" # Required for cloud, optional for local
|
|
113
|
+
export OPENAI_API_KEY="your_openai_key" # For embeddings
|
|
114
|
+
|
|
115
|
+
# Optional configuration
|
|
116
|
+
export QDRANT_COLLECTION_NAME="my_collection" # Default: "documents"
|
|
117
|
+
|
|
118
|
+
# Optional MCP logging configuration
|
|
119
|
+
export MCP_LOG_LEVEL="INFO" # Default: INFO
|
|
120
|
+
export MCP_LOG_FILE="/path/to/logs/mcp.log" # Recommended: log to file
|
|
121
|
+
export MCP_DISABLE_CONSOLE_LOGGING="true" # Recommended: true for Cursor
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
### 2. Start the Server
|
|
125
|
+
|
|
126
|
+
```bash
|
|
127
|
+
# Start MCP server
|
|
128
|
+
mcp-qdrant-loader
|
|
129
|
+
|
|
130
|
+
# Show help and available options
|
|
131
|
+
mcp-qdrant-loader --help
|
|
132
|
+
|
|
133
|
+
# Show version information
|
|
134
|
+
mcp-qdrant-loader --version
|
|
135
|
+
|
|
136
|
+
# With debug logging
|
|
137
|
+
mcp-qdrant-loader --log-level DEBUG
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
### 3. Test the Server
|
|
141
|
+
|
|
142
|
+
```bash
|
|
143
|
+
# Test the MCP server with a manual JSON-RPC call
|
|
144
|
+
echo '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"search","arguments":{"query":"test","limit":1}}}' | mcp-qdrant-loader
|
|
145
|
+
|
|
146
|
+
# The server communicates via stdio (JSON-RPC), not HTTP
|
|
147
|
+
# For integration testing, use it with Cursor or other MCP clients
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
## 🔧 Configuration
|
|
151
|
+
|
|
152
|
+
### Environment Variables
|
|
153
|
+
|
|
154
|
+
| Variable | Description | Default | Required |
|
|
155
|
+
|----------|-------------|---------|----------|
|
|
156
|
+
| `QDRANT_URL` | QDrant instance URL | `http://localhost:6333` | Yes |
|
|
157
|
+
| `QDRANT_API_KEY` | QDrant API key | None | Cloud only |
|
|
158
|
+
| `QDRANT_COLLECTION_NAME` | Collection name | `documents` | No |
|
|
159
|
+
| `OPENAI_API_KEY` | OpenAI API key | None | Yes |
|
|
160
|
+
| `MCP_LOG_LEVEL` | MCP-specific log level | `INFO` | No |
|
|
161
|
+
| `MCP_LOG_FILE` | Path to MCP log file | None | No |
|
|
162
|
+
| `MCP_DISABLE_CONSOLE_LOGGING` | Disable console logging | `false` | **Yes for Cursor** |
|
|
163
|
+
|
|
164
|
+
### Configuration via Environment Variables
|
|
165
|
+
|
|
166
|
+
The MCP server is configured entirely through environment variables. Configuration files are not currently supported.
|
|
167
|
+
|
|
168
|
+
**Important Notes:**
|
|
169
|
+
|
|
170
|
+
- The `--config` CLI option exists but is not yet implemented. All configuration must be done via environment variables as shown in the table above.
|
|
171
|
+
- **For Cursor Integration**: Set `MCP_DISABLE_CONSOLE_LOGGING=true` to prevent console output from interfering with JSON-RPC communication over stdio.
|
|
172
|
+
- **For Debugging**: Use `MCP_LOG_FILE` to write logs to a file when console logging is disabled.
|
|
173
|
+
|
|
174
|
+
## 🎯 Usage Examples
|
|
175
|
+
|
|
176
|
+
### Cursor Integration
|
|
177
|
+
|
|
178
|
+
Add to your Cursor MCP configuration (`.cursor/mcp.json`):
|
|
179
|
+
|
|
180
|
+
```json
|
|
181
|
+
{
|
|
182
|
+
"mcpServers": {
|
|
183
|
+
"mcp-qdrant-loader": {
|
|
184
|
+
"command": "/path/to/your/venv/bin/mcp-qdrant-loader",
|
|
185
|
+
"args": [],
|
|
186
|
+
"env": {
|
|
187
|
+
"QDRANT_URL": "https://your-cluster.gcp.cloud.qdrant.io",
|
|
188
|
+
"QDRANT_API_KEY": "your_qdrant_api_key",
|
|
189
|
+
"OPENAI_API_KEY": "sk-proj-your_openai_api_key",
|
|
190
|
+
"QDRANT_COLLECTION_NAME": "your_collection_name",
|
|
191
|
+
"MCP_LOG_LEVEL": "INFO",
|
|
192
|
+
"MCP_LOG_FILE": "/path/to/logs/mcp.log",
|
|
193
|
+
"MCP_DISABLE_CONSOLE_LOGGING": "true"
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
**Important Configuration Notes:**
|
|
201
|
+
|
|
202
|
+
- **`command`**: Use the full path to your virtual environment's `mcp-qdrant-loader` executable
|
|
203
|
+
- **`QDRANT_URL`**: Your QDrant instance URL (local or cloud)
|
|
204
|
+
- **`QDRANT_API_KEY`**: Required for QDrant Cloud, optional for local instances
|
|
205
|
+
- **`OPENAI_API_KEY`**: Valid OpenAI API key for embeddings (starts with `sk-proj-` for project keys)
|
|
206
|
+
- **`QDRANT_COLLECTION_NAME`**: Name of your QDrant collection containing the data
|
|
207
|
+
- **`MCP_LOG_LEVEL`**: Set logging level (DEBUG, INFO, WARNING, ERROR, CRITICAL)
|
|
208
|
+
- **`MCP_LOG_FILE`**: Path where MCP server logs will be written (helpful for debugging)
|
|
209
|
+
- **`MCP_DISABLE_CONSOLE_LOGGING`**: Set to "true" to disable console output and only log to file
|
|
210
|
+
|
|
211
|
+
**Example with Local QDrant:**
|
|
212
|
+
|
|
213
|
+
```json
|
|
214
|
+
{
|
|
215
|
+
"mcpServers": {
|
|
216
|
+
"mcp-qdrant-loader": {
|
|
217
|
+
"command": "/Users/yourname/project/venv/bin/mcp-qdrant-loader",
|
|
218
|
+
"args": [],
|
|
219
|
+
"env": {
|
|
220
|
+
"QDRANT_URL": "http://localhost:6333",
|
|
221
|
+
"OPENAI_API_KEY": "sk-proj-your_openai_api_key",
|
|
222
|
+
"QDRANT_COLLECTION_NAME": "documents",
|
|
223
|
+
"MCP_LOG_LEVEL": "INFO",
|
|
224
|
+
"MCP_LOG_FILE": "/Users/yourname/project/logs/mcp.log",
|
|
225
|
+
"MCP_DISABLE_CONSOLE_LOGGING":"true"
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
```
|
|
231
|
+
|
|
232
|
+
### Manual MCP Testing
|
|
233
|
+
|
|
234
|
+
```bash
|
|
235
|
+
# Basic search via JSON-RPC
|
|
236
|
+
echo '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"search","arguments":{"query":"How to implement authentication?","limit":5}}}' | mcp-qdrant-loader
|
|
237
|
+
|
|
238
|
+
# Filtered search
|
|
239
|
+
echo '{"jsonrpc":"2.0","id":2,"method":"tools/call","params":{"name":"search","arguments":{"query":"database migration","source_types":["git","confluence"],"limit":10}}}' | mcp-qdrant-loader
|
|
240
|
+
|
|
241
|
+
# Search local files
|
|
242
|
+
echo '{"jsonrpc":"2.0","id":3,"method":"tools/call","params":{"name":"search","arguments":{"query":"configuration files","source_types":["localfile"],"limit":5}}}' | mcp-qdrant-loader
|
|
243
|
+
|
|
244
|
+
# Note: The server communicates via JSON-RPC over stdio, not HTTP
|
|
245
|
+
# For normal usage, integrate with Cursor or other MCP-compatible tools
|
|
246
|
+
```
|
|
247
|
+
|
|
248
|
+
### MCP Protocol Usage
|
|
249
|
+
|
|
250
|
+
The server communicates via JSON-RPC over stdio. Here's how to integrate it programmatically:
|
|
251
|
+
|
|
252
|
+
```python
|
|
253
|
+
import asyncio
|
|
254
|
+
import json
|
|
255
|
+
import subprocess
|
|
256
|
+
|
|
257
|
+
async def search_via_mcp(query: str, limit: int = 5):
|
|
258
|
+
"""Search using the MCP server via subprocess."""
|
|
259
|
+
# Prepare the JSON-RPC request
|
|
260
|
+
request = {
|
|
261
|
+
"jsonrpc": "2.0",
|
|
262
|
+
"id": 1,
|
|
263
|
+
"method": "tools/call",
|
|
264
|
+
"params": {
|
|
265
|
+
"name": "search",
|
|
266
|
+
"arguments": {
|
|
267
|
+
"query": query,
|
|
268
|
+
"limit": limit
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
# Call the MCP server
|
|
274
|
+
process = subprocess.Popen(
|
|
275
|
+
["mcp-qdrant-loader"],
|
|
276
|
+
stdin=subprocess.PIPE,
|
|
277
|
+
stdout=subprocess.PIPE,
|
|
278
|
+
stderr=subprocess.PIPE,
|
|
279
|
+
text=True
|
|
280
|
+
)
|
|
281
|
+
|
|
282
|
+
stdout, stderr = process.communicate(json.dumps(request))
|
|
283
|
+
|
|
284
|
+
if process.returncode == 0:
|
|
285
|
+
response = json.loads(stdout)
|
|
286
|
+
return response.get("result", [])
|
|
287
|
+
else:
|
|
288
|
+
raise Exception(f"MCP server error: {stderr}")
|
|
289
|
+
|
|
290
|
+
# Example usage
|
|
291
|
+
async def main():
|
|
292
|
+
results = await search_via_mcp("authentication implementation", limit=3)
|
|
293
|
+
for result in results:
|
|
294
|
+
print(f"Title: {result.get('title', 'N/A')}")
|
|
295
|
+
print(f"Source: {result.get('source', 'N/A')}")
|
|
296
|
+
print(f"Content: {result.get('content', '')[:200]}...")
|
|
297
|
+
print("---")
|
|
298
|
+
|
|
299
|
+
# Run the search
|
|
300
|
+
asyncio.run(main())
|
|
301
|
+
```
|
|
302
|
+
|
|
303
|
+
## 🛠️ API Reference
|
|
304
|
+
|
|
305
|
+
### MCP Tools
|
|
306
|
+
|
|
307
|
+
#### search
|
|
308
|
+
|
|
309
|
+
Perform semantic search across data sources.
|
|
310
|
+
|
|
311
|
+
**Parameters:**
|
|
312
|
+
|
|
313
|
+
- `query` (string): Natural language search query
|
|
314
|
+
- `source_types` (array, optional): Filter by source types (`git`, `confluence`, `jira`, `documentation`, `localfile`)
|
|
315
|
+
- `limit` (integer, optional): Maximum number of results (default: 10, max: 100)
|
|
316
|
+
- `filters` (object, optional): Additional metadata filters
|
|
317
|
+
|
|
318
|
+
**Response:**
|
|
319
|
+
|
|
320
|
+
```json
|
|
321
|
+
{
|
|
322
|
+
"results": [
|
|
323
|
+
{
|
|
324
|
+
"id": "doc_123",
|
|
325
|
+
"title": "Authentication Guide",
|
|
326
|
+
"content": "Complete guide to implementing authentication...",
|
|
327
|
+
"source": "backend-docs",
|
|
328
|
+
"source_type": "confluence",
|
|
329
|
+
"url": "https://docs.company.com/auth",
|
|
330
|
+
"score": 0.95,
|
|
331
|
+
"metadata": {
|
|
332
|
+
"author": "john.doe",
|
|
333
|
+
"created_at": "2024-01-15T10:30:00Z",
|
|
334
|
+
"updated_at": "2024-01-20T14:45:00Z"
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
],
|
|
338
|
+
"total": 1,
|
|
339
|
+
"query_time": 0.123
|
|
340
|
+
}
|
|
341
|
+
```
|
|
342
|
+
|
|
343
|
+
### JSON-RPC Methods
|
|
344
|
+
|
|
345
|
+
The server supports these JSON-RPC methods over stdio:
|
|
346
|
+
|
|
347
|
+
#### tools/list
|
|
348
|
+
|
|
349
|
+
List available tools.
|
|
350
|
+
|
|
351
|
+
#### tools/call
|
|
352
|
+
|
|
353
|
+
Call a specific tool (currently only "search" is available).
|
|
354
|
+
|
|
355
|
+
#### initialize
|
|
356
|
+
|
|
357
|
+
Initialize the MCP session.
|
|
358
|
+
|
|
359
|
+
**Note**: The server does not provide HTTP/REST endpoints. All communication is via JSON-RPC over stdio.
|
|
360
|
+
|
|
361
|
+
## 🔍 Advanced Features
|
|
362
|
+
|
|
363
|
+
### Hybrid Search
|
|
364
|
+
|
|
365
|
+
The server automatically combines semantic vector search with keyword matching for optimal results. This feature is always enabled and does not require configuration.
|
|
366
|
+
|
|
367
|
+
### Query Expansion
|
|
368
|
+
|
|
369
|
+
Automatically expands queries with related terms:
|
|
370
|
+
|
|
371
|
+
```python
|
|
372
|
+
# Original query: "auth"
|
|
373
|
+
# Expanded query: "authentication authorization login security"
|
|
374
|
+
```
|
|
375
|
+
|
|
376
|
+
### Result Caching
|
|
377
|
+
|
|
378
|
+
The server includes built-in caching for improved performance. Caching is automatically enabled and optimized for typical usage patterns.
|
|
379
|
+
|
|
380
|
+
## 🧪 Development
|
|
381
|
+
|
|
382
|
+
### Setup Development Environment
|
|
383
|
+
|
|
384
|
+
```bash
|
|
385
|
+
# Clone and setup
|
|
386
|
+
git clone https://github.com/martin-papy/qdrant-loader.git
|
|
387
|
+
cd qdrant-loader
|
|
388
|
+
|
|
389
|
+
# Create virtual environment
|
|
390
|
+
python -m venv venv
|
|
391
|
+
source venv/bin/activate # On Windows: venv\Scripts\activate
|
|
392
|
+
|
|
393
|
+
# Install development dependencies
|
|
394
|
+
pip install -e packages/qdrant-loader-mcp-server[dev]
|
|
395
|
+
|
|
396
|
+
# Run tests
|
|
397
|
+
pytest packages/qdrant-loader-mcp-server/tests/
|
|
398
|
+
```
|
|
399
|
+
|
|
400
|
+
### Testing
|
|
401
|
+
|
|
402
|
+
```bash
|
|
403
|
+
# Run all tests
|
|
404
|
+
pytest packages/qdrant-loader-mcp-server/tests/
|
|
405
|
+
|
|
406
|
+
# Run with coverage
|
|
407
|
+
pytest --cov=qdrant_loader_mcp_server packages/qdrant-loader-mcp-server/tests/
|
|
408
|
+
|
|
409
|
+
# Run specific test categories
|
|
410
|
+
pytest packages/qdrant-loader-mcp-server/tests/unit/
|
|
411
|
+
pytest packages/qdrant-loader-mcp-server/tests/integration/
|
|
412
|
+
```
|
|
413
|
+
|
|
414
|
+
### Development Server
|
|
415
|
+
|
|
416
|
+
```bash
|
|
417
|
+
# Start development server with auto-reload
|
|
418
|
+
mcp-qdrant-loader --dev --reload
|
|
419
|
+
|
|
420
|
+
# Run with debug logging
|
|
421
|
+
mcp-qdrant-loader --log-level DEBUG
|
|
422
|
+
```
|
|
423
|
+
|
|
424
|
+
## 🔗 Integration Examples
|
|
425
|
+
|
|
426
|
+
### Complete RAG Workflow
|
|
427
|
+
|
|
428
|
+
```bash
|
|
429
|
+
# 1. Load data with qdrant-loader
|
|
430
|
+
qdrant-loader init
|
|
431
|
+
qdrant-loader ingest --source-type git --source my-repo
|
|
432
|
+
qdrant-loader ingest --source-type confluence --source tech-docs
|
|
433
|
+
qdrant-loader ingest --source-type localfile --source /path/to/local/files
|
|
434
|
+
|
|
435
|
+
# 2. Start MCP server
|
|
436
|
+
mcp-qdrant-loader
|
|
437
|
+
|
|
438
|
+
# 3. Use in Cursor for AI-powered development
|
|
439
|
+
# The server provides context to Cursor's AI assistant
|
|
440
|
+
```
|
|
441
|
+
|
|
442
|
+
### Custom Integration
|
|
443
|
+
|
|
444
|
+
```python
|
|
445
|
+
import json
|
|
446
|
+
import subprocess
|
|
447
|
+
|
|
448
|
+
class MCPRAGClient:
|
|
449
|
+
def __init__(self, mcp_command="mcp-qdrant-loader"):
|
|
450
|
+
self.mcp_command = mcp_command
|
|
451
|
+
|
|
452
|
+
def search(self, query, **kwargs):
|
|
453
|
+
"""Search using the MCP server."""
|
|
454
|
+
request = {
|
|
455
|
+
"jsonrpc": "2.0",
|
|
456
|
+
"id": 1,
|
|
457
|
+
"method": "tools/call",
|
|
458
|
+
"params": {
|
|
459
|
+
"name": "search",
|
|
460
|
+
"arguments": {"query": query, **kwargs}
|
|
461
|
+
}
|
|
462
|
+
}
|
|
463
|
+
|
|
464
|
+
process = subprocess.Popen(
|
|
465
|
+
[self.mcp_command],
|
|
466
|
+
stdin=subprocess.PIPE,
|
|
467
|
+
stdout=subprocess.PIPE,
|
|
468
|
+
stderr=subprocess.PIPE,
|
|
469
|
+
text=True
|
|
470
|
+
)
|
|
471
|
+
|
|
472
|
+
stdout, stderr = process.communicate(json.dumps(request))
|
|
473
|
+
|
|
474
|
+
if process.returncode == 0:
|
|
475
|
+
response = json.loads(stdout)
|
|
476
|
+
return response.get("result", [])
|
|
477
|
+
else:
|
|
478
|
+
raise Exception(f"MCP server error: {stderr}")
|
|
479
|
+
|
|
480
|
+
def get_context(self, query, max_tokens=4000):
|
|
481
|
+
"""Get context from search results."""
|
|
482
|
+
results = self.search(query, limit=10)
|
|
483
|
+
context = ""
|
|
484
|
+
for result in results:
|
|
485
|
+
content = f"{result.get('title', '')}\n{result.get('content', '')}\n\n"
|
|
486
|
+
if len(context) + len(content) < max_tokens:
|
|
487
|
+
context += content
|
|
488
|
+
else:
|
|
489
|
+
break
|
|
490
|
+
return context
|
|
491
|
+
|
|
492
|
+
# Usage
|
|
493
|
+
client = MCPRAGClient()
|
|
494
|
+
context = client.get_context("How to implement caching?")
|
|
495
|
+
print(context)
|
|
496
|
+
```
|
|
497
|
+
|
|
498
|
+
## 📋 Requirements
|
|
499
|
+
|
|
500
|
+
- **Python**: 3.12 or higher
|
|
501
|
+
- **QDrant**: Local instance or QDrant Cloud with data loaded
|
|
502
|
+
- **Memory**: Minimum 2GB RAM for basic operation
|
|
503
|
+
- **Network**: Internet access for embedding API calls
|
|
504
|
+
- **Storage**: Minimal local storage for caching
|
|
505
|
+
|
|
506
|
+
## 🤝 Contributing
|
|
507
|
+
|
|
508
|
+
We welcome contributions! See the [Contributing Guide](../../docs/CONTRIBUTING.md) for details.
|
|
509
|
+
|
|
510
|
+
### Development Workflow
|
|
511
|
+
|
|
512
|
+
1. Fork the repository
|
|
513
|
+
2. Create a feature branch
|
|
514
|
+
3. Make changes in `packages/qdrant-loader-mcp-server/`
|
|
515
|
+
4. Add tests and documentation
|
|
516
|
+
5. Submit a pull request
|
|
517
|
+
|
|
518
|
+
## 📄 License
|
|
519
|
+
|
|
520
|
+
This project is licensed under the GNU General Public License v3.0 - see the [LICENSE](../../LICENSE) file for details.
|
|
521
|
+
|
|
522
|
+
## 🔧 Troubleshooting
|
|
523
|
+
|
|
524
|
+
### Common Issues
|
|
525
|
+
|
|
526
|
+
#### MCP Tool Not Working in Cursor
|
|
527
|
+
|
|
528
|
+
If the MCP search tool returns errors or no results:
|
|
529
|
+
|
|
530
|
+
1. **Disable Console Logging**: Console output can interfere with JSON-RPC communication. Always set `MCP_DISABLE_CONSOLE_LOGGING=true` for Cursor.
|
|
531
|
+
2. **Check API Keys**: Ensure your OpenAI API key is valid and has sufficient credits
|
|
532
|
+
3. **Enable File Logging**: Add logging configuration to your `.cursor/mcp.json`:
|
|
533
|
+
|
|
534
|
+
```json
|
|
535
|
+
"env": {
|
|
536
|
+
"MCP_LOG_LEVEL": "DEBUG",
|
|
537
|
+
"MCP_LOG_FILE": "/path/to/logs/mcp.log",
|
|
538
|
+
"MCP_DISABLE_CONSOLE_LOGGING": "true"
|
|
539
|
+
}
|
|
540
|
+
```
|
|
541
|
+
|
|
542
|
+
4. **Check Logs**: Monitor the log file for errors:
|
|
543
|
+
|
|
544
|
+
```bash
|
|
545
|
+
tail -f /path/to/logs/mcp.log
|
|
546
|
+
```
|
|
547
|
+
|
|
548
|
+
5. **Verify Collection**: Ensure your QDrant collection exists and contains data
|
|
549
|
+
6. **Test Manually**: Test the server directly:
|
|
550
|
+
|
|
551
|
+
```bash
|
|
552
|
+
echo '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"search","arguments":{"query":"test","limit":1}}}' | /path/to/venv/bin/mcp-qdrant-loader
|
|
553
|
+
```
|
|
554
|
+
|
|
555
|
+
#### Authentication Errors
|
|
556
|
+
|
|
557
|
+
- **OpenAI 401 Error**: Invalid or expired OpenAI API key
|
|
558
|
+
- **QDrant Connection Error**: Check QDrant URL and API key
|
|
559
|
+
- **Collection Not Found**: Verify collection name matches your data
|
|
560
|
+
|
|
561
|
+
#### Performance Issues
|
|
562
|
+
|
|
563
|
+
- **Slow Responses**: Increase QDrant timeout or reduce search limit
|
|
564
|
+
- **Memory Usage**: Monitor memory usage with large collections
|
|
565
|
+
- **Network Latency**: Use QDrant Cloud regions close to your location
|
|
566
|
+
|
|
567
|
+
### Debug Mode
|
|
568
|
+
|
|
569
|
+
Enable debug logging for detailed troubleshooting:
|
|
570
|
+
|
|
571
|
+
```json
|
|
572
|
+
{
|
|
573
|
+
"mcpServers": {
|
|
574
|
+
"mcp-qdrant-loader": {
|
|
575
|
+
"command": "/path/to/venv/bin/mcp-qdrant-loader",
|
|
576
|
+
"args": ["--log-level", "DEBUG"],
|
|
577
|
+
"env": {
|
|
578
|
+
"MCP_LOG_LEVEL": "DEBUG",
|
|
579
|
+
"MCP_LOG_FILE": "/tmp/mcp-debug.log"
|
|
580
|
+
}
|
|
581
|
+
}
|
|
582
|
+
}
|
|
583
|
+
}
|
|
584
|
+
```
|
|
585
|
+
|
|
586
|
+
## 🆘 Support
|
|
587
|
+
|
|
588
|
+
- **Issues**: [GitHub Issues](https://github.com/martin-papy/qdrant-loader/issues)
|
|
589
|
+
- **Discussions**: [GitHub Discussions](https://github.com/martin-papy/qdrant-loader/discussions)
|
|
590
|
+
- **Documentation**: [Project Documentation](../../docs/)
|
|
591
|
+
|
|
592
|
+
## 🔄 Related Projects
|
|
593
|
+
|
|
594
|
+
- [qdrant-loader](../qdrant-loader/): Data ingestion and processing
|
|
595
|
+
- [QDrant](https://qdrant.tech/): Vector database engine
|
|
596
|
+
- [Model Context Protocol](https://modelcontextprotocol.io/): AI integration standard
|
|
597
|
+
- [Cursor](https://cursor.sh/): AI-powered code editor
|