Back to MCP directory
publicPublicdnsLocal runtime

mcp-memgraph

Memgraph MCP Server是一个轻量级的Model Context Protocol(MCP)服务器实现,旨在连接Memgraph图数据库与大型语言模型(LLM),提供Cypher查询执行和模式信息获取功能。

article

README

🚀 Memgraph MCP 服务器

Memgraph MCP 服务器是轻量级的 Model Context Protocol (MCP) 服务器实现,旨在将 Memgraph 连接至大型语言模型(LLMs),为用户在图数据库与大模型之间搭建起高效的沟通桥梁。

mcp-server

🚀 快速开始

📹 Memgraph MCP 服务器快速入门视频

运行 Memgraph MCP 服务器

  1. 安装 uv 并创建 venv 环境,执行命令 uv venv。接着使用 .venv\Scripts\activate 激活虚拟环境。
  2. 安装依赖项,执行命令:uv add "mcp[cli]" httpx
  3. 运行 Memgraph MCP 服务器,执行命令:uv run server.py

运行 MCP 客户端

  1. 安装 Claude Desktop
  2. 将 Memgraph 服务器添加到 Claude 配置中:
    • MacOS/Linux
code ~/Library/Application\ Support/Claude/claude_desktop_config.json
- **Windows**:
code $env:AppData\Claude\claude_desktop_config.json

配置示例如下:

{
    "mcpServers": {
      "mpc-memgraph": {
        "command": "/Users/katelatte/.local/bin/uv",
        "args": [
            "--directory",
            "/Users/katelatte/projects/mcp-memgraph",
            "run",
            "server.py"
        ]
     }
   }
}

⚠️ 重要提示

你可能需要提供 uv 可执行文件的完整路径(在命令字段中)。可以通过运行 which uv(MacOS/Linux)或 where uv(Windows)来获取。确保传递 Memgraph 服务器的绝对路径。

与数据库对话

  1. 运行 Memgraph MAGE,执行命令:
docker run -p 7687:7687 memgraph/memgraph-mage --schema-info-enabled=True

配置参数 --schema-info-enabled 设置为 True,以允许 LLM 执行 SHOW SCHEMA INFO 查询。 2. 打开 Claude Desktop 并查看 Memgraph 工具和资源,然后就可以尝试使用它啦!(你可以从 Memgraph Lab 数据集加载示例数据)

🔧 工具

run_query()

此工具可用于运行针对 Memgraph 的 Cypher 查询。

🗃️ 资源

get_schema()

该资源可用于获取 Memgraph 的架构信息(前提条件:--schema-info-enabled=True)。

🗺️ 路线图

Memgraph MCP 服务器目前还处于起步阶段。我们正在积极开发其功能,致力于让 Memgraph 更易于集成到现代 AI 工作流程中。在不久的将来,我们将发布 TypeScript 版本的服务器,以更好地支持基于 JavaScript 的环境。此外,我们计划将此项目迁移到我们的核心 AI 工具包 仓库中,在该仓库中,它将与 LangChain、LlamaIndex 和 MCP 等其他工具和集成一起,为用户提供统一的开源工具包,使构建以 Memgraph 为核心的图驱动应用程序和智能代理变得更加无缝。

help

Runtime guide

cloud

Hosted runtime

Hosted servers run from a provider-managed environment. You usually connect the MCP client to the hosted endpoint or follow the provider's authorization flow, without keeping a local process alive

  1. Open provider connection page
  2. Authorize or copy endpoint
  3. Connect from your MCP client
terminal

Local runtime / other methods

Local servers run on your own machine or infrastructure. You normally copy the server_config into your MCP client, install the required package, and provide env variables from env_schema when needed

  1. Copy server_config
  2. Install required package
  3. Fill env variables and restart client