# Mem0 Graph Store Options for Knowledge Graph Integration: A Complete Guide

> Explore Mem0's graph store options for knowledge graph integration. Connect with Neo4j, Memgraph, Amazon Neptune, and Kuzu for advanced entity extraction and vector search.

- Repository: [Mem0/mem0](https://github.com/mem0ai/mem0)
- Tags: how-to-guide
- Published: 2026-03-07

---

**Mem0 supports four graph store providers—Neo4j, Memgraph, Amazon Neptune, and Kuzu—via a pluggable abstraction layer that enables knowledge graph integration with entity extraction and vector similarity search.**

The mem0ai/mem0 repository implements a flexible **graph store** architecture that transforms traditional vector memory into a relational knowledge graph system. By supporting multiple production-grade graph databases behind a unified configuration interface, Mem0 enables developers to store, query, and update entity relationships alongside semantic embeddings. This guide examines the supported providers, configuration patterns, and implementation details found in the Mem0 source code.

## Supported Graph Store Providers

Mem0’s memory engine abstracts graph databases through the `GraphStoreConfig` class in [`mem0/graphs/configs.py`](https://github.com/mem0ai/mem0/blob/main/mem0/graphs/configs.py). The `graph_store.provider` field determines which concrete implementation is instantiated at runtime.

### Neo4j

The **Neo4j** provider is the default graph store implementation, wrapping `langchain_neo4j.Neo4jGraph` in [`mem0/memory/graph_memory.py`](https://github.com/mem0ai/mem0/blob/main/mem0/memory/graph_memory.py). Configuration is handled via the `Neo4jConfig` model, which accepts standard Bolt connection parameters (`url`, `username`, `password`, `database`) plus an optional `base_label` boolean. When enabled, `base_label=True` adds a common `__Entity__` label to all nodes, simplifying global entity queries.

### Memgraph

For **Memgraph** deployments, Mem0 uses the implementation in [`mem0/memory/memgraph_memory.py`](https://github.com/mem0ai/mem0/blob/main/mem0/memory/memgraph_memory.py), which integrates with `langchain_memgraph.graphs.memgraph.Memgraph`. The `MemgraphConfig` class handles connection credentials and automatically creates a vector index named `memzero` along with label and property indexes to accelerate similarity searches.

### Amazon Neptune

**Amazon Neptune** support spans two distinct endpoint types, each with dedicated implementations. The `NeptuneConfig` class in [`mem0/graphs/configs.py`](https://github.com/mem0ai/mem0/blob/main/mem0/graphs/configs.py) routes to either [`mem0/graphs/neptune/neptunegraph.py`](https://github.com/mem0ai/mem0/blob/main/mem0/graphs/neptune/neptunegraph.py) (for Neptune Analytics) or [`mem0/graphs/neptune/neptunedb.py`](https://github.com/mem0ai/mem0/blob/main/mem0/graphs/neptune/neptunedb.py) (for Neptune DB clusters). Neptune Analytics uses `neptune-graph://` endpoints and executes OpenCypher queries via `NeptuneAnalyticsGraph`, while Neptune DB clusters use `neptune-db://` endpoints with vector store integration.

### Kuzu

The **Kuzu** provider offers an embedded, file-based graph database ideal for local development or low-resource environments. Implemented in [`mem0/memory/kuzu_memory.py`](https://github.com/mem0ai/mem0/blob/main/mem0/memory/kuzu_memory.py), this provider uses `KuzuConfig` to accept a `db` parameter—either `:memory:` for transient storage or a file system path for persistent local graphs.

## Configuration Architecture

All graph stores share a common configuration schema defined in [`mem0/graphs/configs.py`](https://github.com/mem0ai/mem0/blob/main/mem0/graphs/configs.py). The `GraphStoreConfig` class validates the `provider` string and instantiates the appropriate subclass (`Neo4jConfig`, `MemgraphConfig`, `NeptuneConfig`, or `KuzuConfig`) through its `validate_config` method.

The configuration model also exposes three critical optional parameters:

- **`llm`**: A dedicated LLM configuration for graph-specific entity extraction, overriding the global LLM when present
- **`custom_prompt`**: Domain-specific instructions injected into the system prompt for the `EXTRACT_ENTITIES` and `RELATIONS` tools
- **`threshold`**: Vector similarity threshold (default **0.7**) controlling how closely embeddings must match existing nodes during ingestion

## Core Implementation Details

Each provider implements the `MemoryGraph` interface with four core operations: `add`, `search`, `delete_all`, and `get_all`. During the ingestion step, text embeddings are compared against existing node embeddings using the configured `threshold` value stored in `self.threshold`.

The **LLM-driven entity extraction** pipeline checks for a provider-specific LLM configuration before falling back to the global LLM. This allows different graph stores to use specialized models for relationship extraction without affecting other memory components.

For advanced use cases, each `MemoryGraph` exposes the underlying graph client through the `Memory.graph` attribute. For example, Neo4j implementations provide direct access to the `Neo4jGraph` instance for raw Cypher queries.

## Practical Configuration Examples

### Python SDK Configuration

The following example demonstrates initializing Mem0 with each supported graph store provider:

```python
from mem0 import Memory
from mem0.configs.base import MemoryConfig
from mem0.graphs.configs import (
    GraphStoreConfig, 
    Neo4jConfig, 
    MemgraphConfig, 
    NeptuneConfig, 
    KuzuConfig
)

# Neo4j configuration with base entity labeling

neo4j_cfg = GraphStoreConfig(
    provider="neo4j",
    config=Neo4jConfig(
        url="bolt://localhost:7687",
        username="neo4j",
        password="secret",
        database="mem0",
        base_label=True,
    ),
    threshold=0.75
)

# Memgraph configuration

memgraph_cfg = GraphStoreConfig(
    provider="memgraph",
    config=MemgraphConfig(
        url="bolt://memgraph:7687",
        username="memgraph",
        password="secret",
    ),
)

# Neptune Analytics configuration

neptune_cfg = GraphStoreConfig(
    provider="neptune",
    config=NeptuneConfig(
        endpoint="neptune-graph://g-1234567890abcdef",
        base_label=True,
    ),
)

# Kuzu embedded configuration

kuzu_cfg = GraphStoreConfig(
    provider="kuzu",
    config=KuzuConfig(db="./local_graph.kuzu"),
)

# Initialize with Neo4j (example)

memory = Memory(config=MemoryConfig(graph_store=neo4j_cfg))

# Add data with automatic entity extraction

memory.add("Alice bought a Tesla in 2024.", filters={"user_id": "user_1"})

# Search the knowledge graph

results = memory.search("What did Alice buy?", filters={"user_id": "user_1"})

```

### Server Configuration (YAML)

When deploying via the FastAPI server ([`mem0/server/main.py`](https://github.com/mem0ai/mem0/blob/main/mem0/server/main.py)), graph stores are configured through YAML:

```yaml
graph_store:
  provider: neptune
  config:
    endpoint: neptune-db://my-cluster.us-east-1.amazonaws.com
    base_label: true
  llm:
    provider: openai
    config:
      model: gpt-4
  custom_prompt: |
    Extract only explicit entities and relationships mentioned in the text.
  threshold: 0.8

```

### Accessing the Underlying Graph Client

For direct database access, extract the native client from the Memory instance:

```python
memory = Memory(config=MemoryConfig(graph_store=neo4j_cfg))

# Access Neo4jGraph instance directly

neo4j_client = memory.graph
records = neo4j_client.query(
    "MATCH (n:`__Entity__`) RETURN n.name AS name LIMIT 10"
)

```

## Summary

- Mem0 supports **four graph store providers**: Neo4j, Memgraph, Amazon Neptune, and Kuzu, each implemented in dedicated files under `mem0/memory/` and `mem0/graphs/`.
- Configuration is unified through `GraphStoreConfig` in [`mem0/graphs/configs.py`](https://github.com/mem0ai/mem0/blob/main/mem0/graphs/configs.py), which validates provider-specific settings via subclasses.
- The **similarity threshold** (default 0.7) and optional **custom prompts** allow fine-grained control over entity matching and extraction behavior.
- Providers expose underlying clients (e.g., `Neo4jGraph`) through the `Memory.graph` attribute for advanced Cypher or OpenCypher queries.
- Amazon Neptune uniquely supports both **Analytics** (`neptune-graph://`) and **DB cluster** (`neptune-db://`) endpoints.

## Frequently Asked Questions

### What graph store options does Mem0 support for knowledge graph integration?

Mem0 supports **Neo4j**, **Memgraph**, **Amazon Neptune**, and **Kuzu**. These are implemented as pluggable providers behind the `GraphStoreConfig` abstraction, allowing developers to switch between graph databases by changing the `provider` string and corresponding configuration class.

### How do I configure similarity thresholds for graph entity matching?

Set the `threshold` parameter in `GraphStoreConfig` (default **0.7**). This value controls how closely the embedding of incoming text must match existing node embeddings to be considered the same entity. Lower values require stricter similarity, reducing false duplicates but potentially creating redundant nodes.

### Can I use different LLMs for entity extraction in different graph stores?

Yes. The `graph_store.llm` field accepts a dedicated LLM configuration that overrides the global LLM for that specific graph store. This is useful when different graph databases require specialized extraction models or when you want to isolate entity extraction costs to specific memory segments.

### Which graph store is best for local development or testing?

**Kuzu** is the recommended choice for local development. Implemented in [`mem0/memory/kuzu_memory.py`](https://github.com/mem0ai/mem0/blob/main/mem0/memory/kuzu_memory.py), it operates as an embedded, file-based database requiring no external server. Use `KuzuConfig(db=":memory:")` for ephemeral storage during unit tests, or specify a file path for persistent local graphs without infrastructure overhead.