Memgraph AI Toolkit

Build powerful AI applications with graph-powered RAG using Memgraph. This toolkit provides everything you need to integrate knowledge graphs into your GenAI workflows.
🚀 Quick Setup
Start Memgraph
docker run -p 7687:7687 \
--name memgraph \
memgraph/memgraph-mage:latest \
--schema-info-enabled=true
Install Packages
# Core toolbox
pip install memgraph-toolbox
# LangChain integration
pip install langchain-memgraph
# MCP server
pip install mcp-memgraph
# Unstructured to Graph
pip install unstructured2graph
📚 Usage Examples
unstructured2graph - Build Knowledge Graphs from Documents
Transform PDFs, URLs, and documents into queryable knowledge graphs:
import asyncio
from memgraph_toolbox.api.memgraph import Memgraph
from lightrag_memgraph import MemgraphLightRAGWrapper
from unstructured2graph import from_unstructured, create_index
async def main():
memgraph = Memgraph()
create_index(memgraph, "Chunk", "hash")
lightrag = MemgraphLightRAGWrapper()
await lightrag.initialize(working_dir="./lightrag_storage")
# Ingest documents from URLs or local files
await from_unstructured(
sources=["https://example.com/doc.pdf", "./local_file.md"],
memgraph=memgraph,
lightrag_wrapper=lightrag,
link_chunks=True,
)
await lightrag.afinalize()
asyncio.run(main())
👉 Full Documentation | Examples
langchain-memgraph - LangChain Integration
Natural Language Queries with MemgraphQAChain
from langchain_memgraph.graphs.memgraph import MemgraphLangChain
from langchain_memgraph.chains.graph_qa import MemgraphQAChain
from langchain_openai import ChatOpenAI
graph = MemgraphLangChain(url="bolt://localhost:7687")
chain = MemgraphQAChain.from_llm(
ChatOpenAI(temperature=0),
graph=graph,
model_name="gpt-4-turbo",
allow_dangerous_requests=True,
)
response = chain.invoke("Who are the main characters in the dataset?")
print(response["result"])
Build Agents with MemgraphToolkit
from langchain.chat_models import init_chat_model
from langchain_memgraph import MemgraphToolkit
from langchain_memgraph.graphs.memgraph import MemgraphLangChain
from langgraph.prebuilt import create_react_agent
llm = init_chat_model("gpt-4o-mini", model_provider="openai")
db = MemgraphLangChain(url="bolt://localhost:7687")
toolkit = MemgraphToolkit(db=db, llm=llm)
agent = create_react_agent(llm, toolkit.get_tools())
events = agent.stream({"messages": [("user", "Find all Person nodes")]})
👉 Full Documentation
mcp-memgraph - Model Context Protocol Server
Expose Memgraph to LLMs via MCP. Run with Docker:
# HTTP mode (recommended)
docker run --rm -p 8000:8000 memgraph/mcp-memgraph:latest
# Stdio mode for MCP clients
docker run --rm -i -e MCP_TRANSPORT=stdio memgraph/mcp-memgraph:latest
Available Tools:
| Tool | Description |
|---|
run_query | Execute Cypher queries |
get_schema | Fetch graph schema |
get_page_rank | Compute PageRank scores |
get_node_neighborhood | Find nodes within distance |
search_node_vectors | Vector similarity search |
👉 Full Documentation
sql2graph Agent - Automated Database Migration
Migrate from MySQL/PostgreSQL to Memgraph with AI assistance:
cd agents/sql2graph
uv run main.py
👉 Full Documentation
🛠️ Packages Overview