Skip to main content

Qdrant MCP Server

PyPI version Python 3.10+ License: MIT

一个基于 Qdrant 向量数据库的 Model Context Protocol (MCP) 服务器,提供强大的语义搜索和知识管理功能。

✨ 特性

  • 🚀 即插即用: 使用 uvx 一键运行,无需复杂配置
  • 🔍 语义搜索: 基于向量相似度的智能搜索
  • 🧠 多种嵌入模型: 支持本地 Sentence-Transformers 和在线 Jina AI
  • 📝 完整 CRUD: 创建、读取、更新、删除知识条目
  • 🔧 灵活配置: 通过环境变量自定义各项参数
  • 🌐 标准协议: 完全符合 MCP 规范

📦 安装

使用 uvx (推荐)

最简单的方式是使用 uvx 直接运行:

uvx qdrant-mcp-server

使用 uv

uv pip install qdrant-mcp-server

使用 pip

pip install qdrant-mcp-server

🚀 快速开始

1. 配置环境变量

创建 .env 文件或设置环境变量:

# Qdrant 连接配置
QDRANT_URL=https://your-qdrant-instance.com:443
QDRANT_API_KEY=your-api-key-here
COLLECTION_NAME=my_knowledge_base

# 嵌入模型配置 (二选一)
# 选项1: 使用本地模型 (默认)
EMBEDDING_MODEL=sentence-transformers/all-MiniLM-L6-v2
VECTOR_NAME=fast-all-minilm-l6-v2

# 选项2: 使用 Jina AI 在线模型
# EMBEDDING_MODEL=jina-embeddings-v3
# JINA_TOKEN=your-jina-api-key
# VECTOR_NAME=jina-embeddings-v3

2. 在 MCP 客户端中配置

Claude Desktop 配置

编辑 ~/Library/Application Support/Claude/claude_desktop_config.json:

{
  "mcpServers": {
    "qdrant": {
      "command": "uvx",
      "args": ["qdrant-mcp-server"],
      "env": {
        "QDRANT_URL": "https://your-instance.com:443",
        "QDRANT_API_KEY": "your-api-key",
        "COLLECTION_NAME": "knowledge_base"
      }
    }
  }
}

Roo Code / OpenCode 配置

编辑配置文件 (如 ~/.config/opencode/opencode.json):

{
  "mcp": {
    "qdrant": {
      "type": "local",
      "command": ["uvx", "qdrant-mcp-server"],
      "environment": {
        "QDRANT_URL": "https://your-instance.com:443",
        "QDRANT_API_KEY": "your-api-key",
        "COLLECTION_NAME": "knowledge_base"
      }
    }
  }
}

🛠️ 可用工具

qdrant-record

将文档存储到 Qdrant 向量数据库。

# 参数
{
  "document": "要存储的文档内容",  # 必需
  "metadata": {                    # 可选
    "source": "example.pdf",
    "author": "John Doe",
    "date": "2024-01-01"
  },
  "point_id": "custom-id-123"      # 可选,不提供则自动生成
}

基于语义相似度搜索知识。

# 参数
{
  "query": "搜索关键词",           # 必需
  "limit": 5,                     # 可选,默认 5
  "score_threshold": 0.7,         # 可选,默认 0.0
  "filter_conditions": {          # 可选
    "must": [
      {
        "key": "metadata.source",
        "match": {"value": "example.pdf"}
      }
    ]
  }
}

qdrant-update

更新已存储的知识条目。

# 参数
{
  "point_id": "existing-id",      # 必需
  "document": "新的文档内容",      # 可选
  "metadata": {                   # 可选
    "updated": "2024-01-02"
  }
}

qdrant-delete

删除知识条目。

# 按 ID 删除
{
  "point_ids": "single-id"        # 或 ["id1", "id2"]
}

# 按条件删除
{
  "filter_conditions": {
    "must": [
      {
        "key": "metadata.source",
        "match": {"value": "old-doc.pdf"}
      }
    ]
  }
}

🔧 配置选项

环境变量 默认值 说明
QDRANT_URL http://localhost:6333 Qdrant 服务器地址
QDRANT_API_KEY - Qdrant API 密钥 (云服务需要)
COLLECTION_NAME default_collection 集合名称
EMBEDDING_MODEL sentence-transformers/all-MiniLM-L6-v2 嵌入模型
VECTOR_NAME 自动检测 向量字段名称
JINA_TOKEN - Jina AI API 密钥 (使用 Jina 时需要)

🌟 使用示例

1. 存储知识

请将这段内容存储到知识库:
"人工智能是计算机科学的一个分支,致力于创建能够执行通常需要人类智能的任务的系统。"

2. 搜索知识

在知识库中搜索关于"机器学习"的内容

3. 更新知识

更新 ID 为 "doc-123" 的文档,添加元数据 {"verified": true}

🏗️ 开发

从源码安装

git clone https://github.com/fiyen/qdrant-mcp-server.git
cd qdrant-mcp-server
uv pip install -e ".[dev]"

运行测试

pytest

代码格式化

black src/
ruff check src/

📚 文档

🤝 贡献

欢迎提交 Issue 和 Pull Request!

📄 许可证

MIT License - 详见 LICENSE 文件

🙏 致谢

📧 联系


⭐ 如果这个项目对您有帮助,请给个 Star!

Metadata

Release files for qdrant-mcp-server 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for qdrant-mcp-server 0.1.0
File Size Uploaded Provenance
qdrant_mcp_server-0.1.0.tar.gz 13.3 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for qdrant-mcp-server 0.1.0
File Interpreter ABI Platform
qdrant_mcp_server-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 25.1 kB

Release files / qdrant_mcp_server-0.1.0.tar.gz

Download URL qdrant_mcp_server-0.1.0.tar.gz
Size 13.3 kB
Tags Source
SHA-256 checksum
How to use checksums
6951b3b711663be6deeb9f97b4102396c8b6e2d7286429f3119ec7d0b2ddf2a1
BLAKE2b-256 checksum
How to use checksums
f8356ae41fcd7a6e2df537c311cb6c17fcf491c02c9fec11548b1efa820baf66
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.7

Release files / qdrant_mcp_server-0.1.0-py3-none-any.whl

Download URL qdrant_mcp_server-0.1.0-py3-none-any.whl
Size 11.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9254fb304223ebd0bb10430428a1323d7eff4366379e5ec03f0e9d8eb7dc4b25
BLAKE2b-256 checksum
How to use checksums
efdb60d425e9915adb97492b7cfc4c1e5e26408bccfe4a87ff1fd5b8dd5e064b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.7

Security for qdrant-mcp-server 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page