Skip to main content
Glama

GraphRAG MCP Server

by rileylemm

GraphRAG MCP 服务器

用于查询混合图形和矢量数据库系统的模型上下文协议服务器,结合 Neo4j(图形数据库)和 Qdrant(矢量数据库)实现强大的语义和基于图形的文档检索。

概述

GraphRAG MCP 实现了大型语言模型与混合检索系统的无缝集成,该系统充分利用了图形数据库 (Neo4j) 和向量数据库 (Qdrant) 的优势。这可以实现:

  • 通过文档嵌入进行语义搜索
  • 基于图的上下文扩展关系
  • 向量相似度与图关系的混合搜索
  • 通过 MCP 与 Claude 和其他 LLM 全面整合

该项目遵循模型上下文协议规范,使其与任何支持 MCP 的客户端兼容。

特征

  • 使用句子嵌入和 Qdrant进行语义搜索
  • 使用 Neo4j 进行基于图的上下文扩展
  • 结合两种方法的混合搜索
  • 用于 LLM 集成的MCP 工具和资源
  • Neo4j 模式和 Qdrant 收集信息的完整文档

先决条件

  • Python 3.12+
  • Neo4j 在 localhost:7687 上运行(默认配置)
  • Qdrant 在 localhost:6333 上运行(默认配置)
  • 两个数据库中均有索引的文档数据

安装

快速入门

  1. 克隆此存储库:
    git clone https://github.com/rileylemm/graphrag_mcp.git cd graphrag_mcp
  2. 使用 uv 安装依赖项:
    uv install
  3. .env文件中配置数据库连接:
    # Neo4j Configuration NEO4J_URI=bolt://localhost:7687 NEO4J_USER=neo4j NEO4J_PASSWORD=password # Qdrant Configuration QDRANT_HOST=localhost QDRANT_PORT=6333 QDRANT_COLLECTION=document_chunks
  4. 运行服务器:
    uv run main.py

详细设置指南

有关设置底层混合数据库系统的详细指南,请参阅配套存储库: GraphRAG 混合数据库

设置 Neo4j 和 Qdrant
  1. 安装并启动 Neo4j:
    # Using Docker docker run \ --name neo4j \ -p 7474:7474 -p 7687:7687 \ -e NEO4J_AUTH=neo4j/password \ -v $HOME/neo4j/data:/data \ -v $HOME/neo4j/logs:/logs \ -v $HOME/neo4j/import:/import \ -v $HOME/neo4j/plugins:/plugins \ neo4j:latest
  2. 安装并启动 Qdrant:
    # Using Docker docker run -p 6333:6333 -p 6334:6334 \ -v $HOME/qdrant/storage:/qdrant/storage \ qdrant/qdrant
索引文档

要在两个数据库中索引您的文档,请按照以下步骤操作:

  1. 准备文件
  2. 使用句子转换器创建嵌入
  3. 使用关系信息将文档存储在 Neo4j 中
  4. 将文档块嵌入存储在 Qdrant 中

有关详细的索引脚本和程序,请参阅GraphRAG 混合数据库存储库。

与 MCP 客户端集成

Claude Desktop/光标集成

  1. 使运行脚本可执行:
    chmod +x run_server.sh
  2. 将服务器添加到您的 MCP 配置文件( ~/.cursor/mcp.json或 Claude Desktop 等效文件):
    { "mcpServers": { "GraphRAG": { "command": "/path/to/graphrag_mcp/run_server.sh", "args": [] } } }
  3. 重新启动您的 MCP 客户端(Cursor、Claude Desktop 等)

用法

MCP 工具

该服务器提供以下供 LLM 使用的工具:

  1. search_documentation - 使用语义搜索来搜索信息
    # Example usage in MCP context result = search_documentation( query="How does graph context expansion work?", limit=5, category="technical" )
  2. hybrid_search - 使用语义和基于图的方法进行搜索
    # Example usage in MCP context result = hybrid_search( query="Vector similarity with graph relationships", limit=10, category=None, expand_context=True )

MCP 资源

服务器提供以下资源:

  1. https://graphrag.db/schema/neo4j - 有关 Neo4j 图形模式的信息
  2. https://graphrag.db/collection/qdrant - 有关 Qdrant 矢量集合的信息

故障排除

  • 连接问题:确保 Neo4j 和 Qdrant 正在运行且可访问
  • 空结果:检查您的文档集合是否已正确编入索引
  • 缺少依赖项:运行uv install以确保所有软件包都已安装
  • 数据库身份验证:验证.env文件中的凭据

贡献

欢迎贡献代码!欢迎提交 Pull 请求。

执照

MIT 许可证

版权所有 (c) 2025 Riley Lemm

特此授予获得此软件和相关文档文件(“软件”)副本的任何人免费许可,以无限制方式处理软件,包括但不限于使用、复制、修改、合并、发布、分发、再授权和/或销售软件副本的权利,并允许向其提供软件的人员这样做,但须遵守以下条件:

上述版权声明和本许可声明均应包含在软件的所有副本或实质性部分中。

本软件按“原样”提供,不附带任何形式的明示或暗示保证,包括但不限于适销性、适用于特定用途和非侵权性的保证。在任何情况下,作者或版权所有者均不对因本软件或使用或以其他方式处理本软件而引起的或与之相关的任何索赔、损害或其他责任承担责任,无论是合同、侵权或其他诉讼。

归因

如果您使用此 MCP 服务器或将其用于您自己的目的,请注明 Riley Lemm 并链接回此存储库( https://github.com/rileylemm/graphrag\_mcp )。

-
security - not tested
A
license - permissive license
-
quality - not tested

hybrid server

The server is able to function both locally and remotely, depending on the configuration or use case.

支持查询结合 Neo4j 图形数据库和 Qdrant 矢量数据库的混合系统,通过模型上下文协议实现强大的语义和基于图形的文档检索。

  1. 概述
    1. 特征
      1. 先决条件
        1. 安装
          1. 快速入门
          2. 详细设置指南
        2. 与 MCP 客户端集成
          1. Claude Desktop/光标集成
        3. 用法
          1. MCP 工具
          2. MCP 资源
        4. 故障排除
          1. 贡献
            1. 执照
              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
                  A
                  license
                  -
                  quality
                  Enables semantic search across multiple Qdrant vector database collections, supporting multi-query capability and providing semantically relevant document retrieval with configurable result counts.
                  Last updated -
                  46
                  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

                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/rileylemm/graphrag_mcp'

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