qdrant-mcp-server 0.1.0__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_mcp_server-0.1.0/LICENSE +21 -0
- qdrant_mcp_server-0.1.0/PKG-INFO +302 -0
- qdrant_mcp_server-0.1.0/README.md +268 -0
- qdrant_mcp_server-0.1.0/pyproject.toml +61 -0
- qdrant_mcp_server-0.1.0/setup.cfg +4 -0
- qdrant_mcp_server-0.1.0/src/qdrant_mcp_server/__init__.py +20 -0
- qdrant_mcp_server-0.1.0/src/qdrant_mcp_server/__main__.py +47 -0
- qdrant_mcp_server-0.1.0/src/qdrant_mcp_server/py.typed +0 -0
- qdrant_mcp_server-0.1.0/src/qdrant_mcp_server/server.py +607 -0
- qdrant_mcp_server-0.1.0/src/qdrant_mcp_server.egg-info/PKG-INFO +302 -0
- qdrant_mcp_server-0.1.0/src/qdrant_mcp_server.egg-info/SOURCES.txt +13 -0
- qdrant_mcp_server-0.1.0/src/qdrant_mcp_server.egg-info/dependency_links.txt +1 -0
- qdrant_mcp_server-0.1.0/src/qdrant_mcp_server.egg-info/entry_points.txt +2 -0
- qdrant_mcp_server-0.1.0/src/qdrant_mcp_server.egg-info/requires.txt +10 -0
- qdrant_mcp_server-0.1.0/src/qdrant_mcp_server.egg-info/top_level.txt +1 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 fiyen
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,302 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: qdrant-mcp-server
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: A Model Context Protocol (MCP) server for Qdrant vector database with semantic search capabilities
|
|
5
|
+
Author-email: fiyen <623320480@qq.com>
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/fiyen/qdrant-mcp-server
|
|
8
|
+
Project-URL: Repository, https://github.com/fiyen/qdrant-mcp-server
|
|
9
|
+
Project-URL: Documentation, https://github.com/fiyen/qdrant-mcp-server#readme
|
|
10
|
+
Project-URL: Bug Tracker, https://github.com/fiyen/qdrant-mcp-server/issues
|
|
11
|
+
Keywords: mcp,qdrant,vector-database,semantic-search,embeddings,ai
|
|
12
|
+
Classifier: Development Status :: 4 - Beta
|
|
13
|
+
Classifier: Intended Audience :: Developers
|
|
14
|
+
Classifier: Programming Language :: Python :: 3
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
19
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
20
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
21
|
+
Requires-Python: >=3.10
|
|
22
|
+
Description-Content-Type: text/markdown
|
|
23
|
+
License-File: LICENSE
|
|
24
|
+
Requires-Dist: mcp>=1.0.0
|
|
25
|
+
Requires-Dist: httpx>=0.27.0
|
|
26
|
+
Requires-Dist: sentence-transformers>=2.2.0
|
|
27
|
+
Requires-Dist: python-dotenv>=1.0.0
|
|
28
|
+
Provides-Extra: dev
|
|
29
|
+
Requires-Dist: pytest>=7.0.0; extra == "dev"
|
|
30
|
+
Requires-Dist: pytest-asyncio>=0.21.0; extra == "dev"
|
|
31
|
+
Requires-Dist: black>=23.0.0; extra == "dev"
|
|
32
|
+
Requires-Dist: ruff>=0.1.0; extra == "dev"
|
|
33
|
+
Dynamic: license-file
|
|
34
|
+
|
|
35
|
+
# Qdrant MCP Server
|
|
36
|
+
|
|
37
|
+
[](https://badge.fury.io/py/qdrant-mcp-server)
|
|
38
|
+
[](https://www.python.org/downloads/)
|
|
39
|
+
[](https://opensource.org/licenses/MIT)
|
|
40
|
+
|
|
41
|
+
一个基于 [Qdrant](https://qdrant.tech/) 向量数据库的 [Model Context Protocol (MCP)](https://modelcontextprotocol.io/) 服务器,提供强大的语义搜索和知识管理功能。
|
|
42
|
+
|
|
43
|
+
## ✨ 特性
|
|
44
|
+
|
|
45
|
+
- 🚀 **即插即用**: 使用 `uvx` 一键运行,无需复杂配置
|
|
46
|
+
- 🔍 **语义搜索**: 基于向量相似度的智能搜索
|
|
47
|
+
- 🧠 **多种嵌入模型**: 支持本地 Sentence-Transformers 和在线 Jina AI
|
|
48
|
+
- 📝 **完整 CRUD**: 创建、读取、更新、删除知识条目
|
|
49
|
+
- 🔧 **灵活配置**: 通过环境变量自定义各项参数
|
|
50
|
+
- 🌐 **标准协议**: 完全符合 MCP 规范
|
|
51
|
+
|
|
52
|
+
## 📦 安装
|
|
53
|
+
|
|
54
|
+
### 使用 uvx (推荐)
|
|
55
|
+
|
|
56
|
+
最简单的方式是使用 `uvx` 直接运行:
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
uvx qdrant-mcp-server
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
### 使用 uv
|
|
63
|
+
|
|
64
|
+
```bash
|
|
65
|
+
uv pip install qdrant-mcp-server
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
### 使用 pip
|
|
69
|
+
|
|
70
|
+
```bash
|
|
71
|
+
pip install qdrant-mcp-server
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
## 🚀 快速开始
|
|
75
|
+
|
|
76
|
+
### 1. 配置环境变量
|
|
77
|
+
|
|
78
|
+
创建 `.env` 文件或设置环境变量:
|
|
79
|
+
|
|
80
|
+
```bash
|
|
81
|
+
# Qdrant 连接配置
|
|
82
|
+
QDRANT_URL=https://your-qdrant-instance.com:443
|
|
83
|
+
QDRANT_API_KEY=your-api-key-here
|
|
84
|
+
COLLECTION_NAME=my_knowledge_base
|
|
85
|
+
|
|
86
|
+
# 嵌入模型配置 (二选一)
|
|
87
|
+
# 选项1: 使用本地模型 (默认)
|
|
88
|
+
EMBEDDING_MODEL=sentence-transformers/all-MiniLM-L6-v2
|
|
89
|
+
VECTOR_NAME=fast-all-minilm-l6-v2
|
|
90
|
+
|
|
91
|
+
# 选项2: 使用 Jina AI 在线模型
|
|
92
|
+
# EMBEDDING_MODEL=jina-embeddings-v3
|
|
93
|
+
# JINA_TOKEN=your-jina-api-key
|
|
94
|
+
# VECTOR_NAME=jina-embeddings-v3
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
### 2. 在 MCP 客户端中配置
|
|
98
|
+
|
|
99
|
+
#### Claude Desktop 配置
|
|
100
|
+
|
|
101
|
+
编辑 `~/Library/Application Support/Claude/claude_desktop_config.json`:
|
|
102
|
+
|
|
103
|
+
```json
|
|
104
|
+
{
|
|
105
|
+
"mcpServers": {
|
|
106
|
+
"qdrant": {
|
|
107
|
+
"command": "uvx",
|
|
108
|
+
"args": ["qdrant-mcp-server"],
|
|
109
|
+
"env": {
|
|
110
|
+
"QDRANT_URL": "https://your-instance.com:443",
|
|
111
|
+
"QDRANT_API_KEY": "your-api-key",
|
|
112
|
+
"COLLECTION_NAME": "knowledge_base"
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
#### Roo Code / OpenCode 配置
|
|
120
|
+
|
|
121
|
+
编辑配置文件 (如 `~/.config/opencode/opencode.json`):
|
|
122
|
+
|
|
123
|
+
```json
|
|
124
|
+
{
|
|
125
|
+
"mcp": {
|
|
126
|
+
"qdrant": {
|
|
127
|
+
"type": "local",
|
|
128
|
+
"command": ["uvx", "qdrant-mcp-server"],
|
|
129
|
+
"environment": {
|
|
130
|
+
"QDRANT_URL": "https://your-instance.com:443",
|
|
131
|
+
"QDRANT_API_KEY": "your-api-key",
|
|
132
|
+
"COLLECTION_NAME": "knowledge_base"
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
## 🛠️ 可用工具
|
|
140
|
+
|
|
141
|
+
### qdrant-record
|
|
142
|
+
|
|
143
|
+
将文档存储到 Qdrant 向量数据库。
|
|
144
|
+
|
|
145
|
+
```python
|
|
146
|
+
# 参数
|
|
147
|
+
{
|
|
148
|
+
"document": "要存储的文档内容", # 必需
|
|
149
|
+
"metadata": { # 可选
|
|
150
|
+
"source": "example.pdf",
|
|
151
|
+
"author": "John Doe",
|
|
152
|
+
"date": "2024-01-01"
|
|
153
|
+
},
|
|
154
|
+
"point_id": "custom-id-123" # 可选,不提供则自动生成
|
|
155
|
+
}
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
### qdrant-search
|
|
159
|
+
|
|
160
|
+
基于语义相似度搜索知识。
|
|
161
|
+
|
|
162
|
+
```python
|
|
163
|
+
# 参数
|
|
164
|
+
{
|
|
165
|
+
"query": "搜索关键词", # 必需
|
|
166
|
+
"limit": 5, # 可选,默认 5
|
|
167
|
+
"score_threshold": 0.7, # 可选,默认 0.0
|
|
168
|
+
"filter_conditions": { # 可选
|
|
169
|
+
"must": [
|
|
170
|
+
{
|
|
171
|
+
"key": "metadata.source",
|
|
172
|
+
"match": {"value": "example.pdf"}
|
|
173
|
+
}
|
|
174
|
+
]
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
### qdrant-update
|
|
180
|
+
|
|
181
|
+
更新已存储的知识条目。
|
|
182
|
+
|
|
183
|
+
```python
|
|
184
|
+
# 参数
|
|
185
|
+
{
|
|
186
|
+
"point_id": "existing-id", # 必需
|
|
187
|
+
"document": "新的文档内容", # 可选
|
|
188
|
+
"metadata": { # 可选
|
|
189
|
+
"updated": "2024-01-02"
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
### qdrant-delete
|
|
195
|
+
|
|
196
|
+
删除知识条目。
|
|
197
|
+
|
|
198
|
+
```python
|
|
199
|
+
# 按 ID 删除
|
|
200
|
+
{
|
|
201
|
+
"point_ids": "single-id" # 或 ["id1", "id2"]
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
# 按条件删除
|
|
205
|
+
{
|
|
206
|
+
"filter_conditions": {
|
|
207
|
+
"must": [
|
|
208
|
+
{
|
|
209
|
+
"key": "metadata.source",
|
|
210
|
+
"match": {"value": "old-doc.pdf"}
|
|
211
|
+
}
|
|
212
|
+
]
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
## 🔧 配置选项
|
|
218
|
+
|
|
219
|
+
| 环境变量 | 默认值 | 说明 |
|
|
220
|
+
|---------|--------|------|
|
|
221
|
+
| `QDRANT_URL` | `http://localhost:6333` | Qdrant 服务器地址 |
|
|
222
|
+
| `QDRANT_API_KEY` | - | Qdrant API 密钥 (云服务需要) |
|
|
223
|
+
| `COLLECTION_NAME` | `default_collection` | 集合名称 |
|
|
224
|
+
| `EMBEDDING_MODEL` | `sentence-transformers/all-MiniLM-L6-v2` | 嵌入模型 |
|
|
225
|
+
| `VECTOR_NAME` | 自动检测 | 向量字段名称 |
|
|
226
|
+
| `JINA_TOKEN` | - | Jina AI API 密钥 (使用 Jina 时需要) |
|
|
227
|
+
|
|
228
|
+
## 🌟 使用示例
|
|
229
|
+
|
|
230
|
+
### 1. 存储知识
|
|
231
|
+
|
|
232
|
+
```
|
|
233
|
+
请将这段内容存储到知识库:
|
|
234
|
+
"人工智能是计算机科学的一个分支,致力于创建能够执行通常需要人类智能的任务的系统。"
|
|
235
|
+
```
|
|
236
|
+
|
|
237
|
+
### 2. 搜索知识
|
|
238
|
+
|
|
239
|
+
```
|
|
240
|
+
在知识库中搜索关于"机器学习"的内容
|
|
241
|
+
```
|
|
242
|
+
|
|
243
|
+
### 3. 更新知识
|
|
244
|
+
|
|
245
|
+
```
|
|
246
|
+
更新 ID 为 "doc-123" 的文档,添加元数据 {"verified": true}
|
|
247
|
+
```
|
|
248
|
+
|
|
249
|
+
## 🏗️ 开发
|
|
250
|
+
|
|
251
|
+
### 从源码安装
|
|
252
|
+
|
|
253
|
+
```bash
|
|
254
|
+
git clone https://github.com/fiyen/qdrant-mcp-server.git
|
|
255
|
+
cd qdrant-mcp-server
|
|
256
|
+
uv pip install -e ".[dev]"
|
|
257
|
+
```
|
|
258
|
+
|
|
259
|
+
### 运行测试
|
|
260
|
+
|
|
261
|
+
```bash
|
|
262
|
+
pytest
|
|
263
|
+
```
|
|
264
|
+
|
|
265
|
+
### 代码格式化
|
|
266
|
+
|
|
267
|
+
```bash
|
|
268
|
+
black src/
|
|
269
|
+
ruff check src/
|
|
270
|
+
```
|
|
271
|
+
|
|
272
|
+
## 📚 文档
|
|
273
|
+
|
|
274
|
+
- [MCP 协议文档](https://modelcontextprotocol.io/)
|
|
275
|
+
- [Qdrant 文档](https://qdrant.tech/documentation/)
|
|
276
|
+
- [Sentence Transformers](https://www.sbert.net/)
|
|
277
|
+
- [Jina AI Embeddings](https://jina.ai/embeddings/)
|
|
278
|
+
|
|
279
|
+
## 🤝 贡献
|
|
280
|
+
|
|
281
|
+
欢迎提交 Issue 和 Pull Request!
|
|
282
|
+
|
|
283
|
+
## 📄 许可证
|
|
284
|
+
|
|
285
|
+
MIT License - 详见 [LICENSE](LICENSE) 文件
|
|
286
|
+
|
|
287
|
+
## 🙏 致谢
|
|
288
|
+
|
|
289
|
+
- [Qdrant](https://qdrant.tech/) - 高性能向量数据库
|
|
290
|
+
- [Anthropic](https://www.anthropic.com/) - MCP 协议
|
|
291
|
+
- [Sentence Transformers](https://www.sbert.net/) - 嵌入模型
|
|
292
|
+
- [Jina AI](https://jina.ai/) - 在线嵌入服务
|
|
293
|
+
|
|
294
|
+
## 📧 联系
|
|
295
|
+
|
|
296
|
+
- 作者: fiyen
|
|
297
|
+
- Email: 623320480@qq.com
|
|
298
|
+
- GitHub: [@fiyen](https://github.com/fiyen)
|
|
299
|
+
|
|
300
|
+
---
|
|
301
|
+
|
|
302
|
+
⭐ 如果这个项目对您有帮助,请给个 Star!
|
|
@@ -0,0 +1,268 @@
|
|
|
1
|
+
# Qdrant MCP Server
|
|
2
|
+
|
|
3
|
+
[](https://badge.fury.io/py/qdrant-mcp-server)
|
|
4
|
+
[](https://www.python.org/downloads/)
|
|
5
|
+
[](https://opensource.org/licenses/MIT)
|
|
6
|
+
|
|
7
|
+
一个基于 [Qdrant](https://qdrant.tech/) 向量数据库的 [Model Context Protocol (MCP)](https://modelcontextprotocol.io/) 服务器,提供强大的语义搜索和知识管理功能。
|
|
8
|
+
|
|
9
|
+
## ✨ 特性
|
|
10
|
+
|
|
11
|
+
- 🚀 **即插即用**: 使用 `uvx` 一键运行,无需复杂配置
|
|
12
|
+
- 🔍 **语义搜索**: 基于向量相似度的智能搜索
|
|
13
|
+
- 🧠 **多种嵌入模型**: 支持本地 Sentence-Transformers 和在线 Jina AI
|
|
14
|
+
- 📝 **完整 CRUD**: 创建、读取、更新、删除知识条目
|
|
15
|
+
- 🔧 **灵活配置**: 通过环境变量自定义各项参数
|
|
16
|
+
- 🌐 **标准协议**: 完全符合 MCP 规范
|
|
17
|
+
|
|
18
|
+
## 📦 安装
|
|
19
|
+
|
|
20
|
+
### 使用 uvx (推荐)
|
|
21
|
+
|
|
22
|
+
最简单的方式是使用 `uvx` 直接运行:
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
uvx qdrant-mcp-server
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
### 使用 uv
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
uv pip install qdrant-mcp-server
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
### 使用 pip
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
pip install qdrant-mcp-server
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## 🚀 快速开始
|
|
41
|
+
|
|
42
|
+
### 1. 配置环境变量
|
|
43
|
+
|
|
44
|
+
创建 `.env` 文件或设置环境变量:
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
# Qdrant 连接配置
|
|
48
|
+
QDRANT_URL=https://your-qdrant-instance.com:443
|
|
49
|
+
QDRANT_API_KEY=your-api-key-here
|
|
50
|
+
COLLECTION_NAME=my_knowledge_base
|
|
51
|
+
|
|
52
|
+
# 嵌入模型配置 (二选一)
|
|
53
|
+
# 选项1: 使用本地模型 (默认)
|
|
54
|
+
EMBEDDING_MODEL=sentence-transformers/all-MiniLM-L6-v2
|
|
55
|
+
VECTOR_NAME=fast-all-minilm-l6-v2
|
|
56
|
+
|
|
57
|
+
# 选项2: 使用 Jina AI 在线模型
|
|
58
|
+
# EMBEDDING_MODEL=jina-embeddings-v3
|
|
59
|
+
# JINA_TOKEN=your-jina-api-key
|
|
60
|
+
# VECTOR_NAME=jina-embeddings-v3
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
### 2. 在 MCP 客户端中配置
|
|
64
|
+
|
|
65
|
+
#### Claude Desktop 配置
|
|
66
|
+
|
|
67
|
+
编辑 `~/Library/Application Support/Claude/claude_desktop_config.json`:
|
|
68
|
+
|
|
69
|
+
```json
|
|
70
|
+
{
|
|
71
|
+
"mcpServers": {
|
|
72
|
+
"qdrant": {
|
|
73
|
+
"command": "uvx",
|
|
74
|
+
"args": ["qdrant-mcp-server"],
|
|
75
|
+
"env": {
|
|
76
|
+
"QDRANT_URL": "https://your-instance.com:443",
|
|
77
|
+
"QDRANT_API_KEY": "your-api-key",
|
|
78
|
+
"COLLECTION_NAME": "knowledge_base"
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
#### Roo Code / OpenCode 配置
|
|
86
|
+
|
|
87
|
+
编辑配置文件 (如 `~/.config/opencode/opencode.json`):
|
|
88
|
+
|
|
89
|
+
```json
|
|
90
|
+
{
|
|
91
|
+
"mcp": {
|
|
92
|
+
"qdrant": {
|
|
93
|
+
"type": "local",
|
|
94
|
+
"command": ["uvx", "qdrant-mcp-server"],
|
|
95
|
+
"environment": {
|
|
96
|
+
"QDRANT_URL": "https://your-instance.com:443",
|
|
97
|
+
"QDRANT_API_KEY": "your-api-key",
|
|
98
|
+
"COLLECTION_NAME": "knowledge_base"
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
## 🛠️ 可用工具
|
|
106
|
+
|
|
107
|
+
### qdrant-record
|
|
108
|
+
|
|
109
|
+
将文档存储到 Qdrant 向量数据库。
|
|
110
|
+
|
|
111
|
+
```python
|
|
112
|
+
# 参数
|
|
113
|
+
{
|
|
114
|
+
"document": "要存储的文档内容", # 必需
|
|
115
|
+
"metadata": { # 可选
|
|
116
|
+
"source": "example.pdf",
|
|
117
|
+
"author": "John Doe",
|
|
118
|
+
"date": "2024-01-01"
|
|
119
|
+
},
|
|
120
|
+
"point_id": "custom-id-123" # 可选,不提供则自动生成
|
|
121
|
+
}
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
### qdrant-search
|
|
125
|
+
|
|
126
|
+
基于语义相似度搜索知识。
|
|
127
|
+
|
|
128
|
+
```python
|
|
129
|
+
# 参数
|
|
130
|
+
{
|
|
131
|
+
"query": "搜索关键词", # 必需
|
|
132
|
+
"limit": 5, # 可选,默认 5
|
|
133
|
+
"score_threshold": 0.7, # 可选,默认 0.0
|
|
134
|
+
"filter_conditions": { # 可选
|
|
135
|
+
"must": [
|
|
136
|
+
{
|
|
137
|
+
"key": "metadata.source",
|
|
138
|
+
"match": {"value": "example.pdf"}
|
|
139
|
+
}
|
|
140
|
+
]
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
### qdrant-update
|
|
146
|
+
|
|
147
|
+
更新已存储的知识条目。
|
|
148
|
+
|
|
149
|
+
```python
|
|
150
|
+
# 参数
|
|
151
|
+
{
|
|
152
|
+
"point_id": "existing-id", # 必需
|
|
153
|
+
"document": "新的文档内容", # 可选
|
|
154
|
+
"metadata": { # 可选
|
|
155
|
+
"updated": "2024-01-02"
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
### qdrant-delete
|
|
161
|
+
|
|
162
|
+
删除知识条目。
|
|
163
|
+
|
|
164
|
+
```python
|
|
165
|
+
# 按 ID 删除
|
|
166
|
+
{
|
|
167
|
+
"point_ids": "single-id" # 或 ["id1", "id2"]
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
# 按条件删除
|
|
171
|
+
{
|
|
172
|
+
"filter_conditions": {
|
|
173
|
+
"must": [
|
|
174
|
+
{
|
|
175
|
+
"key": "metadata.source",
|
|
176
|
+
"match": {"value": "old-doc.pdf"}
|
|
177
|
+
}
|
|
178
|
+
]
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
## 🔧 配置选项
|
|
184
|
+
|
|
185
|
+
| 环境变量 | 默认值 | 说明 |
|
|
186
|
+
|---------|--------|------|
|
|
187
|
+
| `QDRANT_URL` | `http://localhost:6333` | Qdrant 服务器地址 |
|
|
188
|
+
| `QDRANT_API_KEY` | - | Qdrant API 密钥 (云服务需要) |
|
|
189
|
+
| `COLLECTION_NAME` | `default_collection` | 集合名称 |
|
|
190
|
+
| `EMBEDDING_MODEL` | `sentence-transformers/all-MiniLM-L6-v2` | 嵌入模型 |
|
|
191
|
+
| `VECTOR_NAME` | 自动检测 | 向量字段名称 |
|
|
192
|
+
| `JINA_TOKEN` | - | Jina AI API 密钥 (使用 Jina 时需要) |
|
|
193
|
+
|
|
194
|
+
## 🌟 使用示例
|
|
195
|
+
|
|
196
|
+
### 1. 存储知识
|
|
197
|
+
|
|
198
|
+
```
|
|
199
|
+
请将这段内容存储到知识库:
|
|
200
|
+
"人工智能是计算机科学的一个分支,致力于创建能够执行通常需要人类智能的任务的系统。"
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
### 2. 搜索知识
|
|
204
|
+
|
|
205
|
+
```
|
|
206
|
+
在知识库中搜索关于"机器学习"的内容
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
### 3. 更新知识
|
|
210
|
+
|
|
211
|
+
```
|
|
212
|
+
更新 ID 为 "doc-123" 的文档,添加元数据 {"verified": true}
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
## 🏗️ 开发
|
|
216
|
+
|
|
217
|
+
### 从源码安装
|
|
218
|
+
|
|
219
|
+
```bash
|
|
220
|
+
git clone https://github.com/fiyen/qdrant-mcp-server.git
|
|
221
|
+
cd qdrant-mcp-server
|
|
222
|
+
uv pip install -e ".[dev]"
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
### 运行测试
|
|
226
|
+
|
|
227
|
+
```bash
|
|
228
|
+
pytest
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
### 代码格式化
|
|
232
|
+
|
|
233
|
+
```bash
|
|
234
|
+
black src/
|
|
235
|
+
ruff check src/
|
|
236
|
+
```
|
|
237
|
+
|
|
238
|
+
## 📚 文档
|
|
239
|
+
|
|
240
|
+
- [MCP 协议文档](https://modelcontextprotocol.io/)
|
|
241
|
+
- [Qdrant 文档](https://qdrant.tech/documentation/)
|
|
242
|
+
- [Sentence Transformers](https://www.sbert.net/)
|
|
243
|
+
- [Jina AI Embeddings](https://jina.ai/embeddings/)
|
|
244
|
+
|
|
245
|
+
## 🤝 贡献
|
|
246
|
+
|
|
247
|
+
欢迎提交 Issue 和 Pull Request!
|
|
248
|
+
|
|
249
|
+
## 📄 许可证
|
|
250
|
+
|
|
251
|
+
MIT License - 详见 [LICENSE](LICENSE) 文件
|
|
252
|
+
|
|
253
|
+
## 🙏 致谢
|
|
254
|
+
|
|
255
|
+
- [Qdrant](https://qdrant.tech/) - 高性能向量数据库
|
|
256
|
+
- [Anthropic](https://www.anthropic.com/) - MCP 协议
|
|
257
|
+
- [Sentence Transformers](https://www.sbert.net/) - 嵌入模型
|
|
258
|
+
- [Jina AI](https://jina.ai/) - 在线嵌入服务
|
|
259
|
+
|
|
260
|
+
## 📧 联系
|
|
261
|
+
|
|
262
|
+
- 作者: fiyen
|
|
263
|
+
- Email: 623320480@qq.com
|
|
264
|
+
- GitHub: [@fiyen](https://github.com/fiyen)
|
|
265
|
+
|
|
266
|
+
---
|
|
267
|
+
|
|
268
|
+
⭐ 如果这个项目对您有帮助,请给个 Star!
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "qdrant-mcp-server"
|
|
3
|
+
version = "0.1.0"
|
|
4
|
+
description = "A Model Context Protocol (MCP) server for Qdrant vector database with semantic search capabilities"
|
|
5
|
+
readme = "README.md"
|
|
6
|
+
authors = [
|
|
7
|
+
{ name = "fiyen", email = "623320480@qq.com" }
|
|
8
|
+
]
|
|
9
|
+
requires-python = ">=3.10"
|
|
10
|
+
license = "MIT"
|
|
11
|
+
keywords = ["mcp", "qdrant", "vector-database", "semantic-search", "embeddings", "ai"]
|
|
12
|
+
classifiers = [
|
|
13
|
+
"Development Status :: 4 - Beta",
|
|
14
|
+
"Intended Audience :: Developers",
|
|
15
|
+
"Programming Language :: Python :: 3",
|
|
16
|
+
"Programming Language :: Python :: 3.10",
|
|
17
|
+
"Programming Language :: Python :: 3.11",
|
|
18
|
+
"Programming Language :: Python :: 3.12",
|
|
19
|
+
"Programming Language :: Python :: 3.13",
|
|
20
|
+
"Topic :: Software Development :: Libraries :: Python Modules",
|
|
21
|
+
"Topic :: Scientific/Engineering :: Artificial Intelligence",
|
|
22
|
+
]
|
|
23
|
+
|
|
24
|
+
dependencies = [
|
|
25
|
+
"mcp>=1.0.0",
|
|
26
|
+
"httpx>=0.27.0",
|
|
27
|
+
"sentence-transformers>=2.2.0",
|
|
28
|
+
"python-dotenv>=1.0.0",
|
|
29
|
+
]
|
|
30
|
+
|
|
31
|
+
[project.optional-dependencies]
|
|
32
|
+
dev = [
|
|
33
|
+
"pytest>=7.0.0",
|
|
34
|
+
"pytest-asyncio>=0.21.0",
|
|
35
|
+
"black>=23.0.0",
|
|
36
|
+
"ruff>=0.1.0",
|
|
37
|
+
]
|
|
38
|
+
|
|
39
|
+
[project.urls]
|
|
40
|
+
Homepage = "https://github.com/fiyen/qdrant-mcp-server"
|
|
41
|
+
Repository = "https://github.com/fiyen/qdrant-mcp-server"
|
|
42
|
+
Documentation = "https://github.com/fiyen/qdrant-mcp-server#readme"
|
|
43
|
+
"Bug Tracker" = "https://github.com/fiyen/qdrant-mcp-server/issues"
|
|
44
|
+
|
|
45
|
+
[project.scripts]
|
|
46
|
+
qdrant-mcp-server = "qdrant_mcp_server.__main__:run"
|
|
47
|
+
|
|
48
|
+
[build-system]
|
|
49
|
+
requires = ["setuptools>=61.0", "wheel"]
|
|
50
|
+
build-backend = "setuptools.build_meta"
|
|
51
|
+
|
|
52
|
+
[tool.setuptools.packages.find]
|
|
53
|
+
where = ["src"]
|
|
54
|
+
|
|
55
|
+
[tool.ruff]
|
|
56
|
+
line-length = 120
|
|
57
|
+
target-version = "py310"
|
|
58
|
+
|
|
59
|
+
[tool.black]
|
|
60
|
+
line-length = 120
|
|
61
|
+
target-version = ["py310", "py311", "py312"]
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Qdrant MCP Server
|
|
3
|
+
|
|
4
|
+
A Model Context Protocol (MCP) server for Qdrant vector database
|
|
5
|
+
with semantic search capabilities.
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
__version__ = "0.1.0"
|
|
9
|
+
__author__ = "fiyen"
|
|
10
|
+
__email__ = "623320480@qq.com"
|
|
11
|
+
|
|
12
|
+
from .server import create_server, QdrantMCPServer
|
|
13
|
+
from .__main__ import main, run
|
|
14
|
+
|
|
15
|
+
__all__ = [
|
|
16
|
+
"create_server",
|
|
17
|
+
"QdrantMCPServer",
|
|
18
|
+
"main",
|
|
19
|
+
"run",
|
|
20
|
+
]
|