Skip to main content
Glama

MCP Memory Server with Qdrant Persistence

具有 Qdrant Persistence 的 MCP 内存服务器

该 MCP 服务器提供了由 Qdrant 矢量数据库支持的具有语义搜索功能的知识图谱实现。

特征

  • 基于图的知识表示,包括实体和关系
  • 基于文件的持久性(memory.json)
  • 使用 Qdrant 矢量数据库进行语义搜索
  • OpenAI 语义相似性嵌入
  • HTTPS 支持与反向代理兼容
  • Docker 支持,轻松部署

环境变量

需要以下环境变量:

# OpenAI API key for generating embeddings OPENAI_API_KEY=your-openai-api-key # Qdrant server URL (supports both HTTP and HTTPS) QDRANT_URL=https://your-qdrant-server # Qdrant API key (if authentication is enabled) QDRANT_API_KEY=your-qdrant-api-key # Name of the Qdrant collection to use QDRANT_COLLECTION_NAME=your-collection-name

设置

本地设置

  1. 安装依赖项:
npm install
  1. 构建服务器:
npm run build

Docker 设置

  1. 构建 Docker 镜像:
docker build -t mcp-qdrant-memory .
  1. 使用所需的环境变量运行 Docker 容器:
docker run -d \ -e OPENAI_API_KEY=your-openai-api-key \ -e QDRANT_URL=http://your-qdrant-server:6333 \ -e QDRANT_COLLECTION_NAME=your-collection-name \ -e QDRANT_API_KEY=your-qdrant-api-key \ --name mcp-qdrant-memory \ mcp-qdrant-memory

添加到 MCP 设置:

{ "mcpServers": { "memory": { "command": "/bin/zsh", "args": ["-c", "cd /path/to/server && node dist/index.js"], "env": { "OPENAI_API_KEY": "your-openai-api-key", "QDRANT_API_KEY": "your-qdrant-api-key", "QDRANT_URL": "http://your-qdrant-server:6333", "QDRANT_COLLECTION_NAME": "your-collection-name" }, "alwaysAllow": [ "create_entities", "create_relations", "add_observations", "delete_entities", "delete_observations", "delete_relations", "read_graph", "search_similar" ] } } }

工具

实体管理

  • create_entities :创建多个新实体
  • create_relations :创建实体之间的关系
  • add_observations :向实体添加观察结果
  • delete_entities :删除实体及其关系
  • delete_observations :删除特定观察结果
  • delete_relations :删除特定关系
  • read_graph :获取完整的知识图谱

语义搜索

  • search_similar :搜索语义相似的实体和关系
    interface SearchParams { query: string; // Search query text limit?: number; // Max results (default: 10) }

实现细节

服务器维护两种形式的持久性:

  1. 基于文件(memory.json):
    • 完整的知识图谱结构
    • 快速访问完整图表
    • 用于图形操作
  2. Qdrant 向量数据库:
    • 实体和关系的语义嵌入
    • 启用相似性搜索
    • 自动与文件存储同步

同步

当实体或关系被修改时:

  1. 更改写入memory.json
  2. 使用 OpenAI 生成嵌入
  3. 向量存储在 Qdrant 中
  4. 两个存储系统保持一致

搜索过程

搜索时:

  1. 查询文本转换为嵌入
  2. Qdrant 执行相似性搜索
  3. 结果包括实体和关系
  4. 结果按语义相似度排序

示例用法

// Create entities await client.callTool("create_entities", { entities: [{ name: "Project", entityType: "Task", observations: ["A new development project"] }] }); // Search similar concepts const results = await client.callTool("search_similar", { query: "development tasks", limit: 5 });

HTTPS 和反向代理配置

服务器支持通过 HTTPS 和反向代理连接到 Qdrant。此功能在以下情况下尤其有用:

  • 在 Nginx 或 Apache 等反向代理后面运行 Qdrant
  • 使用自签名证书
  • 需要自定义 SSL/TLS 配置

设置反向代理

  1. 配置您的反向代理(使用 Nginx 的示例):
server { listen 443 ssl; server_name qdrant.yourdomain.com; ssl_certificate /path/to/cert.pem; ssl_certificate_key /path/to/key.pem; location / { proxy_pass http://localhost:6333; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; } }
  1. 更新您的环境变量:
QDRANT_URL=https://qdrant.yourdomain.com

安全注意事项

服务器通过以下方式实现强大的 HTTPS 处理:

  • 自定义 SSL/TLS 配置
  • 适当的证书验证选项
  • 连接池和保持活动
  • 使用指数退避算法自动重试
  • 可配置超时

HTTPS 连接故障排除

如果您遇到连接问题:

  1. 验证您的证书:
openssl s_client -connect qdrant.yourdomain.com:443
  1. 测试直接连接:
curl -v https://qdrant.yourdomain.com/collections
  1. 检查任何代理设置:
env | grep -i proxy

贡献

  1. 分叉存储库
  2. 创建功能分支
  3. 进行更改
  4. 提交拉取请求

执照

麻省理工学院

-
security - not tested
F
license - not found
-
quality - not tested

remote-capable server

The server can be hosted and run remotely because it primarily relies on remote services or has no dependency on the local environment.

使用 Qdrant 通过语义搜索促进知识图谱表示,支持 OpenAI 嵌入语义相似性以及基于文件的图形持久性的强大 HTTPS 集成。

  1. 特征
    1. 环境变量
      1. 设置
        1. 本地设置
        2. Docker 设置
        3. 添加到 MCP 设置:
      2. 工具
        1. 实体管理
        2. 语义搜索
      3. 实现细节
        1. 同步
        2. 搜索过程
      4. 示例用法
        1. HTTPS 和反向代理配置
          1. 设置反向代理
          2. 安全注意事项
          3. HTTPS 连接故障排除
        2. 贡献
          1. 执照

            Related MCP Servers

            • -
              security
              A
              license
              -
              quality
              Provides RAG capabilities for semantic document search using Qdrant vector database and Ollama/OpenAI embeddings, allowing users to add, search, list, and delete documentation with metadata support.
              Last updated -
              5
              4
              TypeScript
              Apache 2.0
            • -
              security
              A
              license
              -
              quality
              A Model Context Protocol server that enables semantic search capabilities by providing tools to manage Qdrant vector database collections, process and embed documents using various embedding services, and perform semantic searches across vector embeddings.
              Last updated -
              89
              TypeScript
              MIT License
            • -
              security
              F
              license
              -
              quality
              This server enables semantic search capabilities using Qdrant vector database and OpenAI embeddings, allowing users to query collections, list available collections, and view collection information.
              Last updated -
              2
              Python
            • -
              security
              F
              license
              -
              quality
              Enables storage and retrieval of knowledge in a graph database format, allowing users to create, update, search, and delete entities and relationships in a Neo4j-powered knowledge graph through natural language.
              Last updated -
              Python
              • Linux

            View all related MCP servers

            MCP directory API

            We provide all the information about MCP servers via our MCP API.

            curl -X GET 'https://glama.ai/api/mcp/v1/servers/delorenj/mcp-qdrant-memory'

            If you have feedback or need assistance with the MCP directory API, please join our Discord server