Skip to main content
Memgraph is an in-memory graph database that uses the Bolt protocol. It provides fast graph operations and is suitable for knowledge graph storage and relationship reasoning.
Cognee can use Memgraph as a graph store backend through this community-maintained adapter.

Installation

This adapter is a separate package from core Cognee. Before installing, complete the Cognee installation and ensure your environment is configured with LLM and embedding providers. After that, install the adapter package:
uv pip install cognee-community-graph-adapter-memgraph

Requirements

  • Python 3.10 to 3.13
  • Memgraph database instance
  • neo4j driver (for Bolt protocol support)

Configuration

Run a local Memgraph instance:
docker run -d --name memgraph -p 7687:7687 memgraph/memgraph-platform
Configure in Python:
from cognee_community_graph_adapter_memgraph import register
from cognee import config

register()
config.set_graph_database_provider("memgraph")
config.set_graph_db_config({
    "graph_database_url": "bolt://localhost:7687",
    "graph_database_username": "memgraph",
    "graph_database_password": "memgraph",
})
Or via environment variables:
GRAPH_DATABASE_PROVIDER="memgraph"
GRAPH_DATABASE_URL="bolt://localhost:7687"
GRAPH_DATABASE_USERNAME="memgraph"
GRAPH_DATABASE_PASSWORD="memgraph"

Important Notes

Import and call register() from the adapter package before using Memgraph with Cognee. This registers the adapter with Cognee’s graph provider system.
  1. Connection Errors: Ensure Memgraph is running and accessible at the specified Bolt URL (default port 7687)
  2. Driver: The adapter uses the neo4j driver for Bolt protocol support; ensure it is installed with Cognee or the community package
  3. Authentication: Use the same credentials you configured for your Memgraph instance

Features

  • Full support for Memgraph’s property graph model
  • Optimized queries for graph operations
  • Async/await support and transaction support
  • Graph completion search and Chain of Thought (COT) reasoning
  • Direct graph data access via get_graph_engine() and HTML visualization with cognee.visualize_graph()

Resources