Memgraph MCP server

Provides a bridge between AI assistants and Memgraph database for executing Cypher queries, retrieving schema information, and performing graph-based data analysis without requiring raw query writing or connection management.
Back to servers
Provider
Memgraph
Release date
May 14, 2025
Language
Go
Stats
18 stars

The Memgraph MCP Server implements the Model Context Protocol (MCP) to connect Memgraph graph database with Large Language Models. This lightweight server enables LLMs to query Memgraph and leverage its graph capabilities, allowing for more powerful AI applications with database integration.

Getting Started

Prerequisites

Before setting up the Memgraph MCP Server, you need:

  • Python environment
  • Memgraph database
  • Claude for Desktop (or another MCP-compatible client)

Installation

  1. Install the uv package manager and create a virtual environment:

    # Install uv (follow instructions at https://docs.astral.sh/uv/getting-started/installation/)
    
    # Create and activate virtual environment
    uv venv
    
    # On Windows
    .venv\Scripts\activate
    
    # On macOS/Linux
    source .venv/bin/activate
    
  2. Install required dependencies:

    uv add "mcp[cli]" httpx
    
  3. Run the Memgraph MCP server:

    uv run server.py
    

Configuring Claude for Desktop

  1. Download and install Claude for Desktop

  2. Add the Memgraph server to Claude's configuration:

    On macOS/Linux:

    code ~/Library/Application\ Support/Claude/claude_desktop_config.json
    

    On Windows:

    code $env:AppData\Claude\claude_desktop_config.json
    
  3. Add the following configuration (adjust paths to match your system):

    {
        "mcpServers": {
          "mpc-memgraph": {
            "command": "/full/path/to/uv",
            "args": [
                "--directory",
                "/full/path/to/mcp-memgraph",
                "run",
                "server.py"
            ]
         }
       }
    }
    

    Note: Replace /full/path/to/uv with the actual path to your uv executable. You can find this by running which uv on macOS/Linux or where uv on Windows.

Using Memgraph MCP

Starting the Database

Run Memgraph with MAGE extensions and schema information enabled:

docker run -p 7687:7687 memgraph/memgraph-mage --schema-info-enabled=True

The --schema-info-enabled=True flag is required to allow the LLM to run the SHOW SCHEMA INFO query.

Interacting with Memgraph via Claude

  1. Open Claude Desktop
  2. You should see Memgraph tools and resources listed in the Claude interface
  3. You can now chat with Claude to query your Memgraph database

Available Tools

run_query()

This tool allows you to execute Cypher queries against your Memgraph database. Example usage in Claude:

Please run the query: MATCH (n) RETURN n LIMIT 10

Available Resources

get_schema()

This resource provides information about your Memgraph database schema, including node labels, relationship types, and properties. This helps the LLM understand your data model.

Note: This requires the --schema-info-enabled=True configuration flag when starting Memgraph.

How to add this MCP server to Cursor

There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json file so that it is available in all of your projects.

If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json file.

Adding an MCP server to Cursor globally

To add a global MCP server go to Cursor Settings > MCP and click "Add new global MCP server".

When you click that button the ~/.cursor/mcp.json file will be opened and you can add your server like this:

{
    "mcpServers": {
        "cursor-rules-mcp": {
            "command": "npx",
            "args": [
                "-y",
                "cursor-rules-mcp"
            ]
        }
    }
}

Adding an MCP server to a project

To add an MCP server to a project you can create a new .cursor/mcp.json file or add it to the existing one. This will look exactly the same as the global MCP server example above.

How to use the MCP server

Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.

The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.

You can also explictly ask the agent to use the tool by mentioning the tool name and describing what the function does.

Want to 10x your AI skills?

Get a free account and learn to code + market your apps using AI (with or without vibes!).

Nah, maybe later