mcp-memgraph


Namemcp-memgraph JSON
Version 0.1.4 PyPI version JSON
download
home_pageNone
SummaryMCP integration and utilities for Memgraph MCP server
upload_time2025-08-06 11:35:41
maintainerNone
docs_urlNone
authorNone
requires_python>=3.13
licenseMIT
keywords graph integration mcp memgraph toolkit
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # 🚀 Memgraph MCP Server

Memgraph MCP Server is a lightweight server implementation of the Model Context Protocol (MCP) designed to connect Memgraph with LLMs.

![mcp-server](./mcp-server.png)

## Run Memgraph MCP server with Claude

1. Install [`uv`](https://docs.astral.sh/uv/getting-started/installation/)
2. Install [Claude for Desktop](https://claude.ai/download).
3. Add the Memgraph server to Claude config

You can do it in the UI, by opening your Claude desktop app navigate to `Settings`, under the `Developer` section, click on `Edit Config` and add the
following content:

```
{
    "mcpServers": {
      "mpc-memgraph": {
        "command": "uv",
        "args": [
            "run",
            "--with",
            "mcp-memgraph",
            "--python",
            "3.13",
            "mcp-memgraph"
        ]
     }
   }
}
```

Or you can open the config file in your favorite text editor. The location of the config file depends on your operating system:

**MacOS/Linux**

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

**Windows**

```
%APPDATA%/Claude/claude_desktop_config.json
```

> [!NOTE]  
> You may need to put the full path to the uv executable in the command field. You can get this by running `which uv` on MacOS/Linux or `where uv` on Windows. Make sure you pass in the absolute path to your server.

### Chat with the database

1. Run Memgraph MAGE:
   ```
   docker run -p 7687:7687 memgraph/memgraph-mage --schema-info-enabled=True
   ```
   The `--schema-info-enabled` configuration setting is set to `True` to allow LLM to run `SHOW SCHEMA INFO` query.
2. Open Claude Desktop and see the Memgraph tools and resources listed. Try it out! (You can load dummy data from [Memgraph Lab](https://memgraph.com/docs/data-visualization) Datasets)

## 🔧Tools

The Memgraph MCP Server exposes the following tools over MCP. Each tool runs a Memgraph‐toolbox operation and returns a list of records (dictionaries).

### run_query(query: str)

Run any arbitrary Cypher query against the connected Memgraph database.  
Parameters:

- `query`: A valid Cypher query string.

### get_configuration()

Fetch the current Memgraph configuration settings.  
Equivalent to running `SHOW CONFIGURATION`.

### get_index()

Retrieve information about existing indexes.  
Equivalent to running `SHOW INDEX INFO`.

### get_constraint()

Retrieve information about existing constraints.  
Equivalent to running `SHOW CONSTRAINT INFO`.

### get_schema()

Fetch the graph schema (labels, relationships, property keys).  
Equivalent to running `SHOW SCHEMA INFO`.

### get_storage()

Retrieve storage usage metrics for nodes, relationships, and properties.  
Equivalent to running `SHOW STORAGE INFO`.

### get_triggers()

List all database triggers.  
Equivalent to running `SHOW TRIGGERS`.

### get_betweenness_centrality()

Compute betweenness centrality on the entire graph.  
Uses `BetweennessCentralityTool` under the hood.

### get_page_rank()

Compute PageRank scores for all nodes.  
Uses `PageRankTool` under the hood.

## 🐳 Run Memgraph MCP server with Docker

### Building Memgraph MCP image

To build the Docker image using your local `memgraph-toolbox` code, run from the root of the monorepo:

```bash
cd /path/to/ai-toolkit
docker build -f integrations/mcp-memgraph/Dockerfile -t mcp-memgraph:latest .
```

This will include your local `memgraph-toolbox` and install it inside the image.

### Running the Docker image

#### 1. Streamable HTTP mode (recommended for most users)

To connect to local Memgraph containers, by default the MCP server will be available at `http://localhost:8000/mcp/`:

```bash
docker run --rm mcp-memgraph:latest
```

#### 2. Stdio mode (for integration with MCP stdio clients)

Configure your MCP host to run the docker command and utilize stdio:

```bash
docker run --rm -i -e MCP_TRANSPORT=stdio mcp-memgraph:latest
```

> 📄 Note: By default, the server will connect to a Memgraph instance running on localhost docker network `bolt://host.docker.internal:7687`. If you have a Memgraph instance running on a different host or port, you can specify it using environment variables.

#### 3. Custom Memgraph connection (external instance, no host network)

To avoid using host networking, or to connect to an external Memgraph instance:

```bash
docker run --rm \
  -p 8000:8000 \
  -e MEMGRAPH_URL=bolt://memgraph:7687 \
  -e MEMGRAPH_USER=myuser \
  -e MEMGRAPH_PASSWORD=password \
  mcp-memgraph:latest
```


## ⚙️ Configuration

### Environment Variables

The following environment variables can be used to configure the Memgraph MCP Server, whether running with Docker or directly (e.g., with `uv` or `python`).

- `MEMGRAPH_URL`: The Bolt URL of the Memgraph instance to connect to. Default: `bolt://host.docker.internal:7687`
    - The default value allows you to connect to a Memgraph instance running on your host machine from within the Docker container.
- `MEMGRAPH_USER`: The username for authentication. Default: `memgraph`
- `MEMGRAPH_PASSWORD`: The password for authentication. Default: empty
- `MEMGRAPH_DATABASE`: The database name to connect to. Default: `memgraph`
- `MCP_TRANSPORT`: The transport protocol to use. Options: `http` (default), `stdio`

You can set these environment variables in your shell, in your Docker run command, or in your deployment environment. 

### Connecting from VS Code (HTTP server)

If you are using VS Code MCP extension or similar, your configuration for an HTTP server would look like:

```json
{
    "servers": {
        "mcp-memgraph-http": {
            "url": "http://localhost:8000/mcp/"
        }
    }
}
```

> **Note:** The URL must end with `/mcp/`.

---

#### Running the Docker image in Visual Studio Code using stdio

You can also run the server using stdio for integration with MCP stdio clients:

1. Open Visual Studio Code, open Command Palette (Ctrl+Shift+P or Cmd+Shift+P on Mac), and select `MCP: Add server...`.
2. Choose `Command (stdio)`
3. Enter `docker` as the command to run.
4. For Server ID enter `mcp-memgraph`.
5. Choose "User" (adds to user-space `settings.json`) or "Workspace" (adds to `.vscode/mcp.json`).

When the settings open, enhance the args as follows:

```json
{
    "servers": {
        "mcp-memgraph": {
            "type": "stdio",
            "command": "docker",
            "args": [
                "run",
                "--rm",
                "-i",
                "-e", "MCP_TRANSPORT=stdio",
                "mcp-memgraph:latest"
            ]
        }
    }
}
```

To connect to a remote Memgraph instance with authentication, add environment variables to the `args` list:

```json
{
    "servers": {
        "mcp-memgraph": {
            "type": "stdio",
            "command": "docker",
            "args": [
                "run",
                "--rm",
                "-i",
                "-e", "MCP_TRANSPORT=stdio",
                "-e", "MEMGRAPH_URL=bolt://memgraph:7687",
                "-e", "MEMGRAPH_USER=myuser",
                "-e", "MEMGRAPH_PASSWORD=mypassword",
                "mcp-memgraph:latest"
            ]
        }
    }
}
```

---

Open GitHub Copilot in Agent mode and you'll be able to interact with the Memgraph MCP server.
            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "mcp-memgraph",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.13",
    "maintainer_email": null,
    "keywords": "graph, integration, mcp, memgraph, toolkit",
    "author": null,
    "author_email": "antejavor <ante.javor@memgraph.io>",
    "download_url": "https://files.pythonhosted.org/packages/69/19/6670f4df4af2729a41fdfe3f8855a46c8195a941858a6a817469d717f7b7/mcp_memgraph-0.1.4.tar.gz",
    "platform": null,
    "description": "# \ud83d\ude80 Memgraph MCP Server\n\nMemgraph MCP Server is a lightweight server implementation of the Model Context Protocol (MCP) designed to connect Memgraph with LLMs.\n\n![mcp-server](./mcp-server.png)\n\n## Run Memgraph MCP server with Claude\n\n1. Install [`uv`](https://docs.astral.sh/uv/getting-started/installation/)\n2. Install [Claude for Desktop](https://claude.ai/download).\n3. Add the Memgraph server to Claude config\n\nYou can do it in the UI, by opening your Claude desktop app navigate to `Settings`, under the `Developer` section, click on `Edit Config` and add the\nfollowing content:\n\n```\n{\n    \"mcpServers\": {\n      \"mpc-memgraph\": {\n        \"command\": \"uv\",\n        \"args\": [\n            \"run\",\n            \"--with\",\n            \"mcp-memgraph\",\n            \"--python\",\n            \"3.13\",\n            \"mcp-memgraph\"\n        ]\n     }\n   }\n}\n```\n\nOr you can open the config file in your favorite text editor. The location of the config file depends on your operating system:\n\n**MacOS/Linux**\n\n```\n~/Library/Application\\ Support/Claude/claude_desktop_config.json\n```\n\n**Windows**\n\n```\n%APPDATA%/Claude/claude_desktop_config.json\n```\n\n> [!NOTE]  \n> You may need to put the full path to the uv executable in the command field. You can get this by running `which uv` on MacOS/Linux or `where uv` on Windows. Make sure you pass in the absolute path to your server.\n\n### Chat with the database\n\n1. Run Memgraph MAGE:\n   ```\n   docker run -p 7687:7687 memgraph/memgraph-mage --schema-info-enabled=True\n   ```\n   The `--schema-info-enabled` configuration setting is set to `True` to allow LLM to run `SHOW SCHEMA INFO` query.\n2. Open Claude Desktop and see the Memgraph tools and resources listed. Try it out! (You can load dummy data from [Memgraph Lab](https://memgraph.com/docs/data-visualization) Datasets)\n\n## \ud83d\udd27Tools\n\nThe Memgraph MCP Server exposes the following tools over MCP. Each tool runs a Memgraph\u2010toolbox operation and returns a list of records (dictionaries).\n\n### run_query(query: str)\n\nRun any arbitrary Cypher query against the connected Memgraph database.  \nParameters:\n\n- `query`: A valid Cypher query string.\n\n### get_configuration()\n\nFetch the current Memgraph configuration settings.  \nEquivalent to running `SHOW CONFIGURATION`.\n\n### get_index()\n\nRetrieve information about existing indexes.  \nEquivalent to running `SHOW INDEX INFO`.\n\n### get_constraint()\n\nRetrieve information about existing constraints.  \nEquivalent to running `SHOW CONSTRAINT INFO`.\n\n### get_schema()\n\nFetch the graph schema (labels, relationships, property keys).  \nEquivalent to running `SHOW SCHEMA INFO`.\n\n### get_storage()\n\nRetrieve storage usage metrics for nodes, relationships, and properties.  \nEquivalent to running `SHOW STORAGE INFO`.\n\n### get_triggers()\n\nList all database triggers.  \nEquivalent to running `SHOW TRIGGERS`.\n\n### get_betweenness_centrality()\n\nCompute betweenness centrality on the entire graph.  \nUses `BetweennessCentralityTool` under the hood.\n\n### get_page_rank()\n\nCompute PageRank scores for all nodes.  \nUses `PageRankTool` under the hood.\n\n## \ud83d\udc33 Run Memgraph MCP server with Docker\n\n### Building Memgraph MCP image\n\nTo build the Docker image using your local `memgraph-toolbox` code, run from the root of the monorepo:\n\n```bash\ncd /path/to/ai-toolkit\ndocker build -f integrations/mcp-memgraph/Dockerfile -t mcp-memgraph:latest .\n```\n\nThis will include your local `memgraph-toolbox` and install it inside the image.\n\n### Running the Docker image\n\n#### 1. Streamable HTTP mode (recommended for most users)\n\nTo connect to local Memgraph containers, by default the MCP server will be available at `http://localhost:8000/mcp/`:\n\n```bash\ndocker run --rm mcp-memgraph:latest\n```\n\n#### 2. Stdio mode (for integration with MCP stdio clients)\n\nConfigure your MCP host to run the docker command and utilize stdio:\n\n```bash\ndocker run --rm -i -e MCP_TRANSPORT=stdio mcp-memgraph:latest\n```\n\n> \ud83d\udcc4 Note: By default, the server will connect to a Memgraph instance running on localhost docker network `bolt://host.docker.internal:7687`. If you have a Memgraph instance running on a different host or port, you can specify it using environment variables.\n\n#### 3. Custom Memgraph connection (external instance, no host network)\n\nTo avoid using host networking, or to connect to an external Memgraph instance:\n\n```bash\ndocker run --rm \\\n  -p 8000:8000 \\\n  -e MEMGRAPH_URL=bolt://memgraph:7687 \\\n  -e MEMGRAPH_USER=myuser \\\n  -e MEMGRAPH_PASSWORD=password \\\n  mcp-memgraph:latest\n```\n\n\n## \u2699\ufe0f Configuration\n\n### Environment Variables\n\nThe following environment variables can be used to configure the Memgraph MCP Server, whether running with Docker or directly (e.g., with `uv` or `python`).\n\n- `MEMGRAPH_URL`: The Bolt URL of the Memgraph instance to connect to. Default: `bolt://host.docker.internal:7687`\n    - The default value allows you to connect to a Memgraph instance running on your host machine from within the Docker container.\n- `MEMGRAPH_USER`: The username for authentication. Default: `memgraph`\n- `MEMGRAPH_PASSWORD`: The password for authentication. Default: empty\n- `MEMGRAPH_DATABASE`: The database name to connect to. Default: `memgraph`\n- `MCP_TRANSPORT`: The transport protocol to use. Options: `http` (default), `stdio`\n\nYou can set these environment variables in your shell, in your Docker run command, or in your deployment environment. \n\n### Connecting from VS Code (HTTP server)\n\nIf you are using VS Code MCP extension or similar, your configuration for an HTTP server would look like:\n\n```json\n{\n    \"servers\": {\n        \"mcp-memgraph-http\": {\n            \"url\": \"http://localhost:8000/mcp/\"\n        }\n    }\n}\n```\n\n> **Note:** The URL must end with `/mcp/`.\n\n---\n\n#### Running the Docker image in Visual Studio Code using stdio\n\nYou can also run the server using stdio for integration with MCP stdio clients:\n\n1. Open Visual Studio Code, open Command Palette (Ctrl+Shift+P or Cmd+Shift+P on Mac), and select `MCP: Add server...`.\n2. Choose `Command (stdio)`\n3. Enter `docker` as the command to run.\n4. For Server ID enter `mcp-memgraph`.\n5. Choose \"User\" (adds to user-space `settings.json`) or \"Workspace\" (adds to `.vscode/mcp.json`).\n\nWhen the settings open, enhance the args as follows:\n\n```json\n{\n    \"servers\": {\n        \"mcp-memgraph\": {\n            \"type\": \"stdio\",\n            \"command\": \"docker\",\n            \"args\": [\n                \"run\",\n                \"--rm\",\n                \"-i\",\n                \"-e\", \"MCP_TRANSPORT=stdio\",\n                \"mcp-memgraph:latest\"\n            ]\n        }\n    }\n}\n```\n\nTo connect to a remote Memgraph instance with authentication, add environment variables to the `args` list:\n\n```json\n{\n    \"servers\": {\n        \"mcp-memgraph\": {\n            \"type\": \"stdio\",\n            \"command\": \"docker\",\n            \"args\": [\n                \"run\",\n                \"--rm\",\n                \"-i\",\n                \"-e\", \"MCP_TRANSPORT=stdio\",\n                \"-e\", \"MEMGRAPH_URL=bolt://memgraph:7687\",\n                \"-e\", \"MEMGRAPH_USER=myuser\",\n                \"-e\", \"MEMGRAPH_PASSWORD=mypassword\",\n                \"mcp-memgraph:latest\"\n            ]\n        }\n    }\n}\n```\n\n---\n\nOpen GitHub Copilot in Agent mode and you'll be able to interact with the Memgraph MCP server.",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "MCP integration and utilities for Memgraph MCP server",
    "version": "0.1.4",
    "project_urls": {
        "Homepage": "https://github.com/memgraph/ai-toolkit",
        "Issues": "https://github.com/memgraph/ai-toolkit/issues",
        "Source": "https://github.com/memgraph/ai-toolkit/tree/main/integrations/mcp-memgraph"
    },
    "split_keywords": [
        "graph",
        " integration",
        " mcp",
        " memgraph",
        " toolkit"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "ae3914424bfdb445087e9dc51fe5365ca10dcd76c62504e2767b69018b58c55c",
                "md5": "90190d657df5d503af0d9ca0c923bd99",
                "sha256": "caa9eff204495dcbddc826f0249aeae8cadbf2e67a37b92e233a749e00b6bfd2"
            },
            "downloads": -1,
            "filename": "mcp_memgraph-0.1.4-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "90190d657df5d503af0d9ca0c923bd99",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.13",
            "size": 6865,
            "upload_time": "2025-08-06T11:35:40",
            "upload_time_iso_8601": "2025-08-06T11:35:40.714312Z",
            "url": "https://files.pythonhosted.org/packages/ae/39/14424bfdb445087e9dc51fe5365ca10dcd76c62504e2767b69018b58c55c/mcp_memgraph-0.1.4-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "69196670f4df4af2729a41fdfe3f8855a46c8195a941858a6a817469d717f7b7",
                "md5": "c6dd6a3d51f128b0c7ab3502db16c5ae",
                "sha256": "192f82eccfaba58615acd30e17beeadea69d99efb5bfcbf93e4a1d6e951fc468"
            },
            "downloads": -1,
            "filename": "mcp_memgraph-0.1.4.tar.gz",
            "has_sig": false,
            "md5_digest": "c6dd6a3d51f128b0c7ab3502db16c5ae",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.13",
            "size": 92165,
            "upload_time": "2025-08-06T11:35:41",
            "upload_time_iso_8601": "2025-08-06T11:35:41.837385Z",
            "url": "https://files.pythonhosted.org/packages/69/19/6670f4df4af2729a41fdfe3f8855a46c8195a941858a6a817469d717f7b7/mcp_memgraph-0.1.4.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-08-06 11:35:41",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "memgraph",
    "github_project": "ai-toolkit",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "mcp-memgraph"
}
        
Elapsed time: 1.01529s