The fastest way to get MemoryGraph working with Claude Code CLI.
Prerequisites
- Claude Code CLI installed (
claudecommand available) - Python 3.10 or higher
- pipx installed (recommended)
Quick Setup (3 Steps)
Step 1: Install MemoryGraph
# Install with pipx (handles PATH automatically)
pipx install memorygraphMCP
# Or with pip (ensure ~/.local/bin is in PATH)
pip install memorygraphMCP Step 2: Add to Claude Code
# Add MCP server (user scope - available everywhere)
claude mcp add memorygraph memorygraph
# Or project scope (only in current directory)
claude mcp add memorygraph memorygraph --scope project Step 3: Restart Claude Code
# Exit and restart Claude Code CLI
exit
claude Verify Connection
# Check MCP servers status
claude mcp list
# You should see:
# memorygraph: connected Important: Add Memory Directives
MemoryGraph won't automatically store memories. You need to add memory directives to tell Claude when and what to remember.
Add to your CLAUDE.md
Create or edit ~/.claude/CLAUDE.md (global) or .claude/CLAUDE.md (project):
## Memory Protocol
### REQUIRED: Before Starting Work
Use `recall_memories` before any task.
### REQUIRED: Automatic Storage
Store memories when:
- Fixing a bug β problem + solution
- Making architecture decisions
- Discovering reusable patterns
- Completing features
Always include tags, importance (0-1), and relationships. β Full Memory Protocol Guide with complete directives and examples.
Test Your First Memory
In Claude Code, try:
# Ask Claude to store a memory
"Store a memory that I successfully set up MemoryGraph"
# Recall it
"What do you remember about MemoryGraph setup?" Optional: Install the Plugin
The MemoryGraph plugin adds auto-invoked skills, slash commands, and hooks for a seamless experience.
/plugin install memory-graph/memorygraph-plugin With the plugin installed, you get:
- Auto-invoked skills - Solution capture when you fix errors, error tracking when you encounter issues
- Slash commands -
/recall,/solve,/learn,/relate,/graph,/brief - Smart hooks - Auto-load project context on session start, capture learnings before commits
Configuration Options
User vs Project Scope
| Scope | Command | Use Case |
|---|---|---|
| User | claude mcp add memorygraph memorygraph | Memory available in all projects |
| Project | claude mcp add memorygraph memorygraph --scope project | Project-specific memory |
Custom Data Directory
# Use a custom database location
claude mcp add memorygraph memorygraph --env MEMORYGRAPH_DATA_DIR=/path/to/data Enable Intelligence Features
# Install with intelligence extras
pipx install "memorygraphMCP[intelligence]"
# Then reconfigure
claude mcp remove memorygraph
claude mcp add memorygraph memorygraph Cloud Backend (Multi-Device Sync)
Want your memories synced across all your devices? Use the MemoryGraph Cloud backend.
Step 1: Get Your API Key
Sign up at memorygraph.dev and create an API key from your dashboard.
Step 2: Configure Cloud Backend
# Remove existing local config (if any)
claude mcp remove memorygraph
# Add with cloud backend
claude mcp add --scope user memorygraph \
--env MEMORYGRAPH_API_KEY=mg_your_key_here \
-- memorygraph --backend cloud Step 3: Restart Claude Code
exit
claude Verify Cloud Connection
claude mcp list
# Should show: memorygraph: connected Migrating Existing Local Memories
If you have existing local memories, export them first:
# Export from local SQLite
memorygraph export --format json --output my-memories.json
# Then configure cloud backend (above)
# Import to cloud
memorygraph import --format json --input my-memories.json Troubleshooting
"Command not found: memorygraph"
# Ensure pipx PATH is set
pipx ensurepath
# Restart terminal, then try again "Failed to connect" in MCP list
# Test memorygraph manually
memorygraph --health
# If it fails, check Python version
python3 --version # Must be 3.10+ See the full Troubleshooting Guide for more solutions.