MemoryGraph configuration options and environment variables.

Configuration Methods

Configuration is read from (in order of priority):

  1. Environment variables
  2. Config file (~/.config/memorygraph/config.toml)
  3. Default values

Environment Variables

Variable Description Default
MEMORYGRAPH_DATA_DIR Database storage directory ~/.local/share/memorygraph
MEMORYGRAPH_LOG_LEVEL Logging level INFO
MEMORYGRAPH_BACKEND Database backend sqlite
MEMORYGRAPH_INTELLIGENCE Enable intelligence features false

Database Backends

SQLite (Default)

Zero configuration, local-first storage.

# Uses default SQLite backend
# Data stored in ~/.local/share/memorygraph/memories.db

# Custom data directory
export MEMORYGRAPH_DATA_DIR=/path/to/data

Neo4j

For large-scale deployments with advanced graph queries.

# Install with Neo4j support
pipx install "memorygraphMCP[neo4j]"

# Configure Neo4j connection
export MEMORYGRAPH_BACKEND=neo4j
export MEMORYGRAPH_NEO4J_URI=bolt://localhost:7687
export MEMORYGRAPH_NEO4J_USER=neo4j
export MEMORYGRAPH_NEO4J_PASSWORD=your_password

Cloud Backend (Recommended)

Multi-device sync with zero maintenance. Get your API key from memorygraph.dev.

# Configure cloud backend
export MEMORYGRAPH_API_KEY=mg_your_key_here

# Run with cloud backend
memorygraph --backend cloud

Cloud Backend with Claude Code

# Add MCP server with cloud backend
claude mcp add --scope user memorygraph \
  --env MEMORYGRAPH_API_KEY=mg_your_key_here \
  -- memorygraph --backend cloud

Cloud Backend Environment Variables

Variable Description Default
MEMORYGRAPH_API_KEY Your API key from memorygraph.dev (required)
MEMORYGRAPH_API_URL API endpoint URL https://graph-api.memorygraph.dev

Config File

Create ~/.config/memorygraph/config.toml:

[database]
backend = "sqlite"
data_dir = "~/.local/share/memorygraph"

[logging]
level = "INFO"

[intelligence]
enabled = false

# Neo4j configuration (if using)
[neo4j]
uri = "bolt://localhost:7687"
user = "neo4j"
password = "your_password"

Claude Code Configuration

Pass Environment Variables

# When adding MCP server
claude mcp add memorygraph memorygraph \
  --env MEMORYGRAPH_DATA_DIR=/custom/path \
  --env MEMORYGRAPH_LOG_LEVEL=DEBUG

View Current Config

memorygraph --show-config

Per-Project Configuration

Use project scope for different configs per project:

# In project A
cd ~/projects/project-a
claude mcp add memorygraph memorygraph --scope project \
  --env MEMORYGRAPH_DATA_DIR=~/projects/project-a/.memorygraph

# In project B
cd ~/projects/project-b
claude mcp add memorygraph memorygraph --scope project \
  --env MEMORYGRAPH_DATA_DIR=~/projects/project-b/.memorygraph